PostGIS  2.5.0dev-r@@SVN_REVISION@@
int crosses_dateline ( const GEOGRAPHIC_POINT s,
const GEOGRAPHIC_POINT e 
)

Definition at line 631 of file lwgeodetic.c.

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

Referenced by ptarray_area_spheroid().

632 {
633  double sign_s = SIGNUM(s->lon);
634  double sign_e = SIGNUM(e->lon);
635  double ss = fabs(s->lon);
636  double ee = fabs(e->lon);
637  if ( sign_s == sign_e )
638  {
639  return LW_FALSE;
640  }
641  else
642  {
643  double dl = ss + ee;
644  if ( dl < M_PI )
645  return LW_FALSE;
646  else if ( FP_EQUALS(dl, M_PI) )
647  return LW_FALSE;
648  else
649  return LW_TRUE;
650  }
651 }
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
#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: