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

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

580 {
581  const POINT2D *pt;
582  POINT2D center;
583 
584  if ( ! p || ! p->point )
585  return LW_FALSE;
586 
587  pt = getPoint2d_cp(p->point, 0);
588 
589  center.x = cx;
590  center.y = cy;
591 
592  if ( distance2d_pt_pt(pt, &center) < rad )
593  return LW_TRUE;
594 
595  return LW_FALSE;
596 }
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
The old function nessecary for ptarray_segmentize2d in ptarray.c.
Definition: measures.c:2315
POINTARRAY * point
Definition: liblwgeom.h:410
double x
Definition: liblwgeom.h:327
#define LW_FALSE
Definition: liblwgeom.h:76
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:485
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
double y
Definition: liblwgeom.h:327

Here is the call graph for this function:

Here is the caller graph for this function: