PostGIS  2.4.9dev-r@@SVN_REVISION@@

## ◆ edge_point_side()

 static int edge_point_side ( const GEOGRAPHIC_EDGE * e, const GEOGRAPHIC_POINT * p )
static

Returns -1 if the point is to the left of the plane formed by the edge, 1 if the point is to the right, and 0 if the point is on the plane.

Definition at line 690 of file lwgeodetic.c.

Referenced by edge_point_on_plane(), and sphere_signed_area().

691 {
692  POINT3D normal, pt;
693  double w;
694  /* Normal to the plane defined by e */
695  robust_cross_product(&(e->start), &(e->end), &normal);
696  normalize(&normal);
697  geog2cart(p, &pt);
698  /* We expect the dot product of with normal with any vector in the plane to be zero */
699  w = dot_product(&normal, &pt);
700  LWDEBUGF(4,"dot product %.9g",w);
701  if ( FP_IS_ZERO(w) )
702  {
703  LWDEBUG(4, "point is on plane (dot product is zero)");
704  return 0;
705  }
706
707  if ( w < 0 )
708  return -1;
709  else
710  return 1;
711 }
void robust_cross_product(const GEOGRAPHIC_POINT *p, const GEOGRAPHIC_POINT *q, POINT3D *a)
Computes the cross product of two vectors using their lat, lng representations.
Definition: lwgeodetic.c:630
void normalize(POINT3D *p)
Normalize to a unit vector.
Definition: lwgeodetic.c:611
char * w
Definition: cu_out_twkb.c:25
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define FP_IS_ZERO(A)
static double dot_product(const POINT3D *p1, const POINT3D *p2)
Convert cartesion coordinates on unit sphere to lon/lat coordinates static void cart2ll(const POINT3D...
Definition: lwgeodetic.c:442
GEOGRAPHIC_POINT start
Definition: lwgeodetic.h:63
GEOGRAPHIC_POINT end
Definition: lwgeodetic.h:64
void geog2cart(const GEOGRAPHIC_POINT *g, POINT3D *p)
Convert spherical coordinates to cartesion coordinates on unit sphere.
Definition: lwgeodetic.c:400
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
Here is the call graph for this function: Here is the caller graph for this function: 