PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ll2cart()

void ll2cart ( const POINT2D g,
POINT3D p 
)

Convert lon/lat coordinates to cartesion coordinates on unit sphere.

Definition at line 419 of file lwgeodetic.c.

References POINT2D::x, POINT3D::x, POINT2D::y, POINT3D::y, and POINT3D::z.

Referenced by lwpoly_intersects_line(), ptarray_calculate_gbox_geodetic(), ptarray_contains_point_sphere(), and test_sphere_project().

420 {
421  double x_rad = M_PI * g->x / 180.0;
422  double y_rad = M_PI * g->y / 180.0;
423  double cos_y_rad = cos(y_rad);
424  p->x = cos_y_rad * cos(x_rad);
425  p->y = cos_y_rad * sin(x_rad);
426  p->z = sin(y_rad);
427 }
double y
Definition: liblwgeom.h:340
double x
Definition: liblwgeom.h:340
double z
Definition: liblwgeom.h:340
double x
Definition: liblwgeom.h:328
double y
Definition: liblwgeom.h:328
Here is the caller graph for this function: