Create a new leaf node, storing pointers back to the end points for later.
Definition at line 67 of file lwgeodetic_tree.c.
References cart2geog(), circ_node::center, circ_node::edge_num, FP_EQUALS, geog2cart(), geographic_point_init(), circ_node::geom_type, getPoint_internal(), GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, lwalloc(), LWDEBUGF, circ_node::nodes, normalize(), circ_node::num_nodes, circ_node::p1, circ_node::p2, circ_node::pt_outside, circ_node::radius, sphere_distance(), vector_sum(), POINT2D::x, and POINT2D::y.
Referenced by circ_tree_new().
80 LWDEBUGF(3,
"edge #%d (%g %g, %g %g)", i, p1->
x, p1->
y, p2->
x, p2->
y);
100 node->
radius = diameter / 2.0;
double sphere_distance(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
Given two points on a unit sphere, calculate their distance apart in radians.
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
void normalize(POINT3D *p)
Normalize to a unit vector.
void cart2geog(const POINT3D *p, GEOGRAPHIC_POINT *g)
Convert cartesion coordinates on unit sphere to spherical coordinates.
Point in spherical coordinates on the world.
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
void geog2cart(const GEOGRAPHIC_POINT *g, POINT3D *p)
Convert spherical coordinates to cartesion coordinates on unit sphere.
void vector_sum(const POINT3D *a, const POINT3D *b, POINT3D *n)
Calculate the sum of two vectors.
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
void * lwalloc(size_t size)
#define LWDEBUGF(level, msg,...)
struct circ_node ** nodes