Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 02:19:04 am
Xith3D CommunityGeneral CategoryGeneral Discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)A math question
Pages: [1]
Print
Author Topic: A math question  (Read 822 times)
BrazilianBoy
Becoming dependent
**
Offline Offline

Posts: 208


l_p_camargo@hotmail.com
View Profile Email
« on: 30. November 2007, 11:36:14 pm »

How can I discover the Y rotation of a vector lying on the Y plane, having another vector lying on the Y plane as an origin?

Lucas.
Logged

Getting my hands dirty Smiley
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 01. December 2007, 12:23:15 am »

If you simply want the angle between these two vectors, you can simply use the vec1.angle( vec2 ) method. But you have to handle the fact, that this angle is constrained to [0, PI]. So you have to use some other information to convert this angle from [0, PI] to [0, 2PI]. this could work like this:

Let's say the original vector is always Vector3f.POSITIVE_X_AXIS. Then you can do it like this:
Code:
Vector3f v = [your vector with y = 0];
float angle = v.angle( Vector3f.POSITIVE_X_AXIS );
if ( v.z > 0f )
    angle = FastMath.TWO_PI - angle;

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic