PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpoint_inside_circle()

int lwpoint_inside_circle ( const LWPOINT p,
double  cx,
double  cy,
double  rad 
)

Definition at line 615 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().

616 {
617  const POINT2D *pt;
618  POINT2D center;
619 
620  if ( ! p || ! p->point )
621  return LW_FALSE;
622 
623  pt = getPoint2d_cp(p->point, 0);
624 
625  center.x = cx;
626  center.y = cy;
627 
628  if ( distance2d_pt_pt(pt, &center) < rad )
629  return LW_TRUE;
630 
631  return LW_FALSE;
632 }
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
The old function nessecary for ptarray_segmentize2d in ptarray.c.
Definition: measures.c:2317
POINTARRAY * point
Definition: liblwgeom.h:411
double x
Definition: liblwgeom.h:328
#define LW_FALSE
Definition: liblwgeom.h:77
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:373
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
double y
Definition: liblwgeom.h:328
Here is the call graph for this function:
Here is the caller graph for this function: