I'm trying to rotate a rectangle by rotating its points , using this code
var
dx,dy:real;
rotp:Tpoint;
begin
dx := (CenterPoint.Y * Sin(angle)) - (CenterPoint.X * Cos(angle)) + CenterPoint.X;
dy := -(CenterPoint.X * Sin(angle)) - (CenterPoint.Y * Cos(angle)) + CenterPoint.Y;
rotP.X := round((point.X * Cos(angle)) - (point.Y * Sin(angle)) + dx);
rotP.Y := round((point.X * Sin(angle)) + (point.Y * Cos(angle)) + dy);
result:= rotP;
end;
but the round function makes the rectangle distorted , has anyone any idea how to overcome this?
I attached the image, the white points are the points i rotate about the center point, i'm sure that the image is rotated well thus, the white points should be identical to the corners of the image.