Is there a formula to know the angle of an object, on a Cartesian plane, when it is rotated by arbitrary x, y, z degrees?

184 Views Asked by At

Example: If I have a line rotated (at its center) by -45 degress on the x, y, and z axis what formula would I used to determine what angle that object is at if you put it back on a cartesian plane?

The higher level version is css transforms. Rotating is made easy but to handle mouse drag events I need to know what direction (on a cartesian plane) the object is pointing.

1

There are 1 best solutions below

0
On

I would just use three-dimensional rotation matrices acting on a 3-d vector (where you start of assuming z=0), followed by dropping the z-coordinate. They should be easy to code (if they're not already pre-packaged) and would give you more flexibility. That's what the programmers would do when I worked on video games back in the day.