Returns true if an intersection can be calculated, and places it in *g.
Returns false otherwise.
Definition at line 1127 of file lwgeodetic.c.
1161 LWDEBUGF(4,
"e1 cross product == POINT(%.12g %.12g %.12g)", ea.
x, ea.
y, ea.
z);
1162 LWDEBUGF(4,
"e2 cross product == POINT(%.12g %.12g %.12g)", eb.
x, eb.
y, eb.
z);
1192 LWDEBUGF(4,
"v == POINT(%.12g %.12g %.12g)", v.
x, v.
y, v.
z);
1193 g->
lat = atan2(v.
z, sqrt(v.
x * v.
x + v.
y * v.
y));
1194 g->
lon = atan2(v.
y, v.
x);
1203 LWDEBUG(4,
"flipping point to other side of sphere");
1206 if ( g->
lon > M_PI )
1208 g->
lon = -1.0 * (2.0 * M_PI - g->
lon);
#define LW_TRUE
Return types for functions with status returns.
void normalize(POINT3D *p)
Normalize to a unit vector.
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 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 cartesian coordinates on unit sphere to lon/lat coordinates static void cart2ll(const POINT3D...
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.
int geographic_point_equals(const GEOGRAPHIC_POINT *g1, const GEOGRAPHIC_POINT *g2)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
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().