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

Definition at line 522 of file lwgeom.c.

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

Referenced by LWGEOM_inside_circle_point().

523 {
524  POINT2D center;
525  POINT2D pt;
526 
527  if ( ! p || ! p->point )
528  return LW_FALSE;
529 
530  getPoint2d_p(p->point, 0, &pt);
531 
532  center.x = cx;
533  center.y = cy;
534 
535  if ( distance2d_pt_pt(&pt, &center) < rad )
536  return LW_TRUE;
537 
538  return LW_FALSE;
539 }
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
The old function nessecary for ptarray_segmentize2d in ptarray.c.
Definition: measures.c:2123
POINTARRAY * point
Definition: liblwgeom.h:367
double x
Definition: liblwgeom.h:284
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
double y
Definition: liblwgeom.h:284
int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point)
Definition: lwgeom_api.c:434

Here is the call graph for this function:

Here is the caller graph for this function: