Trying to rotate a point

This commit is contained in:
neauoire 2020-05-12 13:30:12 +09:00
parent 8c301f7d10
commit f74923d9ff

View File

@ -33,9 +33,10 @@ program ExampleRotate;
procedure RotatePoint2D (var target, origin: Point2D; angle: Fixed);
var
radians, cos, sin, x, y, r: Fixed;
radians, cos, sin, x, y, r, pi: Fixed;
begin
radians := FixRatio(angle, 314);
pi := FixRatio(22, 7);
radians := FixMul(angle, FixDiv(pi, 180));
r := Distance2D(target, origin);
target.x := origin.x + FixMul(r, FracCos(radians));
target.y := origin.y + FixMul(r, FracSin(radians));