Class Vector3
Defined in File Vector3.hpp
Inheritance Relationships
Derived Type
public tf2::tf2Vector4(Class tf2Vector4)
Class Documentation
-
class Vector3
tf2::Vector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-byte alignment when tf2::Vector3 is stored in containers. This extra component can be used by derived classes (Quaternion?) or by user Ideally, this class should be replaced by a platform optimized TF2SIMD version that keeps the data in registers
Subclassed by tf2::tf2Vector4
Public Functions
-
inline Vector3()
No initialization constructor.
-
inline Vector3(const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z)
Constructor from scalars.
- Parameters:
x – X value
y – Y value
z – Z value
-
inline Vector3 &operator+=(const Vector3 &v)
Add a vector to this one.
- Parameters:
v – The vector to add to this one
-
inline Vector3 &operator-=(const Vector3 &v)
Subtract a vector from this one.
- Parameters:
v – The vector to subtract
-
inline Vector3 &operator/=(const tf2Scalar &s)
Inversely scale the vector.
- Parameters:
s – Scale factor to divide by
-
inline tf2Scalar dot(const Vector3 &v) const
Return the dot product.
- Parameters:
v – The other vector in the dot product
-
tf2Scalar distance2(const Vector3 &v) const
Return the distance squared between the ends of this and another vector This is semantically treating the vector like a point.
-
tf2Scalar distance(const Vector3 &v) const
Return the distance between the ends of this and another vector This is semantically treating the vector like a point.
-
Vector3 rotate(const Vector3 &wAxis, const tf2Scalar angle) const
Rotate this vector.
- Parameters:
wAxis – The axis to rotate about
angle – The angle to rotate by
-
inline tf2Scalar angle(const Vector3 &v) const
Return the angle between this and another vector.
- Parameters:
v – The other vector
-
inline Vector3 cross(const Vector3 &v) const
Return the cross product between this and another vector.
- Parameters:
v – The other vector
-
inline int minAxis() const
Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z.
-
inline int maxAxis() const
Return the axis with the largest value Note return values are 0,1,2 for x, y, or z.
-
inline int furthestAxis() const
-
inline int closestAxis() const
-
inline Vector3 lerp(const Vector3 &v, const tf2Scalar &t) const
Return the linear interpolation between this and another vector.
- Parameters:
v – The other vector
t – The ration of this to v (t = 0 => return this, t=1 => return other)
-
inline Vector3 &operator*=(const Vector3 &v)
Elementwise multiply this vector by the other.
- Parameters:
v – The other vector
-
inline operator tf2Scalar*()
operator tf2Scalar*() replaces operator[], using implicit conversion. We added operator != and operator == to avoid pointer comparisons.
-
inline void setMax(const Vector3 &other)
Set each element to the max of the current values and the values of another Vector3.
- Parameters:
other – The other Vector3 to compare with
-
inline void setMin(const Vector3 &other)
Set each element to the min of the current values and the values of another Vector3.
- Parameters:
other – The other Vector3 to compare with
-
inline void setZero()
-
inline bool isZero() const
-
inline bool fuzzyZero() const
-
inline bool isnan() const
-
void serialize(struct Vector3Data &dataOut) const
-
void deSerialize(const struct Vector3Data &dataIn)
-
void serializeFloat(struct Vector3FloatData &dataOut) const
-
void deSerializeFloat(const struct Vector3FloatData &dataIn)
-
void serializeDouble(struct Vector3DoubleData &dataOut) const
-
void deSerializeDouble(const struct Vector3DoubleData &dataIn)
-
inline Vector3()