PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ crosses_dateline()

int crosses_dateline ( const GEOGRAPHIC_POINT s,
const GEOGRAPHIC_POINT e 
)

Definition at line 635 of file lwgeodetic.c.

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

Referenced by ptarray_area_spheroid().

636 {
637  double sign_s = SIGNUM(s->lon);
638  double sign_e = SIGNUM(e->lon);
639  double ss = fabs(s->lon);
640  double ee = fabs(e->lon);
641  if ( sign_s == sign_e )
642  {
643  return LW_FALSE;
644  }
645  else
646  {
647  double dl = ss + ee;
648  if ( dl < M_PI )
649  return LW_FALSE;
650  else if ( FP_EQUALS(dl, M_PI) )
651  return LW_FALSE;
652  else
653  return LW_TRUE;
654  }
655 }
#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: