PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ll2cart()

void ll2cart ( const POINT2D g,
POINT3D p 
)

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

Definition at line 423 of file lwgeodetic.c.

424 {
425  double x_rad = M_PI * g->x / 180.0;
426  double y_rad = M_PI * g->y / 180.0;
427  double cos_y_rad = cos(y_rad);
428  p->x = cos_y_rad * cos(x_rad);
429  p->y = cos_y_rad * sin(x_rad);
430  p->z = sin(y_rad);
431 }
double y
Definition: liblwgeom.h:331
double x
Definition: liblwgeom.h:331
double z
Definition: liblwgeom.h:343
double x
Definition: liblwgeom.h:343
double y
Definition: liblwgeom.h:343

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

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

Here is the caller graph for this function: