problems understanding vector classes
I have a problem understanding the vector classes used for Collision detection. For example this vector class for the rayplaneCollision tutorial from www.gametutorials.com.
struct CVector3
{
public:
float x, y, z;
};
CVector3 Cross(CVector3 vVector1, CVector3 vVector2);
CVector3 Vector(CVector3 vPoint1, CVector3 vPoint2);
float Magnitude(CVector3 vNormal);
CVector3 Normalize(CVector3 vNormal);
CVector3 Normal(CVector3 vTriangle[]);
I know wat verctors are. A vector has got a magnitude and a direction. The thing I don''t understand is why there is no direction in the vector class. There are only co-odinate
of one point. Please help me understand.
Thanks.
The One.
x,y,z is the direction, i.e., a ray originating from [0,0,0] to [x,y,z].
sqrt(x*x+y*y+z*z) is the magnitude, i.e., the distance from [0,0,0].
[edited by - smart_idiot on January 6, 2004 6:07:04 AM]
sqrt(x*x+y*y+z*z) is the magnitude, i.e., the distance from [0,0,0].
[edited by - smart_idiot on January 6, 2004 6:07:04 AM]
So, there are extualy two points, a static point with the co-ordinates 0,0,0 and a variable point with the x,y,z from the vector class. I understand it now . I knew there must be two point in order to get the direction of the vector, but I was not certain that the second point was 0,0,0.
Is this methode used in most of the vector classes?
Thanks.
The One.
Is this methode used in most of the vector classes?
Thanks.
The One.
Well, actually you don''t need a second point at all, that is the nice thing with vectors, they are independent of the origin. Perhaps someone has a nice tutorial concerning vectors for you.
3D Vectors
Visualizing Vector Addition
Math and Physics articles
(all of these are here at GameDev.Net)
Visualizing Vector Addition
Math and Physics articles
(all of these are here at GameDev.Net)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement