PostGIS  2.5.0dev-r@@SVN_REVISION@@
Datum LWGEOM_inside_circle_point ( PG_FUNCTION_ARGS  )

Definition at line 1094 of file lwgeom_functions_basic.c.

References dumpnode::geom, lwgeom_as_lwpoint(), lwgeom_from_gserialized(), lwgeom_is_empty(), lwpoint_free(), and lwpoint_inside_circle().

1095 {
1096  GSERIALIZED *geom;
1097  double cx = PG_GETARG_FLOAT8(1);
1098  double cy = PG_GETARG_FLOAT8(2);
1099  double rr = PG_GETARG_FLOAT8(3);
1100  LWPOINT *lwpoint;
1101  LWGEOM *lwgeom;
1102  int inside;
1103 
1104  geom = PG_GETARG_GSERIALIZED_P(0);
1105  lwgeom = lwgeom_from_gserialized(geom);
1106  lwpoint = lwgeom_as_lwpoint(lwgeom);
1107  if ( lwpoint == NULL || lwgeom_is_empty(lwgeom) )
1108  {
1109  PG_FREE_IF_COPY(geom, 0);
1110  PG_RETURN_NULL(); /* not a point */
1111  }
1112 
1113  inside = lwpoint_inside_circle(lwpoint, cx, cy, rr);
1114  lwpoint_free(lwpoint);
1115 
1116  PG_FREE_IF_COPY(geom, 0);
1117  PG_RETURN_BOOL(inside);
1118 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
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:646
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:160
LWGEOM * geom
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1386

Here is the call graph for this function: