PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ ptarray_strip_nan_coords_in_place()

static void ptarray_strip_nan_coords_in_place ( POINTARRAY pa)
static

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

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

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: