Here are some functions that may come handy:
//------------------------------------------------------------------------------------------------
// Rotate array of points by some angle (in radians)
//------------------------------------------------------------------------------------------------
void __fastcall rotatePoints(TPoint *points, int points_number, TPoint *origin, double angle)
{
int ox, oy, x1, y1;
ox = origin->x;
oy = origin->y;
for (int i = 0; i < points_number; i++)
{
x1 = points[i].x;
y1 = points[i].y;
points[i].x = fast_ftol(ox + (x1 - ox)*cos(angle) - (y1 - oy)*sin(angle));
points[i].y = fast_ftol(oy + (x1 - ox)*sin(angle) + (y1 - oy)*cos(angle));
}
//NOTE: replace fast_ftol function with rounding function at your choice.
}
//------------------------------------------------------------------------------------------------
// Translate array of points given some radius vector (x,y)
//------------------------------------------------------------------------------------------------
void __fastcall translatePoints(TPoint *points, int points_number, TPoint *trans)
{
for (int i = 0; i < points_number; i++)
{
points[i].x += trans->x;
points[i].y += trans->y;
}
}
//---------------------------------------------------------------------------
// Reflect array of points around arbitrarty line (given origin and angle)
//---------------------------------------------------------------------------
void __fastcall reflectPoints(TPoint *points, int points_number, TPoint *origin, double angle)
{
int ox, oy, x1, y1;
ox = origin->x;
oy = origin->y;
for (int i = 0; i < points_number; i++)
{
x1 = points[i].x;
y1 = points[i].y;
points[i].x = fast_ftol(ox + (x1 - ox)*cos(2.0*angle) + (y1 - oy)*sin(2.0*angle));
points[i].y = fast_ftol(oy + (x1 - ox)*sin(2.0*angle) - (y1 - oy)*cos(2.0*angle));
}
//NOTE: replace fast_ftol function with rounding function at your choice.
}