PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ lwpoint_inside_circle()

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

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

645 {
646  const POINT2D *pt;
647  POINT2D center;
648 
649  if ( ! p || ! p->point )
650  return LW_FALSE;
651 
652  pt = getPoint2d_cp(p->point, 0);
653 
654  center.x = cx;
655  center.y = cy;
656 
657  if ( distance2d_pt_pt(pt, &center) < rad )
658  return LW_TRUE;
659 
660  return LW_FALSE;
661 }
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
Definition: measures.c:2313
POINTARRAY * point
Definition: liblwgeom.h:413
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
Definition: lwinline.h:91
double x
Definition: liblwgeom.h:330
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
double y
Definition: liblwgeom.h:330
Here is the call graph for this function:
Here is the caller graph for this function: