59 VECTOR2I* aIntersectionPoint =
nullptr );
127 bool aMinArcAngle =
true );
132 return hypot( vector.
x, vector.
y );
147 return fabs( (
static_cast<double>( linePointB.
x - linePointA.
x ) *
148 static_cast<double>( linePointA.
y - referencePoint.
y ) -
149 static_cast<double>( linePointA.
x - referencePoint.
x ) *
150 static_cast<double>( linePointB.
y - linePointA.
y) )
161 VECTOR2I vectorAB = pointB - pointA;
165 double sqdistance = (double)vectorAB.
x * vectorAB.
x + (
double)vectorAB.
y * vectorAB.
y;
167 return sqdistance < threshold * threshold;
191 return hypot( aPointA.
x - aPointB.
x, aPointA.
y - aPointB.
y );
195inline double DEG2RAD(
double deg ) {
return deg * M_PI / 180.0; }
196inline double RAD2DEG(
double rad ) {
return rad * 180.0 / M_PI; }
199inline double RAD2DECIDEG(
double rad ) {
return rad * 1800.0 / M_PI; }
209 while( Angle >= 3600 )
223 while( Angle <= -1800 )
226 while( Angle > 1800 )
242 double end = aEndAngle;
244 if( aStartAngle > aEndAngle )
247 return aStartAngle < 360.0 && end > 360.0;
260 double end = aEndAngle;
262 if( aStartAngle > aEndAngle )
265 return aStartAngle < 180.0 && end > 180.0;
const VECTOR2I CalcArcMid(const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, bool aMinArcAngle=true)
Return the middle point of an arc, half-way between aStart and aEnd.
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
double DistanceLinePoint(const VECTOR2I &linePointA, const VECTOR2I &linePointB, const VECTOR2I &referencePoint)
Compute the distance between a line and a reference point Reference: http://mathworld....
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
bool InterceptsPositiveX(double aStartAngle, double aEndAngle)
Test if an arc from aStartAngle to aEndAngle crosses the positive X axis (0 degrees).
void NORMALIZE_ANGLE_POS(T &Angle)
bool InterceptsNegativeX(double aStartAngle, double aEndAngle)
Test if an arc from aStartAngle to aEndAngle crosses the negative X axis (180 degrees).
T NormalizeAnglePos(T Angle)
Normalize angle to be in the 0.0 .. 360.0 range: angle is in 1/10 degrees.
bool SegmentIntersectsSegment(const VECTOR2I &a_p1_l1, const VECTOR2I &a_p2_l1, const VECTOR2I &a_p1_l2, const VECTOR2I &a_p2_l2, VECTOR2I *aIntersectionPoint=nullptr)
Test if two lines intersect.
bool IsPointOnSegment(const VECTOR2I &aSegStart, const VECTOR2I &aSegEnd, const VECTOR2I &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
double RAD2DEG(double rad)
bool HitTestPoints(const VECTOR2I &pointA, const VECTOR2I &pointB, double threshold)
Test, if two points are near each other.
double DEG2RAD(double deg)
T NormalizeAngle180(T Angle)
Normalize angle to be in the -180.0 .. 180.0 range.
const VECTOR2I CalcArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
double GetLineLength(const VECTOR2I &aPointA, const VECTOR2I &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
double RAD2DECIDEG(double rad)
double EuclideanNorm(const VECTOR2I &vector)