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

Ask A Question

Stats

  • Questions 334k
  • Answers 334k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you mentioned "entire line" , so i assumed mystring is… May 14, 2026 at 3:27 am
  • Editorial Team
    Editorial Team added an answer Django. Because it takes care for all bits and pieces… May 14, 2026 at 3:27 am
  • Editorial Team
    Editorial Team added an answer If I understand your question, the most likely cause is… May 14, 2026 at 3:27 am

Related Questions

I have to build a web application in a couple of weeks in your
I have created a couple of different structures in a program. I now have
I'm writing a merge sort function, and right now I am just using a
is it possible to get the mouse direction (Left, Right, Up, Down) based on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.