tf2 rolling
tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
tf2::Vector3 Class Reference

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 More...

#include <Vector3.hpp>

Inheritance diagram for tf2::Vector3:
Inheritance graph
[legend]

Public Member Functions

 Vector3 ()
 No initialization constructor.
 
 Vector3 (const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z)
 Constructor from scalars.
 
Vector3operator+= (const Vector3 &v)
 Add a vector to this one.
 
Vector3operator-= (const Vector3 &v)
 Subtract a vector from this one.
 
Vector3operator*= (const tf2Scalar &s)
 Scale the vector.
 
Vector3operator/= (const tf2Scalar &s)
 Inversely scale the vector.
 
tf2Scalar dot (const Vector3 &v) const
 Return the dot product.
 
tf2Scalar length2 () const
 Return the length of the vector squared.
 
tf2Scalar length () const
 Return the length of the vector.
 
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.
 
Vector3normalize ()
 Normalize this vector x^2 + y^2 + z^2 = 1.
 
Vector3 normalized () const
 Return a normalized version of this vector.
 
Vector3 rotate (const Vector3 &wAxis, const tf2Scalar angle) const
 Rotate this vector.
 
tf2Scalar angle (const Vector3 &v) const
 Return the angle between this and another vector.
 
Vector3 absolute () const
 Return a vector will the absolute values of each element.
 
Vector3 cross (const Vector3 &v) const
 Return the cross product between this and another vector.
 
tf2Scalar triple (const Vector3 &v1, const Vector3 &v2) const
 
int minAxis () const
 Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z.
 
int maxAxis () const
 Return the axis with the largest value Note return values are 0,1,2 for x, y, or z.
 
int furthestAxis () const
 
int closestAxis () const
 
void setInterpolate3 (const Vector3 &v0, const Vector3 &v1, tf2Scalar rt)
 
Vector3 lerp (const Vector3 &v, const tf2Scalar &t) const
 Return the linear interpolation between this and another vector.
 
Vector3operator*= (const Vector3 &v)
 Elementwise multiply this vector by the other.
 
const tf2ScalargetX () const
 Return the x value.
 
const tf2ScalargetY () const
 Return the y value.
 
const tf2ScalargetZ () const
 Return the z value.
 
void setX (tf2Scalar x)
 Set the x value.
 
void setY (tf2Scalar y)
 Set the y value.
 
void setZ (tf2Scalar z)
 Set the z value.
 
void setW (tf2Scalar w)
 Set the w value.
 
const tf2Scalarx () const
 Return the x value.
 
const tf2Scalary () const
 Return the y value.
 
const tf2Scalarz () const
 Return the z value.
 
const tf2Scalarw () const
 Return the w value.
 
 operator tf2Scalar * ()
 operator tf2Scalar*() replaces operator[], using implicit conversion. We added operator != and operator == to avoid pointer comparisons.
 
 operator const tf2Scalar * () const
 
bool operator== (const Vector3 &other) const
 
bool operator!= (const Vector3 &other) const
 
void setMax (const Vector3 &other)
 Set each element to the max of the current values and the values of another Vector3.
 
void setMin (const Vector3 &other)
 Set each element to the min of the current values and the values of another Vector3.
 
void setValue (const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z)
 
void getSkewSymmetricMatrix (Vector3 *v0, Vector3 *v1, Vector3 *v2) const
 
void setZero ()
 
bool isZero () const
 
bool fuzzyZero () const
 
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)
 

Public Attributes

tf2Scalar m_floats [4]
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Vector3() [1/2]

tf2::Vector3::Vector3 ( )
inline

No initialization constructor.

◆ Vector3() [2/2]

tf2::Vector3::Vector3 ( const tf2Scalar x,
const tf2Scalar y,
const tf2Scalar z 
)
inline

Constructor from scalars.

Parameters
xX value
yY value
zZ value

Member Function Documentation

◆ operator+=()

Vector3 & tf2::Vector3::operator+= ( const Vector3 v)
inline

Add a vector to this one.

Parameters
vThe vector to add to this one

◆ operator-=()

Vector3 & tf2::Vector3::operator-= ( const Vector3 v)
inline

Subtract a vector from this one.

Parameters
vThe vector to subtract

◆ operator*=() [1/2]

Vector3 & tf2::Vector3::operator*= ( const tf2Scalar s)
inline

Scale the vector.

Parameters
sScale factor

◆ operator/=()

Vector3 & tf2::Vector3::operator/= ( const tf2Scalar s)
inline

Inversely scale the vector.

Parameters
sScale factor to divide by

◆ dot()

tf2Scalar tf2::Vector3::dot ( const Vector3 v) const
inline

Return the dot product.

Parameters
vThe other vector in the dot product

◆ length2()

tf2Scalar tf2::Vector3::length2 ( ) const
inline

Return the length of the vector squared.

◆ length()

tf2Scalar tf2::Vector3::length ( ) const
inline

Return the length of the vector.

◆ distance2()

tf2Scalar tf2::Vector3::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.

◆ distance()

tf2Scalar tf2::Vector3::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.

◆ normalize()

Vector3 & tf2::Vector3::normalize ( )
inline

Normalize this vector x^2 + y^2 + z^2 = 1.

◆ normalized()

Vector3 tf2::Vector3::normalized ( ) const

Return a normalized version of this vector.

◆ rotate()

Vector3 tf2::Vector3::rotate ( const Vector3 wAxis,
const tf2Scalar  angle 
) const

