Vector Classes
185
The classes contain the following methods:
csBool equal(const csVec4f& v) const;
csBool almostEqual(const csVec4f& v, float tol) const;
void negate(const csVec4f& v);
float dot(const csVec4f& v) const;
void add(const csVec4f& v1, const csVec4f& v2);
void sub(const csVec4f& v1, const csVec4f& v2);
void scale(float s, const csVec4f& v);
void addScaled(const csVec4f& v1, float s, const csVec4f& v2);
void combine(float a, const csVec4f& v1, float b, const,
csVec4f& v2);
float sqrDistance(const csVec4f& v) const;
float normalize();
float length() const;
float distance(const csVec4f& v) const;
void xformPt(const csVec4f& v, const csMatrix4f& m);
void xformVec(const csVec4f& v, const csMatrix4f& m);
The methods have the following functionality:
• almostEqual()—returns TRUE if the values are within tol of each other.
• negate()—negates the vector, which, in effect, reverses its direction.
• scale()—enlarges or reduces a vector by the multiplier passed in.
• addScaled()—adds to a vector the scaled vector passed in.
• combine()—performs the vector addition of two vectors.
• sqrDistance()—provides the distance squared.
• normalize()—makes the vector orthogonal to its original direction.
• distance()—determines the distance between two vectors.
• xformPt()—transforms the point by the matrix passed in.
• xformVec()—transforms the vector by the matrix passed in.