Changeset 13 for trunk/UGeometric.pas
- Timestamp:
- Mar 27, 2015, 12:49:17 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGeometric.pas
r4 r13 8 8 Classes, SysUtils, Math; 9 9 10 type 11 TPointArray = array of TPoint; 12 10 13 function Distance(P1, P2: TPoint): Integer; 11 14 function Dot(const P1, P2: TPoint): Double; … … 13 16 function PointToLineDistance(const P, V, W: TPoint): Integer; 14 17 function ComparePoint(P1, P2: TPoint): Boolean; 18 function RotatePoint(Center, P: TPoint; Angle: Double): TPoint; 19 function RotatePoints(Center: TPoint; P: TPointArray; Angle: Double): TPointArray; 15 20 16 21 implementation … … 67 72 end; 68 73 74 function RotatePoint(Center, P: TPoint; Angle: Double): TPoint; 75 begin 76 P := Point(P.X - Center.X, P.Y - Center.Y); 77 Result := Point(Center.X + Round(P.X * Cos(Angle) - P.Y * Sin(Angle)), 78 Center.Y + Round(P.X * Sin(Angle) + P.Y * Cos(Angle))); 79 end; 80 81 function RotatePoints(Center: TPoint; P: TPointArray; Angle: Double): TPointArray; 82 var 83 I: Integer; 84 begin 85 SetLength(Result, Length(P)); 86 for I := 0 to High(P) do 87 Result[I] := RotatePoint(Center, P[I], Angle); 88 end; 89 69 90 70 91 end.
Note:
See TracChangeset
for help on using the changeset viewer.