#include #include "pqelement.h" #include "geom_tin.h" #define X 0 #define Y 1 #define Z 2 /* functions needed in priority queue */ double getPriority(PQ_elemType t) { assert(t); double error = findError(t->maxE[X],t->maxE[Y],t->maxE[Z],t); if (t->maxErrorValue != (long)error) { printf("ERROR: err = %f, maxerror=%li\n maxE=%p", error, t->maxErrorValue, t->maxE); printf("Tri: t:%p Points: %p(%d,%d) %p(%d,%d) %p(%d,%d) Tris: %p %p %p\n", t,t->p1,t->p1[X],t->p1[Y],t->p2,t->p2[X],t->p2[Y],t->p3,t->p3[X], t->p3[Y],t->p1p2,t->p1p3, t->p2p3); assert(0); exit(1); } // We return a negative error because we really want a max PQ instead of a min return -error; //return -t->maxErrorValue; } void printElem(PQ_elemType t) { assert(t); double error = findError(t->maxE[X],t->maxE[Y],t->maxE[Z],t); assert(t->maxErrorValue == error); printf("[%.2f] x:%d y:%d z:%d ptr:%p", error,t->maxE[X],t->maxE[Y], t->maxE[Z],t->maxE); }