Public Group

#### Archived

This topic is now archived and is closed to further replies.

# problems understanding vector classes

This topic is 5308 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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.

##### Share on other sites
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]

##### Share on other sites
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.

##### Share on other sites
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.

1. 1
Rutin
25
2. 2
3. 3
JoeJ
19
4. 4
5. 5

• 10
• 11
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
631753
• Total Posts
3002097
×