PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ LWGEOM_inside_circle_point()

Datum LWGEOM_inside_circle_point ( PG_FUNCTION_ARGS  )

Definition at line 1165 of file lwgeom_functions_basic.c.

1166 {
1167  GSERIALIZED *geom;
1168  double cx = PG_GETARG_FLOAT8(1);
1169  double cy = PG_GETARG_FLOAT8(2);
1170  double rr = PG_GETARG_FLOAT8(3);
1171  LWPOINT *lwpoint;
1172  LWGEOM *lwgeom;
1173  int inside;
1174 
1175  geom = PG_GETARG_GSERIALIZED_P(0);
1176  lwgeom = lwgeom_from_gserialized(geom);
1177  lwpoint = lwgeom_as_lwpoint(lwgeom);
1178  if (lwpoint == NULL || lwgeom_is_empty(lwgeom))
1179  {
1180  PG_FREE_IF_COPY(geom, 0);
1181  PG_RETURN_NULL(); /* not a point */
1182  }
1183 
1184  inside = lwpoint_inside_circle(lwpoint, cx, cy, rr);
1185  lwpoint_free(lwpoint);
1186 
1187  PG_FREE_IF_COPY(geom, 0);
1188  PG_RETURN_BOOL(inside);
1189 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
void lwpoint_free(LWPOINT *pt)
Definition: lwpoint.c:213
int lwpoint_inside_circle(const LWPOINT *p, double cx, double cy, double rad)
Definition: lwgeom.c:662
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:203
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwinline.h:131

References lwgeom_as_lwpoint(), lwgeom_from_gserialized(), lwgeom_is_empty(), lwpoint_free(), and lwpoint_inside_circle().

Here is the call graph for this function: