/* * refine_tin.h - This code contains allows you to tile, and refine a tin * * Author: Jon Todd * */ //////////////////////////////////////////////////////////////////////////////// #ifndef __refine_tin_h #define __refine_tin_h #include #include #include #include #include "tin.h" #include "pqelement.h" #include "pqheap.h" #define X 0 #define Y 1 #define Z 2 // This is a spcial point which is used only for corners which have no // data values extern COORD NODATA_CORNER; // dummy pointer for pointlist when triangle should not be drawn extern QUEUE NO_DRAW; #define ABS(x) ( (x) < 0 ? -(x) : (x) ) #define MIN(x,y) ( x < y ? x : y ) #define MAX(x,y) ( x < y ? y : x ) #define MODULUS(p) (sqrt((p).x * (p).x + (p).y * (p).y + (p).z * (p).z) ) #define SIGN(x) ( x < 0 ? -1 : 1 ) #define DOTPRODUCT(v1,v2) ( v1.x*v2.x + v1.y*v2.y + v1.z*v2.z ) #define INVERTVECTOR(p1) p1.x = -p1.x; p1.y = -p1.y; p1.z = -p1.z #define CROSSPROD(p1,p2,p3) p3.x = p1.y*p2.z - p1.z*p2.y;p3.y = p1.z*p2.x - p1.x*p2.z;p3.z = p1.x*p2.y - p1.y*p2.x #define FALSE 0 #define TRUE 1 #define EPSILON 0.0001 /* small double for vertex closeness */ TINLIST doTiles(GRID *bigGrid, double e, double mem); GRID *getTile(GRID *bigGrid, int startI, int startJ, int a, int noData); void distrPoints(TRIANGLE* t1, TRIANGLE* t2, TRIANGLE* t3, TRIANGLE* s, TRIANGLE* sp, double e, PQueue* pq, TIN *tin); TIN* initTin(GRID *g, PQueue* pq, double e); COORD* findThirdPoint(POINT p1, POINT p2, POINT p3, POINT pa, POINT pb); void fixCollinear(POINT pa, POINT pb, POINT pc, TRIANGLE* s, double e, PQueue* pq, COORD* maxError, TIN *tin, short delaunay); void updateTinCorner(TIN *tin, TRIANGLE* t1, TRIANGLE* t2, TRIANGLE* t3); void enforceDelaunay(TRIANGLE *t, COORD *p1, COORD *p2, COORD *p3, double e, PQueue* pq, TIN *tin); void edgeSwap(TRIANGLE *t1, TRIANGLE *t2, COORD *a, COORD *b, COORD *c, COORD *d, double e, PQueue* pq, TIN *tin); short inCircumCircle(COORD *pa, COORD *pb, COORD *pc, COORD *p); int CircumCircle(double xp,double yp, double x1,double y1,double x2,double y2,double x3,double y3, double *xc,double *yc,double *r); #endif