PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ptarray_is_closed()

int ptarray_is_closed ( const POINTARRAY in)

Check for ring closure using whatever dimensionality is declared on the pointarray.

Definition at line 680 of file ptarray.c.

References getPoint_internal(), lwerror(), POINTARRAY::npoints, and ptarray_point_size().

Referenced by lwtriangle_from_wkb_state(), and wkt_parser_triangle_new().

681 {
682  if (!in)
683  {
684  lwerror("ptarray_is_closed: called with null point array");
685  return 0;
686  }
687  if (in->npoints <= 1 ) return in->npoints; /* single-point are closed, empty not closed */
689  return 0 == memcmp(getPoint_internal(in, 0), getPoint_internal(in, in->npoints-1), ptarray_point_size(in));
690 }
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
int npoints
Definition: liblwgeom.h:355
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1706
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
Here is the call graph for this function:
Here is the caller graph for this function: