Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 378697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:49:11+00:00 2026-05-12T14:49:11+00:00

I have 3 Vectors, Up Right and Front that represent a direction. I need

  • 0

I have 3 Vectors, Up Right and Front that represent a direction.

I need to convert these into an XYZ angle (3 floats) so i can use with glRotatef()

Please help

[EDIT]

Its not rendering properly. can you see if its anything blatant here: pastebin.com/f6683492d

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:49:11+00:00Added an answer on May 12, 2026 at 2:49 pm

    I assume you mean “up, right and forward” because down is the opposite of up and doesn’t relly contribute any new information.
    Your question isn’t very clear but I think you mean that you want to create a transformation to the new coordinate base which is defined by the vectors you describe. If these vectors are orthogonal (have 90 degrees between them) then you don’t need to go through all the bother of calculating angles and using glRotate(). Instead you can use the vectors of the new base directly as the transformation.

    Say the vectors you have are A(a1,a2,a3) – up, B(b1,b2,b3) – right and C(c1,c2,c3) – forward.
    First, If the are not completely orthogonal you need to make sure that they become orthogonal, possibly with a few cross products. secondly, you need to make sure their length is 1. Now create the following matrix:

    a1 b1 c1 0
    a2 b2 c2 0
    a3 b3 c3 0
    0  0  0  1
    

    This is the rotation matrix which will bring you from the unit base to the base defined by A,B,C
    With this matrix all you need to do is to use glMultMatrix() and you’re done.
    If the first try doesn’t work, transposing the matrix would probably fix it.


    EDIT After checking again, the right order of the matrix should be like so:
    for vector A(ax,ay,az), B(bx,by,bz), C(cx,cy,cz)

    ax ay az 0
    bx by bz 0
    cx cy cz 0
    0  0  0  1
    

    This is the transpose of the above answer.
    Also, I recommend that you first try to see if it works without translation.
    And then you can add translation by simply adding it to the matrix like so:

    ax     ay     az     0
    bx     by     bz     0
    cx     cy     cz     0
    pos.x  pos.y  pos.z  1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a vector of vectors that looks something like this 3 1 2 0
I got some vectors containing unsigned chars that represent pixels from a frame. I
I have an assignment to merge two sorted vectors into a third sorted vector.
I have two vectors as Python lists and an angle. E.g.: v = [3,
I have two vectors of floats and i want them to become one vector
I have a box made out of two three-dimensional vectors. One for the front-lower-left
I have a list of vectors (in Python) that I want to normalize, while
What I have: Vectors of different custom structs(one custom struct per vector) I used
I have three vectors in an xts R object. Call them V1, V2, V3.
I have a vectors of strings, say c(E^A,S^P,lambda,T,E^Q,E^Q,AT) , and I want to plot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.