Hello!
What would you think of adding vector rotation?
I have just made this for myself:
type
TVector2D_ = record helper for TVector2D
function Rotate(const Angle: Double): TVector2D;
end;
function TVector2D_.Rotate(const Angle: Double): TVector2D;
var CosA, SinA, X_, Y_: Double;
begin
SinCos(Angle, SinA, CosA);
X_ := X;
Y_ := Y;
Result.X := X_ * CosA - Y_ * SinA;
Result.Y := X_ * SinA + Y_ * CosA;
end;
I attach my full program (using AGGPas).
vector-rotation.zip
(By the way, the beginner guide is a very good idea!)
Proposed API
function TVector2D.Rotate(const Angle: Double): TVector2D;
Hello!
What would you think of adding vector rotation?
I have just made this for myself:
I attach my full program (using AGGPas).
vector-rotation.zip
(By the way, the beginner guide is a very good idea!)
Proposed API