common: VECTOR2I-based RotatePoint()

This commit is contained in:
Tomasz Włostowski 2017-10-19 23:15:13 +02:00
parent d2c9a5d81a
commit dc7b743782
2 changed files with 19 additions and 0 deletions

View File

@ -380,6 +380,17 @@ void RotatePoint( wxPoint* point, const wxPoint& centre, double angle )
point->y = oy + centre.y;
}
void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, double angle )
{
wxPoint c( centre.x, centre.y );
wxPoint p( point.x, point.y );
RotatePoint(&p, c, angle);
point.x = p.x;
point.y = p.y;
}
void RotatePoint( double* pX, double* pY, double cx, double cy, double angle )
{

View File

@ -30,6 +30,7 @@
#include <math.h>
#include <wx/gdicmn.h> // For wxPoint
#include <math/vector2d.h>
/**
* Function IsPointOnSegment
@ -78,6 +79,13 @@ inline void RotatePoint( wxPoint* point, double angle )
RotatePoint( &point->x, &point->y, angle );
}
inline void RotatePoint( VECTOR2I& point, double angle )
{
RotatePoint( &point.x, &point.y, angle );
}
void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, double angle );
/*
* Calculates the new coord point point
* for a center rotation center and angle in (1 / 10 degree)