Results 1 to 4 of 4

Thread: OpenGL Maths - Angle between 2 Vectors

  1. #1
    Guest

    OpenGL Maths - Angle between 2 Vectors

    Hi,
    I want the camera to have a 360 degree view, if i take a constant facing north and then a second value of where the player is looking, calculating the angle between the two for moving in the correct direction.
    I am using gluLookAt, that is why i need to do it this way, i would be most grateful for any help. Thanks

    Paul

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: OpenGL Maths - Angle between 2 Vectors

    Are you asking for the formula for the angle between two vectors?

    gav

  3. #3

    Re: OpenGL Maths - Angle between 2 Vectors

    Since v1 dot v2 = |v1|*|v2|cos(theta)

    you can solve for theta with

    theta = acos((v1 dot v2)/(|v1|*|v2|))

    P.S. |v| is the magnitude of a vector and dot refers to the dot product.

  4. #4
    Guest

    Re: OpenGL Maths - Angle between 2 Vectors

    Hi,
    Thanks, it was the formula for calculating the angle between two vectors that i was looking for. Thnaks again.

    Paul

Similar Threads

  1. Angle between two vectors issue
    By Kealor1458 in forum OpenGL: Basic Coding
    Replies: 10
    Last Post: 12-10-2017, 09:21 AM
  2. OpenGL Maths!
    By pran1 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-30-2004, 08:30 PM
  3. Angle between two vectors [0..2PI]
    By Erakis in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-15-2002, 10:38 AM
  4. MATHS: Converting a normal and angle to orthonormal basis
    By cix>foo in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 02-03-2002, 06:35 PM
  5. Angle between two vectors
    By KurtCob in forum OpenGL: Advanced Coding
    Replies: 27
    Last Post: 09-04-2000, 03:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean