HP Forums
(50g) Coordinate Rotation - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (50g) Coordinate Rotation (/thread-3161.html)



(50g) Coordinate Rotation - Eddie W. Shore - 02-21-2015 02:48 PM

CRDTRN calculates the rotation of a single point (x0, y0) given center (xc, yc) and angle θ. Good for a subroutine.

Code:
<< → XOLD YOLD XCTR YCTR θ
<< XOLD YOLD R→C XCTR YCTR R→C – θ DUP COS →NUM SWAP NEG SIN →NUM R→C * >> >>

Input:
5: x0
4: y0
3: xc
2: yc
1: θ

Example:
Original Point: (10, 10) with new center (1,1) and rotation angle 0.5 radian

Result: (12.2130729044, 3.58341320957)