PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ crosses_dateline()

int crosses_dateline ( const GEOGRAPHIC_POINT s,
const GEOGRAPHIC_POINT e 
)

Definition at line 616 of file lwgeodetic.c.

References FP_EQUALS, GEOGRAPHIC_POINT::lon, LW_FALSE, LW_TRUE, and SIGNUM.

Referenced by ptarray_area_spheroid().

617 {
618  double sign_s = SIGNUM(s->lon);
619  double sign_e = SIGNUM(e->lon);
620  double ss = fabs(s->lon);
621  double ee = fabs(e->lon);
622  if ( sign_s == sign_e )
623  {
624  return LW_FALSE;
625  }
626  else
627  {
628  double dl = ss + ee;
629  if ( dl < M_PI )
630  return LW_FALSE;
631  else if ( FP_EQUALS(dl, M_PI) )
632  return LW_FALSE;
633  else
634  return LW_TRUE;
635  }
636 }
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
#define FP_EQUALS(A, B)
#define SIGNUM(n)
Macro that returns: -1 if n < 0, 1 if n > 0, 0 if n == 0.
Here is the caller graph for this function: