PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ptarray_strip_nan_coords_in_place()

static void ptarray_strip_nan_coords_in_place ( POINTARRAY pa)
static

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

44 {
45  uint32_t i, j = 0;
46  POINT4D *p, *np;
47  int ndims = FLAGS_NDIMS(pa->flags);
48  for ( i = 0; i < pa->npoints; i++ )
49  {
50  int isnan = 0;
51  p = (POINT4D *)(getPoint_internal(pa, i));
52  if ( isnan(p->x) || isnan(p->y) ) isnan = 1;
53  else if (ndims > 2 && isnan(p->z) ) isnan = 1;
54  else if (ndims > 3 && isnan(p->m) ) isnan = 1;
55  if ( isnan ) continue;
56 
57  np = (POINT4D *)(getPoint_internal(pa, j++));
58  if ( np != p ) {
59  np->x = p->x;
60  np->y = p->y;
61  if (ndims > 2)
62  np->z = p->z;
63  if (ndims > 3)
64  np->m = p->m;
65  }
66  }
67  pa->npoints = j;
68 }
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:179
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:75
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: