66        return( fabs(a - b) <= epsilon );
 
 
   79        return( (a - epsilon <= x && x <= b + epsilon)
 
   80                ||  (b - epsilon <= x && x <= a + epsilon) );
 
 
   99        return( sqrt(dx*dx + dy*dy) );
 
 
  120        return( sqrt(ax*ax + ay*ay) );
 
 
  131        return( sqrt(dx*dx + dy*dy) );
 
 
  135double          SG_Get_Distance(
double ax, 
double ay, 
double az, 
double bx, 
double by, 
double bz)
 
  141    return( sqrt(ax*ax + ay*ay + az*az) );
 
 
  153    return( sqrt(dx*dx + dy*dy + dz*dz) );
 
 
  169                return( a * acos(sin(aLat) * sin(bLat) + cos(aLat) * cos(bLat) * cos(bLon - aLon)) );
 
  173                double  F       = (aLat + bLat) / 2.;
 
  174                double  G       = (aLat - bLat) / 2.;
 
  175                double  l       = (aLon - bLon) / 2.;
 
  184                double  S       = sin2_G * cos2_l + cos2_F * sin2_l;
 
  185                double  C      = cos2_G * cos2_l + sin2_F * sin2_l;
 
  187                double  w       = atan(sqrt(S / 
C));
 
  188                double  D       = 2. * w * a;
 
  190                double  R       = sqrt(S * 
C) / w;
 
  191                double  H1      = (3. * R - 1.) / (2. * 
C);
 
  192                double  H2      = (3. * R + 1.) / (2. * S);
 
  196                double  d       = D * (1. + f * H1 * sin2_F * cos2_G - f * H2 * cos2_F * sin2_G);
 
 
  225        return( dx < 0. ? 
M_PI_360 + dx : dx );
 
 
  262                Angle_Min = fmod(Angle_Min, 
M_PI_360); 
if( Angle_Min < 0. ) Angle_Min += 
M_PI_360;
 
  263                Angle_Max = fmod(Angle_Max, 
M_PI_360); 
if( Angle_Max < 0. ) Angle_Max += 
M_PI_360;
 
  266        return( Angle_Min <= Angle_Max
 
  267                ? Angle_Min <= Angle && Angle <= Angle_Max
 
  268                : Angle_Min <= Angle || Angle <= Angle_Max
 
 
  293        if( (a1.
x == b1.
x && a1.
y == b1.
y) || (a1.
x == b2.
x && a1.
y == b2.
y) )
 
  300        if( (a2.
x == b1.
x && a2.
y == b1.
y) || (a2.
x == b2.
x && a2.
y == b2.
y) )
 
  308        double  lambda, div, a_dx, a_dy, b_dx, b_dy;
 
  316        if( (div = a_dx * b_dy - b_dx * a_dy) != 0. )
 
  318                lambda          = ((b1.
x - a1.
x) * b_dy - b_dx * (b1.
y - a1.
y)) / div;
 
  320                Crossing.
x     = a1.
x + lambda * a_dx;
 
  321                Crossing.
y     = a1.
y + lambda * a_dy;
 
  327                else if( 0. <= lambda && lambda <= 1. )
 
  329                        lambda  = ((b1.
x - a1.
x) * a_dy - a_dx * (b1.
y - a1.
y)) / div;
 
  331                        if( 0. <= lambda && lambda <= 1. )
 
 
  350        ra.
x   = rb.
x = Region.
xMin;
 
  358        ra.
x   = rb.
x = Region.
xMax;
 
  375        ra.
y   = rb.
y = Region.
yMin;
 
 
  401        if( bExactMatch && !
SG_Is_Between(Point, Line_A, Line_B, Epsilon) )
 
  406        double  b       = (Line_B.
y - Line_A.
y) / (Line_B.
x - Line_A.
x);
 
  407        double  a       = Line_A.
y - b * Line_A.
x;
 
 
  424                Point.
x - (Line_B.
y - Line_A.
y),
 
  425                Point.
y + (Line_B.
x - Line_A.
x)
 
  428        if( !
SG_Get_Crossing(Line_Point, Line_A, Line_B, Point, Point_Ortho, 
false) )
 
  433        if( !bExactMatch || (bExactMatch
 
  443        if( Distance_A < Distance_B )
 
  447                return( Distance_A );
 
  453                return( Distance_B );
 
 
  467        #define A       Triangle[0] 
  468        #define B       Triangle[1] 
  469        #define C       Triangle[2] 
  472        TSG_Point      AB, AC, AB_M, AC_M, AB_N, AC_N;
 
  476        AB_M.
x = 
A.x + AB.
x / 2.;
 
  477        AB_M.
y = 
A.y + AB.
y / 2.;
 
  478        AB_N.
x = AB_M.
x - AB.
y;
 
  479        AB_N.
y = AB_M.
y + AB.
x;
 
  483        AC_M.
x = 
A.x + AC.
x / 2.;
 
  484        AC_M.
y = 
A.y + AC.
y / 2.;
 
  485        AC_N.
x = AC_M.
x - AC.
y;
 
  486        AC_N.
y = AC_M.
y + AC.
x;
 
  490                AB.
x   = 
A.x - Point.
x;
 
  491                AB.
y   = 
A.y - Point.
y;
 
  493                Radius  = sqrt(AB.
x*AB.
x + AB.
y*AB.
y);
 
 
  520                TSG_Point *iP = Points, *jP = Points + nPoints - 1;
 
  522                for(
int i=0; i<nPoints; i++, jP=iP++)
 
  524                        Area += (jP->x * iP->
y) - (iP->
x * jP->y);
 
 
  542                        Area += (Points[j].x * Points[i].y)
 
  543                              - (Points[i].x * Points[j].y);
 
 
sLong Get_Count(void) const
bool SG_Get_Crossing_InRegion(TSG_Point &Crossing, const TSG_Point &a, const TSG_Point &b, const TSG_Rect &Region)
double SG_Get_Polygon_Area(TSG_Point *Points, int nPoints)
double SG_Get_Angle_Difference(double a, double b)
double SG_Get_Distance(double ax, double ay, double bx, double by, bool bPolar)
double SG_Get_Length(double dx, double dy)
bool SG_is_Angle_Between(double Angle, double Angle_Min, double Angle_Max, bool bCheckRange)
double SG_Get_Angle_Of_Direction(double dx, double dy)
double SG_Get_Nearest_Point_On_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, TSG_Point &Line_Point, bool bExactMatch)
bool SG_Get_Crossing(TSG_Point &Crossing, const TSG_Point &a1, const TSG_Point &a2, const TSG_Point &b1, const TSG_Point &b2, bool bExactMatch)
bool SG_Is_Point_On_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch, double Epsilon)
double SG_Get_Distance_To_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch)
bool SG_Is_Between(double x, double a, double b, double epsilon)
bool SG_Get_Triangle_CircumCircle(TSG_Point Triangle[3], TSG_Point &Point, double &Radius)
double SG_Get_Distance_Polar(double aLon, double aLat, double bLon, double bLat, double a, double e, bool bDegree)
bool SG_Is_Equal(double a, double b, double epsilon)