problems understanding vector classes

Started by
3 comments, last by Erik23a86 20 years, 3 months ago
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.
Advertisement
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]
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
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.
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)
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.

This topic is closed to new replies.

Advertisement