Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
Have you heard of polar coordinates? –  Jebruho Dec 26 '12 at 1:09
    
Yeah I've heard of them. I intend to relearn the math for this because of the new avenues being opened up for web developers. But right now I'm just hoping for a magic formula that accepts x, y, z and spits out an angle. –  user875234 Dec 26 '12 at 1:15
    
Note that rotation in 3D is not commutative. That is, rotating about $x$ then $y$ then $z$ is not the same as say rotating about $z$ then $y$ then $x$, or rotating in any other order. (This is why CSS transforms don't allow you to directly specify angles for $x$, $y$ and $z$ in a single rotate3d command; that would be meaningless.) What you are asking for is ambiguous unless you specify the order in which these rotations are performed. –  Rahul Dec 26 '12 at 4:15

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.