PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ LWGEOM_inside_circle_point()

Datum LWGEOM_inside_circle_point ( PG_FUNCTION_ARGS  )

Definition at line 1105 of file lwgeom_functions_basic.c.

1106{
1107 GSERIALIZED *geom;
1108 double cx = PG_GETARG_FLOAT8(1);
1109 double cy = PG_GETARG_FLOAT8(2);
1110 double rr = PG_GETARG_FLOAT8(3);
1111 LWPOINT *lwpoint;
1112 LWGEOM *lwgeom;
1113 int inside;
1114
1115 geom = PG_GETARG_GSERIALIZED_P(0);
1116 lwgeom = lwgeom_from_gserialized(geom);
1117 lwpoint = lwgeom_as_lwpoint(lwgeom);
1118 if (lwpoint == NULL || lwgeom_is_empty(lwgeom))
1119 {
1120 PG_FREE_IF_COPY(geom, 0);
1121 PG_RETURN_NULL(); /* not a point */
1122 }
1123
1124 inside = lwpoint_inside_circle(lwpoint, cx, cy, rr);
1125 lwpoint_free(lwpoint);
1126
1127 PG_FREE_IF_COPY(geom, 0);
1128 PG_RETURN_BOOL(inside);
1129}
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:644
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition lwinline.h:121
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:193

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

Here is the call graph for this function: