Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Some queries about vector - angle between each other

  1. #1
    Intern Contributor
    Join Date
    Feb 2013
    Posts
    75

    Some queries about vector - angle between each other

    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

    Code :
    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
    Last edited by sajis997; 08-12-2015 at 03:13 AM.

  2. #2
    Member Regular Contributor
    Join Date
    Dec 2009
    Posts
    251
    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.

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,526
    Quote Originally Posted by sajis997 View Post
    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.

  4. #4
    Member Regular Contributor nickels's Avatar
    Join Date
    Feb 2000
    Location
    Colorado
    Posts
    284
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •