How do you make a point face a vector?

Rakehellion

Lifer
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?
 

IronWing

No Lifer
Jul 20, 2001
69,524
27,825
136
It depends.

To elaborate: A point is non-dimensional and can't "face" any particular direction. So, you need to tell us the shape of the object at 0,0,0. A vector has direction and magnitude. We would need to know the direction your direction is in (orientation) and the magnitude. We also need to know what you mean by "face". Do you want the object to face the origin of the vector, the termination of the vector, the midpoint?
 
Last edited:

nace186

Platinum Member
Sep 16, 2006
2,359
0
76
Do your own homework!

What they means is a point is just a point. 1 dimension, there is no face.
 

Arcadio

Diamond Member
Jun 5, 2007
5,637
24
81
Use x and y to get one angle using trigonometry. Use x and z to get the other angle. That's all you need.
 

Rakehellion

Lifer
Jan 15, 2013
12,182
35
91
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 rotate Y along atan2(X, Z) and then X by atan2(Z, Y). It looks fine if I do one or the other, but completely wrong if I do both. Is there some way to combine the rotations into one?
 

IronWing

No Lifer
Jul 20, 2001
69,524
27,825
136
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.
 
Feb 25, 2011
16,822
1,493
126
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.
 

Rakehellion

Lifer
Jan 15, 2013
12,182
35
91
Feb 25, 2011
16,822
1,493
126
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.
 

Rakehellion

Lifer
Jan 15, 2013
12,182
35
91
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.

Instead of rotating along blue and then red in two steps, what formula would I need to just rotate along green in one step?


 

wabbitslayer

Senior member
Dec 2, 2012
533
1
76
The same way you tear off a band-aid...

you've got to make the point realize that there really is no denying the vector, and that sooner or later it must be dealt with; obviously the sooner, the better.

Hope this helps your point do what it needs to do, there's probably going to need to be some talking and conversation afterwards to reflect on how things went. But everybody will feel better once it's done.
 

ioni

Senior member
Aug 3, 2009
619
11
81
Bruh, if you know of a textbook that contains this information then show me the PDF.

This is an extremely common question. Googling it would be the easiest way to get the answer. I've done it a bunch of times. Well, making a vector face a point is a common question anyway. Points don't face anything, so you wouldn't be able to do that no matter who you asked.
 
Feb 25, 2011
16,822
1,493
126
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.
 

Fenixgoon

Lifer
Jun 30, 2003
31,811
10,346
136
where is the object "facing"? the object isn't just a point - it's something at 0,0,0 that's pointing a certain direction.

in which case you are looking for the euler angles between two vectors. that will tell you the rotations about X, Y, Z axes to get from one vector to another. i have a book (not on hand) that describes how to get these.

if you're looking for a single angle, then using the dot product of two vectors will work. A dot B = |A||B|cos(theta) will give you the angle between the two vectors, but it doesn't tell you the rotations require to align said vectors.

edit: also, the position of the vectors do not matter (vector 1 starts at 0,0,0 while vector 2 starts at 4,3,5). what matters is the direction and length of those vectors. the distance between the starting points is a translation, not a rotation.
 
Last edited:

gorobei

Diamond Member
Jan 7, 2007
3,713
1,067
136
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.
 

Rakehellion

Lifer
Jan 15, 2013
12,182
35
91
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.

I'm pretty sure green is just the arccosine of the dot product. The length of yellow is irrelevant. That's just the vector.
 

Rakehellion

Lifer
Jan 15, 2013
12,182
35
91
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.

I am using a transformation matrix. Might it be easier to change the matrix directly?
 

Drako

Lifer
Jun 9, 2007
10,706
161
106
helps if you use the correct terminology.

Exactly. OP gives no context and seems completely clueless why people don't understand his question. Shocking

Props to the people helping this asshat out.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |