PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ circ_tree_get_point_outside()

int circ_tree_get_point_outside ( const CIRC_NODE node,
POINT2D pt 
)

Definition at line 473 of file lwgeodetic_tree.c.

References cart2geog(), circ_node::center, geog2cart(), GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, LW_FAILURE, LW_SUCCESS, rad2deg, circ_node::radius, vector_scale(), POINT2D::x, and POINT2D::y.

Referenced by CircTreePIP().

474 {
475  POINT3D center3d;
477  if (node->radius >= M_PI) return LW_FAILURE;
478  geog2cart(&(node->center), &center3d);
479  vector_scale(&center3d, -1.0);
480  cart2geog(&center3d, &g);
481  pt->x = rad2deg(g.lon);
482  pt->y = rad2deg(g.lat);
483  return LW_SUCCESS;
484 }
GEOGRAPHIC_POINT center
#define LW_SUCCESS
Definition: liblwgeom.h:80
void cart2geog(const POINT3D *p, GEOGRAPHIC_POINT *g)
Convert cartesion coordinates on unit sphere to spherical coordinates.
Definition: lwgeodetic.c:410
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:52
#define LW_FAILURE
Definition: liblwgeom.h:79
double x
Definition: liblwgeom.h:328
#define rad2deg(r)
Definition: lwgeodetic.h:80
double y
Definition: liblwgeom.h:328
void geog2cart(const GEOGRAPHIC_POINT *g, POINT3D *p)
Convert spherical coordinates to cartesion coordinates on unit sphere.
Definition: lwgeodetic.c:400
double radius
void vector_scale(POINT3D *n, double scale)
Scale a vector out by a factor.
Definition: lwgeodetic.c:483
Here is the call graph for this function:
Here is the caller graph for this function: