Public Member Functions | Public Attributes | List of all members
tf::Vector3 Class Reference

Vector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-byte alignment when 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 SIMD version that keeps the data in registers. More...

#include <Vector3.h>

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

Public Member Functions

TFSIMD_FORCE_INLINE Vector3 absolute () const
 Return a vector will the absolute values of each element. More...
 
TFSIMD_FORCE_INLINE tfScalar angle (const Vector3 &v) const
 Return the angle between this and another vector. More...
 
TFSIMD_FORCE_INLINE int closestAxis () const
 
TFSIMD_FORCE_INLINE Vector3 cross (const Vector3 &v) const
 Return the cross product between this and another vector. More...
 
TFSIMD_FORCE_INLINE void deSerialize (const struct Vector3Data &dataIn)
 
TFSIMD_FORCE_INLINE void deSerializeDouble (const struct Vector3DoubleData &dataIn)
 
TFSIMD_FORCE_INLINE void deSerializeFloat (const struct Vector3FloatData &dataIn)
 
TFSIMD_FORCE_INLINE tfScalar distance (const Vector3 &v) const
 Return the distance between the ends of this and another vector This is symantically treating the vector like a point. More...
 
TFSIMD_FORCE_INLINE tfScalar distance2 (const Vector3 &v) const
 Return the distance squared between the ends of this and another vector This is symantically treating the vector like a point. More...
 
TFSIMD_FORCE_INLINE tfScalar dot (const Vector3 &v) const
 Return the dot product. More...
 
TFSIMD_FORCE_INLINE int furthestAxis () const
 
TFSIMD_FORCE_INLINE bool fuzzyZero () const
 
void getSkewSymmetricMatrix (Vector3 *v0, Vector3 *v1, Vector3 *v2) const
 
TFSIMD_FORCE_INLINE const tfScalargetX () const
 Return the x value. More...
 
TFSIMD_FORCE_INLINE const tfScalargetY () const
 Return the y value. More...
 
TFSIMD_FORCE_INLINE const tfScalargetZ () const
 Return the z value. More...
 
TFSIMD_FORCE_INLINE bool isZero () const
 
TFSIMD_FORCE_INLINE tfScalar length () const
 Return the length of the vector. More...
 
TFSIMD_FORCE_INLINE tfScalar length2 () const
 Return the length of the vector squared. More...
 
TFSIMD_FORCE_INLINE Vector3 lerp (const Vector3 &v, const tfScalar &t) const
 Return the linear interpolation between this and another vector. More...
 
TFSIMD_FORCE_INLINE int maxAxis () const
 Return the axis with the largest value Note return values are 0,1,2 for x, y, or z. More...
 
TFSIMD_FORCE_INLINE int minAxis () const
 Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z. More...
 
TFSIMD_FORCE_INLINE Vector3normalize ()
 Normalize this vector x^2 + y^2 + z^2 = 1. More...
 
TFSIMD_FORCE_INLINE Vector3 normalized () const
 Return a normalized version of this vector. More...
 
TFSIMD_FORCE_INLINE operator const tfScalar * () const
 
TFSIMD_FORCE_INLINE operator tfScalar * ()
 operator tfScalar*() replaces operator[], using implicit conversion. We added operator != and operator == to avoid pointer comparisons. More...
 
TFSIMD_FORCE_INLINE bool operator!= (const Vector3 &other) const
 
TFSIMD_FORCE_INLINE Vector3operator*= (const tfScalar &s)
 Scale the vector. More...
 
TFSIMD_FORCE_INLINE Vector3operator*= (const Vector3 &v)
 Elementwise multiply this vector by the other. More...
 
TFSIMD_FORCE_INLINE Vector3operator+= (const Vector3 &v)
 Add a vector to this one. More...
 
TFSIMD_FORCE_INLINE Vector3operator-= (const Vector3 &v)
 Sutfract a vector from this one. More...
 
TFSIMD_FORCE_INLINE Vector3operator/= (const tfScalar &s)
 Inversely scale the vector. More...
 
TFSIMD_FORCE_INLINE bool operator== (const Vector3 &other) const
 
TFSIMD_FORCE_INLINE Vector3 rotate (const Vector3 &wAxis, const tfScalar angle) const
 Rotate this vector. More...
 
TFSIMD_FORCE_INLINE void serialize (struct Vector3Data &dataOut) const
 
TFSIMD_FORCE_INLINE void serializeDouble (struct Vector3DoubleData &dataOut) const
 
TFSIMD_FORCE_INLINE void serializeFloat (struct Vector3FloatData &dataOut) const
 
TFSIMD_FORCE_INLINE void setInterpolate3 (const Vector3 &v0, const Vector3 &v1, tfScalar rt)
 
TFSIMD_FORCE_INLINE void setMax (const Vector3 &other)
 Set each element to the max of the current values and the values of another Vector3. More...
 
TFSIMD_FORCE_INLINE void setMin (const Vector3 &other)
 Set each element to the min of the current values and the values of another Vector3. More...
 
TFSIMD_FORCE_INLINE void setValue (const tfScalar &x, const tfScalar &y, const tfScalar &z)
 
TFSIMD_FORCE_INLINE void setW (tfScalar w)
 Set the w value. More...
 
TFSIMD_FORCE_INLINE void setX (tfScalar x)
 Set the x value. More...
 
TFSIMD_FORCE_INLINE void setY (tfScalar y)
 Set the y value. More...
 
TFSIMD_FORCE_INLINE void setZ (tfScalar z)
 Set the z value. More...
 
void setZero ()
 
TFSIMD_FORCE_INLINE tfScalar triple (const Vector3 &v1, const Vector3 &v2) const
 
TFSIMD_FORCE_INLINE Vector3 ()
 No initialization constructor. More...
 
TFSIMD_FORCE_INLINE Vector3 (const tfScalar &x, const tfScalar &y, const tfScalar &z)
 Constructor from scalars. More...
 
TFSIMD_FORCE_INLINE const tfScalarw () const
 Return the w value. More...
 
TFSIMD_FORCE_INLINE const tfScalarx () const
 Return the x value. More...
 
TFSIMD_FORCE_INLINE const tfScalary () const
 Return the y value. More...
 
TFSIMD_FORCE_INLINE const tfScalarz () const
 Return the z value. More...
 

Public Attributes

tfScalar m_floats [4]
 

Detailed Description

Vector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-byte alignment when 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 SIMD version that keeps the data in registers.

Definition at line 38 of file Vector3.h.

Constructor & Destructor Documentation

TFSIMD_FORCE_INLINE tf::Vector3::Vector3 ( )
inline

No initialization constructor.

Definition at line 72 of file Vector3.h.

TFSIMD_FORCE_INLINE tf::Vector3::Vector3 ( const tfScalar x,
const tfScalar y,
const tfScalar z 
)
inline

Constructor from scalars.

Parameters
xX value
yY value
zZ value

Definition at line 80 of file Vector3.h.

Member Function Documentation

TFSIMD_FORCE_INLINE Vector3 tf::Vector3::absolute ( ) const
inline

Return a vector will the absolute values of each element.

Definition at line 172 of file Vector3.h.

TFSIMD_FORCE_INLINE tfScalar tf::Vector3::angle ( const Vector3 v) const
inline

Return the angle between this and another vector.

Parameters
vThe other vector

Definition at line 165 of file Vector3.h.

TFSIMD_FORCE_INLINE int tf::Vector3::closestAxis ( ) const
inline

Definition at line 215 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3 tf::Vector3::cross ( const Vector3 v) const
inline

Return the cross product between this and another vector.

Parameters
vThe other vector

Definition at line 181 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::deSerialize ( const struct Vector3Data dataIn)

Definition at line 725 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::deSerializeDouble ( const struct Vector3DoubleData dataIn)

Definition at line 711 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::deSerializeFloat ( const struct Vector3FloatData dataIn)

Definition at line 697 of file Vector3.h.

TFSIMD_FORCE_INLINE tfScalar tf::Vector3::distance ( const Vector3 v) const

Return the distance between the ends of this and another vector This is symantically treating the vector like a point.

Definition at line 468 of file Vector3.h.

TFSIMD_FORCE_INLINE tfScalar tf::Vector3::distance2 ( const Vector3 v) const

Return the distance squared between the ends of this and another vector This is symantically treating the vector like a point.

Definition at line 463 of file Vector3.h.

TFSIMD_FORCE_INLINE tfScalar tf::Vector3::dot ( const Vector3 v) const
inline

Return the dot product.

Parameters
vThe other vector in the dot product

Definition at line 123 of file Vector3.h.

TFSIMD_FORCE_INLINE int tf::Vector3::furthestAxis ( ) const
inline

Definition at line 210 of file Vector3.h.

TFSIMD_FORCE_INLINE bool tf::Vector3::fuzzyZero ( ) const
inline

Definition at line 333 of file Vector3.h.

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

Definition at line 316 of file Vector3.h.

TFSIMD_FORCE_INLINE const tfScalar& tf::Vector3::getX ( ) const
inline

Return the x value.

Definition at line 249 of file Vector3.h.

TFSIMD_FORCE_INLINE const tfScalar& tf::Vector3::getY ( ) const
inline

Return the y value.

Definition at line 251 of file Vector3.h.

TFSIMD_FORCE_INLINE const tfScalar& tf::Vector3::getZ ( ) const
inline

Return the z value.

Definition at line 253 of file Vector3.h.

TFSIMD_FORCE_INLINE bool tf::Vector3::isZero ( ) const
inline

Definition at line 328 of file Vector3.h.

TFSIMD_FORCE_INLINE tfScalar tf::Vector3::length ( ) const
inline

Return the length of the vector.

Definition at line 135 of file Vector3.h.

TFSIMD_FORCE_INLINE tfScalar tf::Vector3::length2 ( ) const
inline

Return the length of the vector squared.

Definition at line 129 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3 tf::Vector3::lerp ( const Vector3 v,
const tfScalar 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)

Definition at line 233 of file Vector3.h.

TFSIMD_FORCE_INLINE int tf::Vector3::maxAxis ( ) const
inline

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

Definition at line 205 of file Vector3.h.

TFSIMD_FORCE_INLINE int tf::Vector3::minAxis ( ) const
inline

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

Definition at line 198 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3& tf::Vector3::normalize ( )
inline

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

Definition at line 150 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3 tf::Vector3::normalized ( ) const

Return a normalized version of this vector.

Definition at line 473 of file Vector3.h.

TFSIMD_FORCE_INLINE tf::Vector3::operator const tfScalar * ( ) const
inline

Definition at line 275 of file Vector3.h.

TFSIMD_FORCE_INLINE tf::Vector3::operator tfScalar * ( )
inline

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

Definition at line 274 of file Vector3.h.

TFSIMD_FORCE_INLINE bool tf::Vector3::operator!= ( const Vector3 other) const
inline

Definition at line 282 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3& tf::Vector3::operator*= ( const tfScalar s)
inline

Scale the vector.

Parameters
sScale factor

Definition at line 107 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3& tf::Vector3::operator*= ( const Vector3 v)
inline

Elementwise multiply this vector by the other.

Parameters
vThe other vector

Definition at line 242 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3& tf::Vector3::operator+= ( const Vector3 v)
inline

Add a vector to this one.

Parameters
Thevector to add to this one

Definition at line 90 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3& tf::Vector3::operator-= ( const Vector3 v)
inline

Sutfract a vector from this one.

Parameters
Thevector to sutfract

Definition at line 100 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3& tf::Vector3::operator/= ( const tfScalar s)
inline

Inversely scale the vector.

Parameters
sScale factor to divide by

Definition at line 115 of file Vector3.h.

TFSIMD_FORCE_INLINE bool tf::Vector3::operator== ( const Vector3 other) const
inline

Definition at line 277 of file Vector3.h.

TFSIMD_FORCE_INLINE Vector3 tf::Vector3::rotate ( const Vector3 wAxis,
const tfScalar  angle 
) const

Rotate this vector.

Parameters
wAxisThe axis to rotate about
angleThe angle to rotate by

Definition at line 478 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::serialize ( struct Vector3Data dataOut) const

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

Definition at line 718 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::serializeDouble ( struct Vector3DoubleData dataOut) const

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

Definition at line 704 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::serializeFloat ( struct Vector3FloatData dataOut) const

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

Definition at line 690 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::setInterpolate3 ( const Vector3 v0,
const Vector3 v1,
tfScalar  rt 
)
inline

Definition at line 220 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::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

Definition at line 290 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::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

Definition at line 300 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::setValue ( const tfScalar x,
const tfScalar y,
const tfScalar z 
)
inline

Definition at line 308 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::setW ( tfScalar  w)
inline

Set the w value.

Definition at line 261 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::setX ( tfScalar  x)
inline

Set the x value.

Definition at line 255 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::setY ( tfScalar  y)
inline

Set the y value.

Definition at line 257 of file Vector3.h.

TFSIMD_FORCE_INLINE void tf::Vector3::setZ ( tfScalar  z)
inline

Set the z value.

Definition at line 259 of file Vector3.h.

void tf::Vector3::setZero ( )
inline

Definition at line 323 of file Vector3.h.

TFSIMD_FORCE_INLINE tfScalar tf::Vector3::triple ( const Vector3 v1,
const Vector3 v2 
) const
inline

Definition at line 189 of file Vector3.h.

TFSIMD_FORCE_INLINE const tfScalar& tf::Vector3::w ( ) const
inline

Return the w value.

Definition at line 269 of file Vector3.h.

TFSIMD_FORCE_INLINE const tfScalar& tf::Vector3::x ( ) const
inline

Return the x value.

Definition at line 263 of file Vector3.h.

TFSIMD_FORCE_INLINE const tfScalar& tf::Vector3::y ( ) const
inline

Return the y value.

Definition at line 265 of file Vector3.h.

TFSIMD_FORCE_INLINE const tfScalar& tf::Vector3::z ( ) const
inline

Return the z value.

Definition at line 267 of file Vector3.h.

Member Data Documentation

tfScalar tf::Vector3::m_floats[4]

Definition at line 65 of file Vector3.h.


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


tf
Author(s): Tully Foote, Eitan Marder-Eppstein, Wim Meeussen
autogenerated on Fri Jun 7 2019 22:00:28