- Jan 15, 2013
- 12,182
- 35
- 91
Let's say I have a vector at a location (4,3,5) in space and I have an object at (0,0,0). How many degrees x and y would I need to rotate the object to make it face the vector?
I want to rotate the object to face the location.
Do your own homework!
What they means is a point is just a point. 1 dimension, there is no face.
Use x and y to get one angle using trigonometry. Use x and z to get the other angle. That's all you need.
I want the thing at (0,0,0) to face the point. The point is just there.
That's a different question than asked in the OP. It now sounds like you are asking for the angles relative to the x,y, and z axes in a Cartesian coordinate system of a line originating at (0,0,0) and ending at (4,3,5). In that case, Arcadio's post.
using trigonometry
If the object is already facing "up" - towards, say, (0,0,5) then you would rotate it tan(-1)(3/4) on the z axis (to face the 4,3,5 point on the x/y plane) and 90-tan(-1)(5/((3^2)(4^2))^0.5) on a different axis to point it "down" towards the point.
If the object is already facing "up" - towards, say, (0,0,5) then you would rotate it tan(-1)(3/4) on the z axis (to face the 4,3,5 point on the x/y plane) and 90-tan(-1)(5/((3^2)(4^2))^0.5) on a different axis to point it "down" towards the point.
I think. I probably have something inverted or backwards there.
That was my first thought. http://forums.anandtech.com/showpost.php?p=37961645&postcount=9
Is it doable with a single rotation?
Not in a 3-dimensional space. Arcadio's comment about altitude and azimuth is on the money.
In most 3D modelling programs, the rotation on two axes would be a single transform operation (enter both numbers).
Try swapping around the X/Y/Z values in your math, or rotating by the complement of the angle instead, just to see if you can luck your way into it.
Bruh, if you know of a textbook that contains this information then show me the PDF.
Instead of rotating along blue and then red in two steps, what formula would I need to just rotate along green in one step?
you would use the pythagorean theorem to figure out the length of the yellow line segment (0,0,0),(4,3,5), and then use trig functions to determine the green angle compared to the grey line segment (which looks like it's (0,0,0),(0,3,0) or something. Dunno because the axes aren't labelled.)
But the plane defined by the yellow and grey bars intersects the x/y plane at an angle that you'd also have to determine. So you'd still need two angles.
Angles are two-dimensional in nature - you need two of them to describe three-dimensional movement.
helps if you use the correct terminology.
assuming this is for some sort of 3d application:
all objects are stand-ins for transformation matrix, so in order to point something you need to know/define the aim vector and an up vector. (typically either the x-axis or sometimes the z-axis)
in a Cartesian coordinate system all rotational transforms will be standard vector rotates in a predefined order(x 1st, y 2nd, z 3rd) or any arbtrary sequence(zyx,yxz,xzy,etc). so as everyone has indicated standard vector math or pythagorean with trig will give you your rotations.
However what the OP seems to be referring to is a Euler transform. euler coordinates are used to avoid gimbal lock in IK solutions by calculating rotations outside the normal rotation predefined order in a simultaneous calculation. main problem is that the OP is confusing a polar system rotation with a cartesian system. Euler transforms are way beyond my college maths or 3d animation schooling, so i wont even bother pretending to explain.
helps if you use the correct terminology.