Sign in to follow this  
travis08

direction from angles

Recommended Posts

travis08    122
The should be a simple one. I've got a: a unit vector pointing -1 down Y and b: three xyz rotation angles. I want to rotate my initialized vector by the three angles, resulting in a new direction.

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Original post by travis08
The should be a simple one.

I've got a: a unit vector pointing -1 down Y
and b: three xyz rotation angles.

I want to rotate my initialized vector by the three angles, resulting in a new direction.
1. Build a rotation matrix from the Euler angles

2. Apply the rotation matrix to the vector (0, -1, 0)

Note that if the input vector is a cardinal basis vector (which it is in your case), you can simply extract the desired direction vector directly from the matrix.

Post back if you need more details.

Share this post


Link to post
Share on other sites
travis08    122
jyk, thanks for the reply.
Just so I'm clear: I am building a rot matrix from the angles, after which I am simply multiplying/transforming my initialized vector by the matrix?

I'm testing this and am getting something close to what I want, but not quite. Want to make sure I'm understanding correctly.

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Just so I'm clear: I am building a rot matrix from the angles, after which I am simply multiplying/transforming my initialized vector by the matrix?
That's correct.
Quote:
I'm testing this and am getting something close to what I want, but not quite. Want to make sure I'm understanding correctly.
Can you describe the problems you're seeing? In what way are the results incorrect?

There are a number of places that errors could be introduced (for example, missing or misplaced degree/radian conversions, using the wrong vector notation, discrepancies in Euler-angle order, etc.). If you really get stuck, you might post some code.

Share this post


Link to post
Share on other sites
travis08    122
Good point about the possible degree/radian issue. That sounds like what might be happening. I will play with this more tonight and post feedback, thanks.

Share this post


Link to post
Share on other sites
travis08    122
After a degree to radian conversion all is well. Thanks very much jyk, I really appreciate the help.


Quote:
Original post by jyk
Quote:
Just so I'm clear: I am building a rot matrix from the angles, after which I am simply multiplying/transforming my initialized vector by the matrix?
That's correct.
Quote:
I'm testing this and am getting something close to what I want, but not quite. Want to make sure I'm understanding correctly.
Can you describe the problems you're seeing? In what way are the results incorrect?

There are a number of places that errors could be introduced (for example, missing or misplaced degree/radian conversions, using the wrong vector notation, discrepancies in Euler-angle order, etc.). If you really get stuck, you might post some code.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this