Rotate this vector.

Parameters
wAxisThe axis to rotate about
angleThe angle to rotate by

◆ angle()

tf2Scalar tf2::Vector3::angle ( const Vector3 v) const
inline

Return the angle between this and another vector.

Parameters
vThe other vector

◆ absolute()

Vector3 tf2::Vector3::absolute ( ) const
inline

Return a vector will the absolute values of each element.

◆ cross()

Vector3 tf2::Vector3::cross ( const Vector3 v) const
inline

Return the cross product between this and another vector.

Parameters
vThe other vector

◆ triple()

tf2Scalar tf2::Vector3::triple ( const Vector3 v1,
const Vector3 v2 
) const
inline

◆ minAxis()

int tf2::Vector3::minAxis ( ) const
inline

Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z.

◆ maxAxis()

int tf2::Vector3::maxAxis ( ) const
inline

Return the axis with the largest value Note return values are 0,1,2 for x, y, or z.

◆ furthestAxis()

int tf2::Vector3::furthestAxis ( ) const
inline

◆ closestAxis()

int tf2::Vector3::closestAxis ( ) const
inline

◆ setInterpolate3()

void tf2::Vector3::setInterpolate3 ( const Vector3 v0,
const Vector3 v1,
tf2Scalar  rt 
)
inline

◆ lerp()

Vector3 tf2::Vector3::lerp ( const Vector3 v,
const tf2Scalar t 
) const
inline

Return the linear interpolation between this and another vector.

Parameters
vThe other vector
tThe ration of this to v (t = 0 => return this, t=1 => return other)

◆ operator*=() [2/2]

Vector3 & tf2::Vector3::operator*= ( const Vector3 v)
inline

Elementwise multiply this vector by the other.

Parameters
vThe other vector

◆ getX()

const tf2Scalar & tf2::Vector3::getX ( ) const
inline

Return the x value.

◆ getY()

const tf2Scalar & tf2::Vector3::getY ( ) const
inline

Return the y value.

◆ getZ()

const tf2Scalar & tf2::Vector3::getZ ( ) const
inline

Return the z value.

◆ setX()

void tf2::Vector3::setX ( tf2Scalar  x)
inline

Set the x value.

◆ setY()

void tf2::Vector3::setY ( tf2Scalar  y)
inline

Set the y value.

◆ setZ()

void tf2::Vector3::setZ ( tf2Scalar  z)
inline

Set the z value.

◆ setW()

void tf2::Vector3::setW ( tf2Scalar  w)
inline

Set the w value.

◆ x()

const tf2Scalar & tf2::Vector3::x ( ) const
inline

Return the x value.

◆ y()

const tf2Scalar & tf2::Vector3::y ( ) const
inline

Return the y value.

◆ z()

const tf2Scalar & tf2::Vector3::z ( ) const
inline

Return the z value.

◆ w()

const tf2Scalar & tf2::Vector3::w ( ) const
inline

Return the w value.

◆ operator tf2Scalar *()

tf2::Vector3::operator tf2Scalar * ( )
inline

operator tf2Scalar*() replaces operator[], using implicit conversion. We added operator != and operator == to avoid pointer comparisons.

◆ operator const tf2Scalar *()

tf2::Vector3::operator const tf2Scalar * ( ) const
inline

◆ operator==()

bool tf2::Vector3::operator== ( const Vector3 other) const
inline

◆ operator!=()

bool tf2::Vector3::operator!= ( const Vector3 other) const
inline

◆ setMax()

void tf2::Vector3::setMax ( const Vector3 other)
inline

Set each element to the max of the current values and the values of another Vector3.

Parameters
otherThe other Vector3 to compare with

◆ setMin()

void tf2::Vector3::setMin ( const Vector3 other)
inline

Set each element to the min of the current values and the values of another Vector3.

Parameters
otherThe other Vector3 to compare with

◆ setValue()

void tf2::Vector3::setValue ( const tf2Scalar x,
const tf2Scalar y,
const tf2Scalar z 
)
inline

◆ getSkewSymmetricMatrix()

void tf2::Vector3::getSkewSymmetricMatrix ( Vector3 v0,
Vector3 v1,
Vector3 v2 
) const
inline

◆ setZero()

void tf2::Vector3::setZero ( )
inline

◆ isZero()

bool tf2::Vector3::isZero ( ) const
inline

◆ fuzzyZero()

bool tf2::Vector3::fuzzyZero ( ) const
inline

◆ isnan()

bool tf2::Vector3::isnan ( ) const
inline

◆ serialize()

void tf2::Vector3::serialize ( struct Vector3Data dataOut) const

could also do a memcpy, check if it is worth it

◆ deSerialize()

void tf2::Vector3::deSerialize ( const struct Vector3Data dataIn)

◆ serializeFloat()

void tf2::Vector3::serializeFloat ( struct Vector3FloatData dataOut) const

could also do a memcpy, check if it is worth it

◆ deSerializeFloat()

void tf2::Vector3::deSerializeFloat ( const struct Vector3FloatData dataIn)

◆ serializeDouble()

void tf2::Vector3::serializeDouble ( struct Vector3DoubleData dataOut) const

could also do a memcpy, check if it is worth it

◆ deSerializeDouble()

void tf2::Vector3::deSerializeDouble ( const struct Vector3DoubleData dataIn)

Member Data Documentation

◆ m_floats

tf2Scalar tf2::Vector3::m_floats[4]

The documentation for this class was generated from the following file: