PostGIS  2.2.7dev-r@@SVN_REVISION@@
int lwpoint_inside_circle ( const LWPOINT p,
double  cx,
double  cy,
double  rad 
)

Definition at line 566 of file lwgeom.c.

References circ_node::center, distance2d_pt_pt(), getPoint2d_cp(), LW_FALSE, LW_TRUE, LWPOINT::point, POINT2D::x, and POINT2D::y.

Referenced by LWGEOM_inside_circle_point().

567 {
568  const POINT2D *pt;
569  POINT2D center;
570 
571  if ( ! p || ! p->point )
572  return LW_FALSE;
573 
574  pt = getPoint2d_cp(p->point, 0);
575 
576  center.x = cx;
577  center.y = cy;
578 
579  if ( distance2d_pt_pt(pt, &center) < rad )
580  return LW_TRUE;
581 
582  return LW_FALSE;
583 }
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
The old function nessecary for ptarray_segmentize2d in ptarray.c.
Definition: measures.c:2301
POINTARRAY * point
Definition: liblwgeom.h:395
double x
Definition: liblwgeom.h:312
#define LW_FALSE
Definition: liblwgeom.h:62
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, int n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
Definition: lwgeom_api.c:472
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
double y
Definition: liblwgeom.h:312

Here is the call graph for this function:

Here is the caller graph for this function: