...Rotate a 2D Point?

Author: Arash Partow
Homepage: http://www.partow.net

Category: Math

const
  
PIDiv180 = 0.017453292519943295769236907684886;

procedure Rotate(RotAng: Double; x, y: Double; var Nx, Ny: Double);
var
  
SinVal: Double;
  CosVal: Double;
begin
  
RotAng := RotAng * PIDiv180;
  SinVal := Sin(RotAng);
  CosVal := Cos(RotAng);
  Nx := x * CosVal - y * SinVal;
  Ny := y * CosVal + x * SinVal;
end;
(* End Of Rotate Cartesian Point*)

 

printed from
www.swissdelphicenter.ch
developers knowledge base