To get the effective area, we have to check what area a point results in when all smaller areas are eliminated.
236 LWDEBUG(2,
"Entered tune_areas");
242 double check_order_min_area = 0;
246 int current, before_current, after_current;
254 for (i=0;i<npoints;i++)
265 for (i=0;i<npoints;i++)
280 if (i<npoints-avoid_collaps)
286 lwerror(
"Oh no, this is a bug. For some reason the minHeap returned our points in the wrong order. Please file a ticket in PostGIS ticket system, or send a mial at the mailing list.Returned area = %lf, and last area = %lf",ea->
res_arealist[current],check_order_min_area);
312 if(after_current<npoints-1)
static int cmpfunc(const void *a, const void *b)
We create the minheap by ordering the minheap array by the areas in the areanode structs that the min...
static double triarea3d(const double *P1, const double *P2, const double *P3)
Calculate the area of a triangle in 3d space.
This structure is placed in an array with one member per point.
static void destroy_minheap(MINHEAP tree)
This structure holds a minheap tree that is used to keep track of what points that has the smallest e...
Datum area(PG_FUNCTION_ARGS)
static MINHEAP initiate_minheap(int npoints)
#define LWDEBUG(level, msg)
static double triarea2d(const double *P1, const double *P2, const double *P3)
Calculate the area of a triangle in 2d.
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
static void minheap_update(MINHEAP *tree, areanode *arealist, int idx)
The member of the minheap at index idx is changed.
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
static areanode * minheap_pop(MINHEAP *tree, areanode *arealist)
Get a reference to the point with the smallest effective area from the root of the min heap...
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
areanode * initial_arealist