Difference between revisions of "ToPolar"
From SCAR Divi Manual
(Created page with "==Definition== <source lang="scar" lines="false"> function ToPolar(const Point: TPoint): PPoint; </source> ===Source Code=== <source lang="scar"> function ToPolar(const Point: T...") |
(No difference)
|
Revision as of 13:03, 3 July 2011
Definition
function ToPolar(const Point: TPoint): PPoint;
Source Code
function ToPolar(const Point: TPoint): PPoint; begin Result.R := Sqrt(Point.X * Point.X + Point.Y * Point.Y); Result.T := ArcTan2(Point.Y, Point.X); Result.T := RadToDeg(Result.T); end;
Availability
SCAR Divi 3.00 > Current
Description
Converts a given cartesian coordinate defined by the TPoint Point to a polar coordinate defined by a PPoint.
Example
var p: PPoint; begin p := ToPolar(Point(3, 4)); WriteLn('PPoint(' + FloatToStr(p.R) + ';' + FloatToStr(p.T) + ')'); end.
Output:
PPoint(5;53,130102354156)