PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ ll2cart()

void ll2cart ( const POINT2D g,
POINT3D p 
)

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

Definition at line 388 of file lwgeodetic.c.

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

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

389 {
390  double x_rad = M_PI * g->x / 180.0;
391  double y_rad = M_PI * g->y / 180.0;
392  double cos_y_rad = cos(y_rad);
393  p->x = cos_y_rad * cos(x_rad);
394  p->y = cos_y_rad * sin(x_rad);
395  p->z = sin(y_rad);
396 }
double y
Definition: liblwgeom.h:339
double x
Definition: liblwgeom.h:339
double z
Definition: liblwgeom.h:339
double x
Definition: liblwgeom.h:327
double y
Definition: liblwgeom.h:327
Here is the caller graph for this function: