PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ crosses_dateline()

int crosses_dateline ( const GEOGRAPHIC_POINT s,
const GEOGRAPHIC_POINT e 
)

Definition at line 662 of file lwgeodetic.c.

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

Referenced by ptarray_area_spheroid().

663 {
664  double sign_s = SIGNUM(s->lon);
665  double sign_e = SIGNUM(e->lon);
666  double ss = fabs(s->lon);
667  double ee = fabs(e->lon);
668  if ( sign_s == sign_e )
669  {
670  return LW_FALSE;
671  }
672  else
673  {
674  double dl = ss + ee;
675  if ( dl < M_PI )
676  return LW_FALSE;
677  else if ( FP_EQUALS(dl, M_PI) )
678  return LW_FALSE;
679  else
680  return LW_TRUE;
681  }
682 }
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#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: