HP Forums

Full Version: (50g) Coordinate Rotation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
Reference URL's