PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_isfinite()

int lwgeom_isfinite ( const LWGEOM lwgeom)

Check if a LWGEOM has any non-finite (NaN or Inf) coordinates.

Definition at line 2835 of file lwgeom.c.

2836 {
2838  int hasz = lwgeom_has_z(lwgeom);
2839  int hasm = lwgeom_has_m(lwgeom);
2840 
2841  while (lwpointiterator_has_next(it))
2842  {
2843  POINT4D p;
2844  lwpointiterator_next(it, &p);
2845  int finite = isfinite(p.x) &&
2846  isfinite(p.y) &&
2847  (hasz ? isfinite(p.z) : 1) &&
2848  (hasm ? isfinite(p.m) : 1);
2849 
2850  if (!finite)
2851  {
2853  return LW_FALSE;
2854  }
2855  }
2857  return LW_TRUE;
2858 }
#define LW_FALSE
Definition: liblwgeom.h:94
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition: lwiterator.c:243
int lwpointiterator_next(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assign the next point in the iterator to p, and advances the iterator to the next point.
Definition: lwiterator.c:210
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
Definition: lwiterator.c:268
int lwpointiterator_has_next(LWPOINTITERATOR *s)
Returns LW_TRUE if there is another point available in the iterator.
Definition: lwiterator.c:202
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:93
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:962
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:969
double x
Definition: liblwgeom.h:414
double z
Definition: liblwgeom.h:414
double y
Definition: liblwgeom.h:414

References LW_FALSE, LW_TRUE, lwgeom_has_m(), lwgeom_has_z(), lwpointiterator_create(), lwpointiterator_destroy(), lwpointiterator_has_next(), lwpointiterator_next(), POINT4D::m, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by buffer(), geography_bestsrid(), LWGEOM_dfullywithin(), LWGEOM_to_latlon(), ST_LargestEmptyCircle(), ST_MaximumInscribedCircle(), ST_Split(), and topologypreservesimplify().

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