Advertisement

Math Question

Started by May 29, 2001 06:48 PM
11 comments, last by Nazrix 23 years, 8 months ago
I'm using vectors in 3D and am wondering something: Since x=cos(angle) lets say you know x but want to know the angle. How would you do that? Can you do angle=acos(x)? or some other way to solve for the angle Or perhaps I'd have to normalize the vector that the x value is part of then do angle=acos(x)?
A CRPG in development... Need help? Well, go FAQ yourself. Edited by - Nazrix on May 29, 2001 7:59:06 PM
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi

X doesn''t equal the cosine of the angle in a vector unless it is normalized. Then you simply take the arccosine of the value, and you have the angle in radians.

However, if you wish to find the angle between a plane and a vector, you need to take the arccosine of the dot product of the planes normal and the vector.

Advertisement

X doesn''t equal the cosine of the angle in a vector unless it is normalized. Then you simply take the arccosine of the value, and you have the angle in radians.

However, if you wish to find the angle between a plane and a vector, you need to take the arccosine of the dot product of the planes normal and the vector.

quote:
Original post by Anonymous Poster


X doesn''t equal the cosine of the angle in a vector unless it is normalized. Then you simply take the arccosine of the value, and you have the angle in radians.

However, if you wish to find the angle between a plane and a vector, you need to take the arccosine of the dot product of the planes normal and the vector.




Okay. I got it thanks.




A CRPG in development...

Need help? Well, go FAQ yourself.
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
quote:
Original post by Anonymous Poster


However, if you wish to find the angle between a plane and a vector, you need to take the arccosine of the dot product of the planes normal and the vector.




Would I have to normalize the vector in that case as well? I suppose I would but I might as well ask.




A CRPG in development...

Need help? Well, go FAQ yourself.
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Nazrix, I suspect you may want some functionality for a camera. If so, track me down one way or another and I''ll give you same very solid camera functions.

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
Advertisement
And vector functions, for that matter...



_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
Here, this may help:

Angle between two vectors:

Angle = cos-1(a.b/|a||b| )




If at first you don't succeed, redefine success.
quote:
Original post by python_regious

Here, this may help:

Angle between two vectors:

Angle = cos-1(a .b /|a ||b | )



Yeah I read about that one. Only problem is when the camera is not at 0,0,0. I think I am going to figure out how to use Nebula''s lookat() function. I just wanted to learn how to do it manually.





A CRPG in development...

Need help? Well, go FAQ yourself.
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Nazrix, let''s say you want a camera at some point in space and looking at some other point in space. Then, in the code I sent you, you define a camera with a position at the location point and compute a matrix which aligns the ''look'' vector with the vector defined by the ''location'' point to the ''look at'' point, and then apply the matrix to the orthogonalized vectors of the camera structure, which include 3 vectors defining the camera.

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.

This topic is closed to new replies.

Advertisement