33 uint32_t p, i, n_out_points=0, p1_set=0, p2_set=0;
37 double deltaval, quarter_delta, val1, val2;
39 int new_npoints = inpts->
npoints * 2;
42 dlist = (
double*)(
opts->serialized_pointlist);
54 memcpy(&p2, &p1,
sizeof(
POINT4D));
61 val1 = ((
double*) &(p1))[i];
62 val2 = ((
double*) &(p2))[i];
63 deltaval = val1 - val2;
64 quarter_delta = deltaval * 0.25;
65 if(!preserve_endpoint || p > 1)
67 dlist[n_out_points * ndims + i] = val2 + quarter_delta;
70 if(!preserve_endpoint || p < inpts->npoints - 1)
72 dlist[(n_out_points + p1_set) * ndims + i] = val1 - quarter_delta;
76 n_out_points+=(p1_set + p2_set);
83 opts->npoints = n_out_points;
88 if(isclosed && !preserve_endpoint)
90 opts->npoints = n_out_points;
95 opts->npoints = n_out_points;
111 for (j=0;j<n_iterations;j++)
135 for (i = 0; i < ipoly->
nrings; i++)
137 pa = ipoly->
rings[i];
138 for(j=0;j<n_iterations;j++)
164 LWDEBUG(2,
"Entered lwcollection_set_effective_area");
172 for( i = 0; i < igeom->
ngeoms; i++ )
184 LWDEBUG(2,
"Entered lwgeom_set_effective_area");
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
int lwpoly_add_ring(LWPOLY *poly, POINTARRAY *pa)
Add a ring, allocating extra space if necessary.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
#define FLAGS_GET_M(flags)
void ptarray_free(POINTARRAY *pa)
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
#define LW_TRUE
Return types for functions with status returns.
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
LWLINE * lwline_clone(const LWLINE *lwgeom)
int lwline_is_empty(const LWLINE *line)
int lwpoly_is_empty(const LWPOLY *poly)
int ptarray_has_z(const POINTARRAY *pa)
int ptarray_has_m(const POINTARRAY *pa)
int lwcollection_is_empty(const LWCOLLECTION *col)
static LWLINE * lwline_chaikin(const LWLINE *iline, int n_iterations)
LWGEOM * lwgeom_chaikin(const LWGEOM *igeom, int n_iterations, int preserve_endpoint)
static LWPOLY * lwpoly_chaikin(const LWPOLY *ipoly, int n_iterations, int preserve_endpoint)
static POINTARRAY * ptarray_chaikin(POINTARRAY *inpts, int preserve_endpoint, int isclosed)
static LWCOLLECTION * lwcollection_chaikin(const LWCOLLECTION *igeom, int n_iterations, int preserve_endpoint)
#define LWDEBUG(level, msg)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.