PDA

View Full Version : Some queries about vector - angle between each other

sajis997
08-12-2015, 03:08 AM
Hello forum,

Lets say we have the two vectors a and b.

if their dot product a.b > 0 , it implies that the angle between them is acute and pointing mostly in the same direction.
if a.b == 0. The vectors are perpendicular to each other..
If a.b < 0, the vectors are pointing mostly in the opposite direction.

What if we have the three vector x, y and z. And we have the following condition

if(std::abs(x.dot(y)) < std::abs(x.dot(z)))
{

}

I am trying to visualize the above snippet. Some help would be helpful.

Lets get even more specific . If both x.dot(y) > 0 and x.dot(z) > 0 , but x.dot(y) < x.dot(z), then what can we imply ?

Thanks

mbentrup
08-12-2015, 04:35 AM
The dot product of two vectors is the cosine of the angle between the vectors multiplied by the lengths of each vector. If the vector lengths are arbitrary, you cannot imply anything about the angles, but if you know that the vectors are unit-vectors, the lengths are irrelevant, and you can deduce that a larger dot product implies a smaller (more acute) angle, because the cosinus is a monotonic decreasing function in the relevant range.

GClements
08-12-2015, 06:51 AM
Lets get even more specific . If both x.dot(y) > 0 and x.dot(z) > 0 , but x.dot(y) < x.dot(z), then what can we imply ?

The first two conditions indicate that both y and z are in the hemisphere whose "pole" is x. The third indicates that the component of y in the direction of x is less than the component of z in the direction of x. You can't say anything about the angles unless y and z are known to have the same magnitude, in which case the angle between y and x is greater than the angle between z and x.

nickels
08-21-2015, 10:59 AM
As GClements points out, conditions 1 and 2 say that all three vectors are in the same half plane defined by the normal to the plane, x. The last only says that the projection of y along x is farther than that of z.
Now were y and z normalized vectors, it would imply that the angle between x and z is less than that of x and y since x.y = |x| cos t_xy < x.z = |x| cos t_xz => cos t_xy < cos t_xz and cos is an increasing function between 0 and 90, so t_xy < t_xz.