Returns true if an intersection can be calculated, and places it in *g.
Returns false otherwise.
Definition at line 1123 of file lwgeodetic.c.
References dot_product(), edge_contains_point(), GEOGRAPHIC_EDGE::end, FP_EQUALS, geographic_point_equals(), GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, LW_FALSE, LW_TRUE, LWDEBUG, LWDEBUGF, normalize(), rad2deg, robust_cross_product(), GEOGRAPHIC_EDGE::start, unit_normal(), POINT3D::x, POINT3D::y, and POINT3D::z.
Referenced by circ_tree_distance_tree_internal(), and test_edge_intersection().
1157 LWDEBUGF(4,
"e1 cross product == POINT(%.12g %.12g %.12g)", ea.
x, ea.
y, ea.
z);
1158 LWDEBUGF(4,
"e2 cross product == POINT(%.12g %.12g %.12g)", eb.
x, eb.
y, eb.
z);
1188 LWDEBUGF(4,
"v == POINT(%.12g %.12g %.12g)", v.
x, v.
y, v.
z);
1189 g->
lat = atan2(v.
z, sqrt(v.
x * v.
x + v.
y * v.
y));
1190 g->
lon = atan2(v.
y, v.
x);
1199 LWDEBUG(4,
"flipping point to other side of sphere");
1202 if ( g->
lon > M_PI )
1204 g->
lon = -1.0 * (2.0 * M_PI - g->
lon);
void robust_cross_product(const GEOGRAPHIC_POINT *p, const GEOGRAPHIC_POINT *q, POINT3D *a)
Computes the cross product of two vectors using their lat, lng representations.
void normalize(POINT3D *p)
Normalize to a unit vector.
int edge_contains_point(const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *p)
Returns true if the point p is on the minor edge defined by the end points of e.
#define LWDEBUG(level, msg)
void unit_normal(const POINT3D *P1, const POINT3D *P2, POINT3D *normal)
Calculates the unit normal to two vectors, trying to avoid problems with over-narrow or over-wide cas...
static double dot_product(const POINT3D *p1, const POINT3D *p2)
Convert cartesion coordinates on unit sphere to lon/lat coordinates static void cart2ll(const POINT3D...
#define LW_TRUE
Return types for functions with status returns.
int geographic_point_equals(const GEOGRAPHIC_POINT *g1, const GEOGRAPHIC_POINT *g2)
#define LWDEBUGF(level, msg,...)