PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ clairaut_cartesian()

int clairaut_cartesian ( const POINT3D start,
const POINT3D end,
GEOGRAPHIC_POINT g_top,
GEOGRAPHIC_POINT g_bottom 
)

Computes the pole of the great circle disk which is the intersection of the great circle with the line of maximum/minimum gradiant that lies on the great circle plane.

Definition at line 1024 of file lwgeodetic.c.

References cart2geog(), GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, LW_FALSE, LW_SUCCESS, LW_TRUE, LWDEBUG, LWDEBUGF, unit_normal(), POINT3D::x, POINT3D::y, POINT3D::z, and z_to_latitude().

Referenced by test_clairaut().

1025 {
1026  POINT3D t1, t2;
1027  GEOGRAPHIC_POINT vN1, vN2;
1028  LWDEBUG(4,"entering function");
1029  unit_normal(start, end, &t1);
1030  unit_normal(end, start, &t2);
1031  LWDEBUGF(4, "unit normal t1 == POINT(%.8g %.8g %.8g)", t1.x, t1.y, t1.z);
1032  LWDEBUGF(4, "unit normal t2 == POINT(%.8g %.8g %.8g)", t2.x, t2.y, t2.z);
1033  cart2geog(&t1, &vN1);
1034  cart2geog(&t2, &vN2);
1035  g_top->lat = z_to_latitude(t1.z,LW_TRUE);
1036  g_top->lon = vN2.lon;
1037  g_bottom->lat = z_to_latitude(t2.z,LW_FALSE);
1038  g_bottom->lon = vN1.lon;
1039  LWDEBUGF(4, "clairaut top == GPOINT(%.6g %.6g)", g_top->lat, g_top->lon);
1040  LWDEBUGF(4, "clairaut bottom == GPOINT(%.6g %.6g)", g_bottom->lat, g_bottom->lon);
1041  return LW_SUCCESS;
1042 }
double y
Definition: liblwgeom.h:324
double z_to_latitude(double z, int top)
Used in great circle to compute the pole of the great circle.
Definition: lwgeodetic.c:997
#define LW_SUCCESS
Definition: liblwgeom.h:65
void cart2geog(const POINT3D *p, GEOGRAPHIC_POINT *g)
Convert cartesion coordinates on unit sphere to spherical coordinates.
Definition: lwgeodetic.c:364
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
double x
Definition: liblwgeom.h:324
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:32
double z
Definition: liblwgeom.h:324
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...
Definition: lwgeodetic.c:491
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
Here is the call graph for this function:
Here is the caller graph for this function: