|
|
@ -63,20 +63,46 @@ bool SegmentIntersectsSegment( const VECTOR2I& a_p1_l1, const VECTOR2I& a_p2_l1, |
|
|
|
*/ |
|
|
|
void RotatePoint( int *pX, int *pY, const EDA_ANGLE& aAngle ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Rotate a VECTOR2I in place by aAngle. |
|
|
|
*/ |
|
|
|
inline void RotatePoint( VECTOR2I& point, const EDA_ANGLE& aAngle ) |
|
|
|
{ |
|
|
|
RotatePoint( &point.x, &point.y, aAngle ); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Return a new VECTOR2I that is the result of rotating aVector by aAngle. |
|
|
|
*/ |
|
|
|
inline VECTOR2I GetRotated( const VECTOR2I& aVector, const EDA_ANGLE& aAngle ) |
|
|
|
{ |
|
|
|
VECTOR2I result = aVector; |
|
|
|
RotatePoint( &result.x, &result.y, aAngle ); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Calculate the new point of coord coord pX, pY, for a rotation center cx, cy. |
|
|
|
*/ |
|
|
|
void RotatePoint( int *pX, int *pY, int cx, int cy, const EDA_ANGLE& aAngle ); |
|
|
|
|
|
|
|
inline void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, const EDA_ANGLE& aAngle ) |
|
|
|
/** |
|
|
|
* Rotate a VECTOR2I in place by aAngle about aCentre |
|
|
|
*/ |
|
|
|
inline void RotatePoint( VECTOR2I& aPoint, const VECTOR2I& aCentre, const EDA_ANGLE& aAngle ) |
|
|
|
{ |
|
|
|
RotatePoint( &aPoint.x, &aPoint.y, aCentre.x, aCentre.y, aAngle ); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Return a new VECTOR2I that is the result of rotating aVector by aAngle. |
|
|
|
*/ |
|
|
|
inline VECTOR2I GetRotated( const VECTOR2I& aVector, const VECTOR2I& aCentre, |
|
|
|
const EDA_ANGLE& aAngle ) |
|
|
|
{ |
|
|
|
RotatePoint( &point.x, &point.y, centre.x, centre.y, aAngle ); |
|
|
|
VECTOR2I result = aVector; |
|
|
|
RotatePoint( &result.x, &result.y, aCentre.x, aCentre.y, aAngle ); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|