#### Archived

This topic is now archived and is closed to further replies.

# Smallest angle between 2 vectors

This topic is 6057 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

OK i hate myself for not being able to figure this out, but i cant anyway the smallest angle between 2 vectors v and u is: theta = cos-1(v dot u / |v||u|); fine so what''s wrong with my math in the following example. (i''m just trying to prove that i can use this equation before i put it in my game engine): 2 vectors: 1,1,1 1,1,-1 those should be orthagonal, right? anyway calculating theta from the above equation gives: theta = cos-1(1 + 1 - 1 / (sqrt(3) * sqrt(3)) ) theta = cos-1(1/3) which clearly isn''t 90 degrees. it''s something like 70.4 what did i do wrong? are 1,1,1 and 1,1,-1 not orthagonal or am i retarded and did something wrong in my calculation? -me

##### Share on other sites
Aren''t the two vectors you mentioned anti-parallel, 180 degrees from each other? Orthogonal means they are at right angles to each other, so it would be like:
v: (1,0,0)
u: (0,1,0)
But uh I''m not sure about the smallest angle thing.... actually, I''m not sure what you mean by the "smallest angle", but the equation you gave SHOULD give the angle between the two vectors...
so using the vectors I gave:

v dot u = 0
|v| = 1
|u| =1
cos-1(0/1) = cos-1(0) = 90, thus they are orthogonal...

##### Share on other sites
no 1,1,1 and 1,1,-1 should be only 90 degrees seperated. -1,-1,-1 and 1,1,1 are 180degrees seperated.

-me

[edited by - Palidine on April 19, 2002 2:40:48 PM]

##### Share on other sites
Whoops, actually I lied, the two vectors you gave are NOT antiparallel, I don''t know what I was thinking, but anyway, they aren''t orthagonal anyway, but the two vectors I gave were....

##### Share on other sites
In order for two vectors to be orthogonal the dot product must be 0.

2 vectors:
1,1,1
1,1,-1

Dot product is: (1*1) + (1*1) + (1*-1) = 1

So your calculation for the angle is probably correct.

##### Share on other sites
yeah, i figured that. my brain''s 3D visualization system is messed up i guess. it baffles me why 1,1,1 and 1,1,-1 aren''t orthagonal.

i mean 1,1,1 goes straight out through the "center" of the 1st quadrant of 3-space. 1,1,-1 goes through the "center" of the some other numbered quadrant. in my head it looks exactly like the coordinate axes rotated 45 degrees.

whatever. i trust the equation

-me

##### Share on other sites
1, 1, 1 and
-1, -1, -1 are 180 degrees apart. the only time they''re 180 apart is when it''s

x, y, z and -x, -y, -z

why don''t you try, for 90 degrees apart, somthing like

0,0,1
0,1,0

##### Share on other sites
Paladine, your visualisation problem arises because your looking in 3d where you're used to looking in 2d. In 2d, the vectors < 1,1 > and < 1,-1 > are orthoganl, but in 3d, when you go out to < 1,1,1 > you are actually going out a length of sqrt(2) in the xy plane and then up 1 unit in the z-axis (assuming your vector basis is aligned with the Cartesian axes). Hence, the angle made between the vector and the xy plane is NOT 45 degrees, as you might have thought by the vector < 1,1,1 > . The vectors < 1,1,SQRT(2) > and < 1,1,-SQRT(2) > are orthoganal and each makes an angle of 45 degrees with the xy plane!

Cheers,

Timkin

[edited by - Timkin on April 19, 2002 11:00:36 PM]

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 14
• 14
• 9
• ### Forum Statistics

• Total Topics
633370
• Total Posts
3011542
• ### Who's Online (See full list)

There are no registered users currently online

×