PostGIS  2.5.0dev-r@@SVN_REVISION@@
lwpoly.c
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * PostGIS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * PostGIS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  **********************************************************************
20  *
21  * Copyright (C) 2012 Sandro Santilli <strk@kbt.io>
22  * Copyright (C) 2001-2006 Refractions Research Inc.
23  *
24  **********************************************************************/
25 
26 
27 /* basic LWPOLY manipulation */
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <math.h>
33 #include "liblwgeom_internal.h"
34 #include "lwgeom_log.h"
35 
36 
37 #define CHECK_POLY_RINGS_ZM 1
38 
39 /* construct a new LWPOLY. arrays (points/points per ring) will NOT be copied
40  * use SRID=SRID_UNKNOWN for unknown SRID (will have 8bit type's S = 0)
41  */
42 LWPOLY*
43 lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
44 {
45  LWPOLY *result;
46  int hasz, hasm;
47 #ifdef CHECK_POLY_RINGS_ZM
48  char zm;
49  uint32_t i;
50 #endif
51 
52  if ( nrings < 1 ) lwerror("lwpoly_construct: need at least 1 ring");
53 
54  hasz = FLAGS_GET_Z(points[0]->flags);
55  hasm = FLAGS_GET_M(points[0]->flags);
56 
57 #ifdef CHECK_POLY_RINGS_ZM
58  zm = FLAGS_GET_ZM(points[0]->flags);
59  for (i=1; i<nrings; i++)
60  {
61  if ( zm != FLAGS_GET_ZM(points[i]->flags) )
62  lwerror("lwpoly_construct: mixed dimensioned rings");
63  }
64 #endif
65 
66  result = (LWPOLY*) lwalloc(sizeof(LWPOLY));
67  result->type = POLYGONTYPE;
68  result->flags = gflags(hasz, hasm, 0);
69  FLAGS_SET_BBOX(result->flags, bbox?1:0);
70  result->srid = srid;
71  result->nrings = nrings;
72  result->maxrings = nrings;
73  result->rings = points;
74  result->bbox = bbox;
75 
76  return result;
77 }
78 
79 LWPOLY*
80 lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2,
81  POINT4D *p3, POINT4D *p4)
82 {
83  POINTARRAY *pa = ptarray_construct_empty(hasz, hasm, 5);
84  LWPOLY *lwpoly = lwpoly_construct_empty(SRID_UNKNOWN, hasz, hasm);
85 
91 
92  lwpoly_add_ring(lwpoly, pa);
93 
94  return lwpoly;
95 }
96 
97 LWPOLY *
98 lwpoly_construct_envelope(int srid, double x1, double y1, double x2, double y2)
99 {
100  POINT4D p1, p2, p3, p4;
101  LWPOLY *poly;
102 
103  p1.x = x1;
104  p1.y = y1;
105  p2.x = x1;
106  p2.y = y2;
107  p3.x = x2;
108  p3.y = y2;
109  p4.x = x2;
110  p4.y = y1;
111 
112  poly = lwpoly_construct_rectangle(0, 0, &p1, &p2, &p3, &p4);
113  lwgeom_set_srid(lwpoly_as_lwgeom(poly), srid);
115 
116  return poly;
117 }
118 
119 LWPOLY*
120 lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior)
121 {
122  const uint32_t segments = 4*segments_per_quarter;
123  const double theta = 2*M_PI / segments;
124  LWPOLY *lwpoly;
125  POINTARRAY *pa;
126  POINT4D pt;
127  uint32_t i;
128 
129  if (segments_per_quarter < 1)
130  {
131  lwerror("Need at least one segment per quarter-circle.");
132  return NULL;
133  }
134 
135  if (radius < 0)
136  {
137  lwerror("Radius must be positive.");
138  return NULL;
139  }
140 
141  lwpoly = lwpoly_construct_empty(srid, LW_FALSE, LW_FALSE);
142  pa = ptarray_construct_empty(LW_FALSE, LW_FALSE, segments + 1);
143 
144  if (exterior)
145  radius *= sqrt(1 + pow(tan(theta/2), 2));
146 
147  for (i = 0; i <= segments; i++)
148  {
149  pt.x = x + radius*sin(i * theta);
150  pt.y = y + radius*cos(i * theta);
151  ptarray_append_point(pa, &pt, LW_TRUE);
152  }
153 
154  lwpoly_add_ring(lwpoly, pa);
155  return lwpoly;
156 }
157 
158 LWPOLY*
159 lwpoly_construct_empty(int srid, char hasz, char hasm)
160 {
161  LWPOLY *result = lwalloc(sizeof(LWPOLY));
162  result->type = POLYGONTYPE;
163  result->flags = gflags(hasz,hasm,0);
164  result->srid = srid;
165  result->nrings = 0;
166  result->maxrings = 1; /* Allocate room for ring, just in case. */
167  result->rings = lwalloc(result->maxrings * sizeof(POINTARRAY*));
168  result->bbox = NULL;
169  return result;
170 }
171 
172 void
174 {
175  uint32_t t;
176 
177  if (!poly) return;
178 
179  if (poly->bbox) lwfree(poly->bbox);
180 
181  if ( poly->rings )
182  {
183  for (t = 0; t < poly->nrings; t++)
184  if (poly->rings[t]) ptarray_free(poly->rings[t]);
185  lwfree(poly->rings);
186  }
187 
188  lwfree(poly);
189 }
190 
191 void printLWPOLY(LWPOLY *poly)
192 {
193  uint32_t t;
194  lwnotice("LWPOLY {");
195  lwnotice(" ndims = %i", (int)FLAGS_NDIMS(poly->flags));
196  lwnotice(" SRID = %i", (int)poly->srid);
197  lwnotice(" nrings = %i", (int)poly->nrings);
198  for (t=0; t<poly->nrings; t++)
199  {
200  lwnotice(" RING # %i :",t);
201  printPA(poly->rings[t]);
202  }
203  lwnotice("}");
204 }
205 
206 /* @brief Clone LWLINE object. Serialized point lists are not copied.
207  *
208  * @see ptarray_clone
209  */
210 LWPOLY *
212 {
213  uint32_t i;
214  LWPOLY *ret = lwalloc(sizeof(LWPOLY));
215  memcpy(ret, g, sizeof(LWPOLY));
216  ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
217  for ( i = 0; i < g->nrings; i++ ) {
218  ret->rings[i] = ptarray_clone(g->rings[i]);
219  }
220  if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
221  return ret;
222 }
223 
224 /* Deep clone LWPOLY object. POINTARRAY are copied, as is ring array */
225 LWPOLY *
227 {
228  uint32_t i;
229  LWPOLY *ret = lwalloc(sizeof(LWPOLY));
230  memcpy(ret, g, sizeof(LWPOLY));
231  if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
232  ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
233  for ( i = 0; i < ret->nrings; i++ )
234  {
235  ret->rings[i] = ptarray_clone_deep(g->rings[i]);
236  }
237  FLAGS_SET_READONLY(ret->flags,0);
238  return ret;
239 }
240 
244 int
246 {
247  if( ! poly || ! pa )
248  return LW_FAILURE;
249 
250  /* We have used up our storage, add some more. */
251  if( poly->nrings >= poly->maxrings )
252  {
253  int new_maxrings = 2 * (poly->nrings + 1);
254  poly->rings = lwrealloc(poly->rings, new_maxrings * sizeof(POINTARRAY*));
255  poly->maxrings = new_maxrings;
256  }
257 
258  /* Add the new ring entry. */
259  poly->rings[poly->nrings] = pa;
260  poly->nrings++;
261 
262  return LW_SUCCESS;
263 }
264 
265 void
267 {
268  uint32_t i;
269 
270  /* No-op empties */
271  if ( lwpoly_is_empty(poly) )
272  return;
273 
274  /* External ring */
275  if ( ptarray_isccw(poly->rings[0]) )
277 
278  /* Internal rings */
279  for (i=1; i<poly->nrings; i++)
280  if ( ! ptarray_isccw(poly->rings[i]) )
282 
283 }
284 
285 int
287 {
288  uint32_t i;
289 
290  if ( lwpoly_is_empty(poly) )
291  return LW_TRUE;
292 
293  if ( ptarray_isccw(poly->rings[0]) )
294  return LW_FALSE;
295 
296  for ( i = 1; i < poly->nrings; i++)
297  if ( !ptarray_isccw(poly->rings[i]) )
298  return LW_FALSE;
299 
300  return LW_TRUE;
301 }
302 
303 void
305 {
307 }
308 
309 LWPOLY *
310 lwpoly_segmentize2d(const LWPOLY *poly, double dist)
311 {
312  POINTARRAY **newrings;
313  uint32_t i;
314 
315  newrings = lwalloc(sizeof(POINTARRAY *)*poly->nrings);
316  for (i=0; i<poly->nrings; i++)
317  {
318  newrings[i] = ptarray_segmentize2d(poly->rings[i], dist);
319  if ( ! newrings[i] )
320  {
321  uint32_t j = 0;
322  for (j = 0; j < i; j++)
323  ptarray_free(newrings[j]);
324  lwfree(newrings);
325  return NULL;
326  }
327  }
328  return lwpoly_construct(poly->srid, NULL,
329  poly->nrings, newrings);
330 }
331 
332 /*
333  * check coordinate equality
334  * ring and coordinate order is considered
335  */
336 char
337 lwpoly_same(const LWPOLY *p1, const LWPOLY *p2)
338 {
339  uint32_t i;
340 
341  if ( p1->nrings != p2->nrings ) return 0;
342  for (i=0; i<p1->nrings; i++)
343  {
344  if ( ! ptarray_same(p1->rings[i], p2->rings[i]) )
345  return 0;
346  }
347  return 1;
348 }
349 
350 /*
351  * Construct a polygon from a LWLINE being
352  * the shell and an array of LWLINE (possibly NULL) being holes.
353  * Pointarrays from intput geoms are cloned.
354  * SRID must be the same for each input line.
355  * Input lines must have at least 4 points, and be closed.
356  */
357 LWPOLY *
359  uint32_t nholes, const LWLINE **holes)
360 {
361  uint32_t nrings;
362  POINTARRAY **rings = lwalloc((nholes+1)*sizeof(POINTARRAY *));
363  int srid = shell->srid;
364  LWPOLY *ret;
365 
366  if ( shell->points->npoints < 4 )
367  lwerror("lwpoly_from_lwlines: shell must have at least 4 points");
368  if ( ! ptarray_is_closed_2d(shell->points) )
369  lwerror("lwpoly_from_lwlines: shell must be closed");
370  rings[0] = ptarray_clone_deep(shell->points);
371 
372  for (nrings=1; nrings<=nholes; nrings++)
373  {
374  const LWLINE *hole = holes[nrings-1];
375 
376  if ( hole->srid != srid )
377  lwerror("lwpoly_from_lwlines: mixed SRIDs in input lines");
378 
379  if ( hole->points->npoints < 4 )
380  lwerror("lwpoly_from_lwlines: holes must have at least 4 points");
381  if ( ! ptarray_is_closed_2d(hole->points) )
382  lwerror("lwpoly_from_lwlines: holes must be closed");
383 
384  rings[nrings] = ptarray_clone_deep(hole->points);
385  }
386 
387  ret = lwpoly_construct(srid, NULL, nrings, rings);
388  return ret;
389 }
390 
391 LWPOLY*
392 lwpoly_force_dims(const LWPOLY *poly, int hasz, int hasm)
393 {
394  LWPOLY *polyout;
395 
396  /* Return 2D empty */
397  if( lwpoly_is_empty(poly) )
398  {
399  polyout = lwpoly_construct_empty(poly->srid, hasz, hasm);
400  }
401  else
402  {
403  POINTARRAY **rings = NULL;
404  uint32_t i;
405  rings = lwalloc(sizeof(POINTARRAY*) * poly->nrings);
406  for( i = 0; i < poly->nrings; i++ )
407  {
408  rings[i] = ptarray_force_dims(poly->rings[i], hasz, hasm);
409  }
410  polyout = lwpoly_construct(poly->srid, NULL, poly->nrings, rings);
411  }
412  polyout->type = poly->type;
413  return polyout;
414 }
415 
416 int lwpoly_is_empty(const LWPOLY *poly)
417 {
418  if ( (poly->nrings < 1) || (!poly->rings) || (!poly->rings[0]) || (poly->rings[0]->npoints < 1) )
419  return LW_TRUE;
420  return LW_FALSE;
421 }
422 
424 {
425  uint32_t i = 0;
426  uint32_t v = 0; /* vertices */
427  assert(poly);
428  for ( i = 0; i < poly->nrings; i ++ )
429  {
430  v += poly->rings[i]->npoints;
431  }
432  return v;
433 }
434 
438 double
439 lwpoly_area(const LWPOLY *poly)
440 {
441  double poly_area = 0.0;
442  uint32_t i;
443 
444  if ( ! poly )
445  lwerror("lwpoly_area called with null polygon pointer!");
446 
447  for ( i=0; i < poly->nrings; i++ )
448  {
449  POINTARRAY *ring = poly->rings[i];
450  double ringarea = 0.0;
451 
452  /* Empty or messed-up ring. */
453  if ( ring->npoints < 3 )
454  continue;
455 
456  ringarea = fabs(ptarray_signed_area(ring));
457  if ( i == 0 ) /* Outer ring, positive area! */
458  poly_area += ringarea;
459  else /* Inner ring, negative area! */
460  poly_area -= ringarea;
461  }
462 
463  return poly_area;
464 }
465 
466 
471 double
473 {
474  double result=0.0;
475  uint32_t i;
476 
477  LWDEBUGF(2, "in lwgeom_polygon_perimeter (%d rings)", poly->nrings);
478 
479  for (i=0; i<poly->nrings; i++)
480  result += ptarray_length(poly->rings[i]);
481 
482  return result;
483 }
484 
489 double
491 {
492  double result=0.0;
493  uint32_t i;
494 
495  LWDEBUGF(2, "in lwgeom_polygon_perimeter (%d rings)", poly->nrings);
496 
497  for (i=0; i<poly->nrings; i++)
498  result += ptarray_length_2d(poly->rings[i]);
499 
500  return result;
501 }
502 
503 int
505 {
506  uint32_t i = 0;
507 
508  if ( poly->nrings == 0 )
509  return LW_TRUE;
510 
511  for ( i = 0; i < poly->nrings; i++ )
512  {
513  if (FLAGS_GET_Z(poly->flags))
514  {
515  if ( ! ptarray_is_closed_3d(poly->rings[i]) )
516  return LW_FALSE;
517  }
518  else
519  {
520  if ( ! ptarray_is_closed_2d(poly->rings[i]) )
521  return LW_FALSE;
522  }
523  }
524 
525  return LW_TRUE;
526 }
527 
528 int
530 {
531  if ( poly->nrings < 1 )
532  return LW_FAILURE;
533  return ptarray_startpoint(poly->rings[0], pt);
534 }
535 
536 int
537 lwpoly_contains_point(const LWPOLY *poly, const POINT2D *pt)
538 {
539  uint32_t i;
540 
541  if ( lwpoly_is_empty(poly) )
542  return LW_FALSE;
543 
544  if ( ptarray_contains_point(poly->rings[0], pt) == LW_OUTSIDE )
545  return LW_FALSE;
546 
547  for ( i = 1; i < poly->nrings; i++ )
548  {
549  if ( ptarray_contains_point(poly->rings[i], pt) == LW_INSIDE )
550  return LW_FALSE;
551  }
552  return LW_TRUE;
553 }
554 
555 
double x
Definition: liblwgeom.h:351
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:433
LWPOLY * lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2, POINT4D *p3, POINT4D *p4)
Definition: lwpoly.c:80
POINTARRAY * ptarray_clone(const POINTARRAY *ptarray)
Clone a POINTARRAY object.
Definition: ptarray.c:652
double lwpoly_area(const LWPOLY *poly)
Find the area of the outer ring - sum (area of inner rings).
Definition: lwpoly.c:439
int ptarray_isccw(const POINTARRAY *pa)
Definition: ptarray.c:1021
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
void lwfree(void *mem)
Definition: lwutil.c:244
double ptarray_length(const POINTARRAY *pts)
Find the 3d/2d length of the given POINTARRAY (depending on its dimensionality)
Definition: ptarray.c:1710
void lwpoly_release(LWPOLY *lwpoly)
Definition: lwpoly.c:304
int ptarray_is_closed_3d(const POINTARRAY *pa)
Definition: ptarray.c:701
char ptarray_same(const POINTARRAY *pa1, const POINTARRAY *pa2)
Definition: ptarray.c:478
#define POLYGONTYPE
Definition: liblwgeom.h:86
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:70
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:328
double lwpoly_perimeter(const LWPOLY *poly)
Compute the sum of polygon rings length.
Definition: lwpoly.c:472
double ptarray_length_2d(const POINTARRAY *pts)
Find the 2d length of the given POINTARRAY (even if it's 3d)
Definition: ptarray.c:1682
#define LW_SUCCESS
Definition: liblwgeom.h:79
POINTARRAY * ptarray_segmentize2d(const POINTARRAY *ipa, double dist)
Returns a modified POINTARRAY so that no segment is longer than the given distance (computed using 2d...
Definition: ptarray.c:414
uint32_t lwpoly_count_vertices(LWPOLY *poly)
Definition: lwpoly.c:423
void printLWPOLY(LWPOLY *poly)
Definition: lwpoly.c:191
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:152
int lwpoly_add_ring(LWPOLY *poly, POINTARRAY *pa)
Add a ring to a polygon.
Definition: lwpoly.c:245
GBOX * bbox
Definition: liblwgeom.h:452
int32_t srid
Definition: liblwgeom.h:420
double lwpoly_perimeter_2d(const LWPOLY *poly)
Compute the sum of polygon rings length (forcing 2d computation).
Definition: lwpoly.c:490
LWPOLY * lwpoly_clone(const LWPOLY *g)
Definition: lwpoly.c:211
double ptarray_signed_area(const POINTARRAY *pa)
Returns the area in cartesian units.
Definition: ptarray.c:990
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:688
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:319
uint32_t nrings
Definition: liblwgeom.h:454
#define LW_FAILURE
Definition: liblwgeom.h:78
int lwpoly_is_closed(const LWPOLY *poly)
Definition: lwpoly.c:504
char lwpoly_same(const LWPOLY *p1, const LWPOLY *p2)
Definition: lwpoly.c:337
unsigned int uint32_t
Definition: uthash.h:78
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:43
int lwpoly_is_clockwise(LWPOLY *poly)
Definition: lwpoly.c:286
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, then a duplicate point will not be added.
Definition: ptarray.c:156
#define LW_FALSE
Definition: liblwgeom.h:76
LWPOLY * lwpoly_construct_envelope(int srid, double x1, double y1, double x2, double y2)
Definition: lwpoly.c:98
uint8_t type
Definition: liblwgeom.h:450
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
uint32_t maxrings
Definition: liblwgeom.h:455
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoly.c:159
POINTARRAY ** rings
Definition: liblwgeom.h:456
POINTARRAY * ptarray_clone_deep(const POINTARRAY *ptarray)
Deep clone a pointarray (also clones serialized pointlist)
Definition: ptarray.c:628
#define LW_INSIDE
Constants for point-in-polygon return values.
POINTARRAY * ptarray_force_dims(const POINTARRAY *pa, int hasz, int hasm)
Definition: ptarray.c:1030
int lwpoly_contains_point(const LWPOLY *poly, const POINT2D *pt)
Definition: lwpoly.c:537
LWPOLY * lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes)
Definition: lwpoly.c:358
LWPOLY * lwpoly_clone_deep(const LWPOLY *g)
Definition: lwpoly.c:226
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
void ptarray_reverse_in_place(POINTARRAY *pa)
Definition: ptarray.c:341
tuple x
Definition: pixval.py:53
LWPOLY * lwpoly_force_dims(const LWPOLY *poly, int hasz, int hasm)
Definition: lwpoly.c:392
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
int lwpoly_startpoint(const LWPOLY *poly, POINT4D *pt)
Definition: lwpoly.c:529
int ptarray_startpoint(const POINTARRAY *pa, POINT4D *pt)
Definition: ptarray.c:1858
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:147
LWPOLY * lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior)
Definition: lwpoly.c:120
void printPA(POINTARRAY *pa)
Definition: lwgeom_api.c:496
int32_t srid
Definition: liblwgeom.h:453
void lwpoly_free(LWPOLY *poly)
Definition: lwpoly.c:173
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:237
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:679
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
void lwgeom_release(LWGEOM *lwgeom)
Free the containing LWGEOM and the associated BOX.
Definition: lwgeom.c:452
int ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt)
Return 1 if the point is inside the POINTARRAY, -1 if it is outside, and 0 if it is on the boundary...
Definition: ptarray.c:727
void lwgeom_set_srid(LWGEOM *geom, int srid)
Set the SRID on an LWGEOM For collections, only the parent gets an SRID, all the children get SRID_UN...
void lwpoly_force_clockwise(LWPOLY *poly)
Definition: lwpoly.c:266
uint8_t flags
Definition: liblwgeom.h:451
#define LW_OUTSIDE
void * lwalloc(size_t size)
Definition: lwutil.c:229
double y
Definition: liblwgeom.h:351
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:151
LWPOLY * lwpoly_segmentize2d(const LWPOLY *poly, double dist)
Definition: lwpoly.c:310
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
tuple y
Definition: pixval.py:54
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:416
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:149
POINTARRAY * points
Definition: liblwgeom.h:421
uint32_t npoints
Definition: liblwgeom.h:370