PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ptarray_strip_nan_coords_in_place()

static void ptarray_strip_nan_coords_in_place ( POINTARRAY pa)
static

Definition at line 123 of file liblwgeom/lwgeom_geos_clean.c.

124 {
125  uint32_t i, j = 0;
126  POINT4D *p, *np;
127  int ndims = FLAGS_NDIMS(pa->flags);
128  for ( i = 0; i < pa->npoints; i++ )
129  {
130  int isnan = 0;
131  p = (POINT4D *)(getPoint_internal(pa, i));
132  if ( isnan(p->x) || isnan(p->y) ) isnan = 1;
133  else if (ndims > 2 && isnan(p->z) ) isnan = 1;
134  else if (ndims > 3 && isnan(p->m) ) isnan = 1;
135  if ( isnan ) continue;
136 
137  np = (POINT4D *)(getPoint_internal(pa, j++));
138  if ( np != p ) {
139  np->x = p->x;
140  np->y = p->y;
141  if (ndims > 2)
142  np->z = p->z;
143  if (ndims > 3)
144  np->m = p->m;
145  }
146  }
147  pa->npoints = j;
148 }
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:179
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:77
double m
Definition: liblwgeom.h:414
double x
Definition: liblwgeom.h:414
double z
Definition: liblwgeom.h:414
double y
Definition: liblwgeom.h:414
lwflags_t flags
Definition: liblwgeom.h:431
uint32_t npoints
Definition: liblwgeom.h:427

References POINTARRAY::flags, FLAGS_NDIMS, getPoint_internal(), POINT4D::m, POINTARRAY::npoints, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by lwgeom_make_geos_friendly(), lwline_make_geos_friendly(), and ring_make_geos_friendly().

Here is the call graph for this function:
Here is the caller graph for this function: