PostGIS  3.4.0dev-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 700 of file ptarray.c.

701 {
702  if (!in)
703  {
704  lwerror("ptarray_is_closed: called with null point array");
705  return 0;
706  }
707  if (in->npoints <= 1 ) return in->npoints; /* single-point are closed, empty not closed */
708 
709  return 0 == memcmp(getPoint_internal(in, 0), getPoint_internal(in, in->npoints-1), ptarray_point_size(in));
710 }
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition: lwinline.h:58
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:77
uint32_t npoints
Definition: liblwgeom.h:427

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

Here is the call graph for this function: