Main Page Class List Class Members

# sdk/extensions/authoring/source/VHACD/inc/btVector3.h File Reference

`#include "btMinMax.h"`
`#include "btScalar.h"`

Go to the source code of this file.

## Classes
struct | btVector3DoubleData
struct | btVector3FloatData
class | btVector4
## Defines
#define | btVector3Data btVector3FloatData
#define | btVector3DataName "btVector3FloatData"
## Functions
SIMD_FORCE_INLINE btVector3 | absolute () const
| Return a vector will the absolute values of each element.
SIMD_FORCE_INLINE btScalar | angle (const btVector3 &v) const
| Return the angle between this and another vector.
SIMD_FORCE_INLINE btScalar | btAngle (const btVector3 &v1, const btVector3 &v2)
| Return the angle between two vectors.
SIMD_FORCE_INLINE btVector3 | btCross (const btVector3 &v1, const btVector3 &v2)
| Return the cross product of two vectors.
SIMD_FORCE_INLINE btScalar | btDistance (const btVector3 &v1, const btVector3 &v2)
| Return the distance between two vectors.
SIMD_FORCE_INLINE btScalar | btDistance2 (const btVector3 &v1, const btVector3 &v2)
| Return the distance squared between two vectors.
SIMD_FORCE_INLINE btScalar | btDot (const btVector3 &v1, const btVector3 &v2)
| Return the dot product between two vectors.
template<class T >
SIMD_FORCE_INLINE void | btPlaneSpace1 (const T &n, T &p, T &q)
SIMD_FORCE_INLINE void | btSwapScalarEndian (const btScalar &sourceVal, btScalar &destVal)
| btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization
SIMD_FORCE_INLINE void | btSwapVector3Endian (const btVector3 &sourceVec, btVector3 &destVec)
| btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization
SIMD_FORCE_INLINE btScalar | btTriple (const btVector3 &v1, const btVector3 &v2, const btVector3 &v3)
SIMD_FORCE_INLINE void | btUnSwapVector3Endian (btVector3 &vector)
| btUnSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization
SIMD_FORCE_INLINE | btVector3 (const btScalar &x, const btScalar &y, const btScalar &z)
| Constructor from scalars.
SIMD_FORCE_INLINE | btVector3 ()
| No initialization constructor.
SIMD_FORCE_INLINE int32_t | closestAxis () const
SIMD_FORCE_INLINE btVector3 | cross (const btVector3 &v) const
| Return the cross product between this and another vector.
SIMD_FORCE_INLINE void | deSerialize (const struct btVector3Data &dataIn)
SIMD_FORCE_INLINE void | deSerializeDouble (const struct btVector3DoubleData &dataIn)
SIMD_FORCE_INLINE void | deSerializeFloat (const struct btVector3FloatData &dataIn)
SIMD_FORCE_INLINE btScalar | distance (const btVector3 &v) const
| Return the distance between the ends of this and another vector This is symantically treating the vector like a point.
SIMD_FORCE_INLINE btScalar | distance2 (const btVector3 &v) const
| Return the distance squared between the ends of this and another vector This is symantically treating the vector like a point.
SIMD_FORCE_INLINE btScalar | dot (const btVector3 &v) const
| Return the dot product.
SIMD_FORCE_INLINE int32_t | furthestAxis () const
SIMD_FORCE_INLINE bool | fuzzyZero () const
void | getSkewSymmetricMatrix (btVector3 *v0, btVector3 *v1, btVector3 *v2) const
SIMD_FORCE_INLINE const btScalar & | getX () const
| Return the x value.
SIMD_FORCE_INLINE const btScalar & | getY () const
| Return the y value.
SIMD_FORCE_INLINE const btScalar & | getZ () const
| Return the z value.
SIMD_FORCE_INLINE bool | isZero () const
SIMD_FORCE_INLINE btScalar | length () const
| Return the length of the vector.
SIMD_FORCE_INLINE btScalar | length2 () const
| Return the length of the vector squared.
SIMD_FORCE_INLINE btVector3 | lerp (const btVector3 &v1, const btVector3 &v2, const btScalar &t)
| Return the linear interpolation between two vectors.
SIMD_FORCE_INLINE btVector3 | lerp (const btVector3 &v, const btScalar &t) const
| Return the linear interpolation between this and another vector.
SIMD_FORCE_INLINE int32_t | maxAxis () const
| Return the axis with the largest value Note return values are 0,1,2 for x, y, or z.
SIMD_FORCE_INLINE int32_t | minAxis () const
| Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z.
SIMD_FORCE_INLINE btVector3 & | normalize ()
| Normalize this vector x^2 + y^2 + z^2 = 1.
SIMD_FORCE_INLINE btVector3 | normalized () const
| Return a normalized version of this vector.
SIMD_FORCE_INLINE | operator btScalar * ()
| operator btScalar*() replaces operator[], using implicit conversion. We added operator != and operator == to avoid pointer comparisons.
SIMD_FORCE_INLINE | operator const btScalar * () const
SIMD_FORCE_INLINE bool | operator!= (const btVector3 &other) const
SIMD_FORCE_INLINE btVector3 | operator* (const btScalar &s, const btVector3 &v)
| Return the vector scaled by s.
SIMD_FORCE_INLINE btVector3 | operator* (const btVector3 &v, const btScalar &s)
| Return the vector scaled by s.
SIMD_FORCE_INLINE btVector3 | operator* (const btVector3 &v1, const btVector3 &v2)
| Return the elementwise product of two vectors.
SIMD_FORCE_INLINE btVector3 & | operator*= (const btVector3 &v)
| Elementwise multiply this vector by the other.
SIMD_FORCE_INLINE btVector3 & | operator*= (const btScalar &s)
| Scale the vector.
SIMD_FORCE_INLINE btVector3 | operator+ (const btVector3 &v1, const btVector3 &v2)
| Return the sum of two vectors (Point symantics).
SIMD_FORCE_INLINE btVector3 & | operator+= (const btVector3 &v)
| Add a vector to this one.
SIMD_FORCE_INLINE btVector3 | operator- (const btVector3 &v)
| Return the negative of the vector.
SIMD_FORCE_INLINE btVector3 | operator- (const btVector3 &v1, const btVector3 &v2)
| Return the difference between two vectors.
SIMD_FORCE_INLINE btVector3 & | operator-= (const btVector3 &v)
| Subtract a vector from this one.
SIMD_FORCE_INLINE btVector3 | operator/ (const btVector3 &v1, const btVector3 &v2)
| Return the vector inversely scaled by s.
SIMD_FORCE_INLINE btVector3 | operator/ (const btVector3 &v, const btScalar &s)
| Return the vector inversely scaled by s.
SIMD_FORCE_INLINE btVector3 & | operator/= (const btScalar &s)
| Inversely scale the vector.
SIMD_FORCE_INLINE bool | operator== (const btVector3 &other) const
SIMD_FORCE_INLINE btVector3 | rotate (const btVector3 &wAxis, const btScalar angle) const
| Return a rotated version of this vector.
SIMD_FORCE_INLINE btVector3 & | safeNormalize ()
SIMD_FORCE_INLINE void | serialize (struct btVector3Data &dataOut) const
SIMD_FORCE_INLINE void | serializeDouble (struct btVector3DoubleData &dataOut) const
SIMD_FORCE_INLINE void | serializeFloat (struct btVector3FloatData &dataOut) const
SIMD_FORCE_INLINE void | setInterpolate3 (const btVector3 &v0, const btVector3 &v1, btScalar rt)
SIMD_FORCE_INLINE void | setMax (const btVector3 &other)
| Set each element to the max of the current values and the values of another btVector3.
SIMD_FORCE_INLINE void | setMin (const btVector3 &other)
| Set each element to the min of the current values and the values of another btVector3.
SIMD_FORCE_INLINE void | setValue (const btScalar &x, const btScalar &y, const btScalar &z)
SIMD_FORCE_INLINE void | setW (btScalar w)
| Set the w value.
SIMD_FORCE_INLINE void | setX (btScalar x)
| Set the x value.
SIMD_FORCE_INLINE void | setY (btScalar y)
| Set the y value.
SIMD_FORCE_INLINE void | setZ (btScalar z)
| Set the z value.
void | setZero ()
SIMD_FORCE_INLINE btScalar | triple (const btVector3 &v1, const btVector3 &v2) const
SIMD_FORCE_INLINE const btScalar & | w () const
| Return the w value.
SIMD_FORCE_INLINE const btScalar & | x () const
| Return the x value.
SIMD_FORCE_INLINE const btScalar & | y () const
| Return the y value.
SIMD_FORCE_INLINE const btScalar & | z () const
| Return the z value.
## Variables
btScalar | m_floats [4]
| btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-byte alignment when btVector3 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

## Define Documentation

#define btVector3Data btVector3FloatData

#define btVector3DataName "btVector3FloatData"

## Function Documentation

SIMD_FORCE_INLINE btVector3 absolute | ( |  | ) | const

Return a vector will the absolute values of each element.

SIMD_FORCE_INLINE btScalar angle | ( | const btVector3 & | v | ) | const

Return the angle between this and another vector.

Parameters:

  | v | The other vector

SIMD_FORCE_INLINE btScalar btAngle | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the angle between two vectors.

SIMD_FORCE_INLINE btVector3 btCross | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the cross product of two vectors.

SIMD_FORCE_INLINE btScalar btDistance | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the distance between two vectors.

SIMD_FORCE_INLINE btScalar btDistance2 | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the distance squared between two vectors.

SIMD_FORCE_INLINE btScalar btDot | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the dot product between two vectors.

template<class T >

SIMD_FORCE_INLINE void btPlaneSpace1 | ( | const T & | n,
|  | T & | p,
|  | T & | q |
| ) |  |  | `[inline]`

SIMD_FORCE_INLINE void btSwapScalarEndian | ( | const btScalar & | sourceVal,
|  | btScalar & | destVal |
| ) |  |  |

btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization

SIMD_FORCE_INLINE void btSwapVector3Endian | ( | const btVector3 & | sourceVec,
|  | btVector3 & | destVec |
| ) |  |  |

btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization

SIMD_FORCE_INLINE btScalar btTriple | ( | const btVector3 & | v1,
|  | const btVector3 & | v2,
|  | const btVector3 & | v3 |
| ) |  |  |

SIMD_FORCE_INLINE void btUnSwapVector3Endian | ( | btVector3 & | vector | ) |

btUnSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization

SIMD_FORCE_INLINE btVector3 | ( | const btScalar & | x,
|  | const btScalar & | y,
|  | const btScalar & | z |
| ) |  |  |

Constructor from scalars.

Parameters:

  | x | X value
  | y | Y value
  | z | Z value

SIMD_FORCE_INLINE btVector3 | ( |  | ) |

No initialization constructor.

SIMD_FORCE_INLINE int32_t closestAxis | ( |  | ) | const

SIMD_FORCE_INLINE btVector3 cross | ( | const btVector3 & | v | ) | const

Return the cross product between this and another vector.

Parameters:

  | v | The other vector

SIMD_FORCE_INLINE void btVector3::deSerialize | ( | const struct btVector3Data & | dataIn | ) |

SIMD_FORCE_INLINE void btVector3::deSerializeDouble | ( | const struct btVector3DoubleData & | dataIn | ) |

SIMD_FORCE_INLINE void btVector3::deSerializeFloat | ( | const struct btVector3FloatData & | dataIn | ) |

SIMD_FORCE_INLINE btScalar btVector3::distance | ( | const btVector3 & | v | ) | const

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

SIMD_FORCE_INLINE btScalar btVector3::distance2 | ( | const btVector3 & | v | ) | const

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

SIMD_FORCE_INLINE btScalar dot | ( | const btVector3 & | v | ) | const

Return the dot product.

Parameters:

  | v | The other vector in the dot product

SIMD_FORCE_INLINE int32_t furthestAxis | ( |  | ) | const

SIMD_FORCE_INLINE bool fuzzyZero | ( |  | ) | const

void getSkewSymmetricMatrix | ( | btVector3 * | v0,
|  | btVector3 * | v1,
|  | btVector3 * | v2 |
| ) |  |  | const

SIMD_FORCE_INLINE const btScalar& getX | ( |  | ) | const

Return the x value.

SIMD_FORCE_INLINE const btScalar& getY | ( |  | ) | const

Return the y value.

SIMD_FORCE_INLINE const btScalar& getZ | ( |  | ) | const

Return the z value.

SIMD_FORCE_INLINE bool isZero | ( |  | ) | const

SIMD_FORCE_INLINE btScalar length | ( |  | ) | const

Return the length of the vector.

SIMD_FORCE_INLINE btScalar length2 | ( |  | ) | const

Return the length of the vector squared.

SIMD_FORCE_INLINE btVector3 lerp | ( | const btVector3 & | v1,
|  | const btVector3 & | v2,
|  | const btScalar & | t |
| ) |  |  |

Return the linear interpolation between two vectors.

Parameters:

  | v1 | One vector
  | v2 | The other vector
  | t | The ration of this to v (t = 0 => return v1, t=1 => return v2)

SIMD_FORCE_INLINE btVector3 lerp | ( | const btVector3 & | v,
|  | const btScalar & | 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)

SIMD_FORCE_INLINE int32_t maxAxis | ( |  | ) | const

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

SIMD_FORCE_INLINE int32_t minAxis | ( |  | ) | const

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

SIMD_FORCE_INLINE btVector3& normalize | ( |  | ) |

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

SIMD_FORCE_INLINE btVector3 btVector3::normalized | ( |  | ) | const

Return a normalized version of this vector.

SIMD_FORCE_INLINE operator btScalar * | ( |  | ) |

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

SIMD_FORCE_INLINE operator const btScalar * | ( |  | ) | const

SIMD_FORCE_INLINE bool operator!= | ( | const btVector3 & | other | ) | const

SIMD_FORCE_INLINE btVector3 operator* | ( | const btScalar & | s,
|  | const btVector3 & | v |
| ) |  |  |

Return the vector scaled by s.

SIMD_FORCE_INLINE btVector3 operator* | ( | const btVector3 & | v,
|  | const btScalar & | s |
| ) |  |  |

Return the vector scaled by s.

SIMD_FORCE_INLINE btVector3 operator* | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the elementwise product of two vectors.

SIMD_FORCE_INLINE btVector3& operator*= | ( | const btVector3 & | v | ) |

Elementwise multiply this vector by the other.

Parameters:

  | v | The other vector

SIMD_FORCE_INLINE btVector3& operator*= | ( | const btScalar & | s | ) |

Scale the vector.

Parameters:

  | s | Scale factor

SIMD_FORCE_INLINE btVector3 operator+ | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the sum of two vectors (Point symantics).

SIMD_FORCE_INLINE btVector3& operator+= | ( | const btVector3 & | v | ) |

Add a vector to this one.

Parameters:

  | The | vector to add to this one

SIMD_FORCE_INLINE btVector3 operator- | ( | const btVector3 & | v | ) |

Return the negative of the vector.

SIMD_FORCE_INLINE btVector3 operator- | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the difference between two vectors.

SIMD_FORCE_INLINE btVector3& operator-= | ( | const btVector3 & | v | ) |

Subtract a vector from this one.

Parameters:

  | The | vector to subtract

SIMD_FORCE_INLINE btVector3 operator/ | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  |

Return the vector inversely scaled by s.

SIMD_FORCE_INLINE btVector3 operator/ | ( | const btVector3 & | v,
|  | const btScalar & | s |
| ) |  |  |

Return the vector inversely scaled by s.

SIMD_FORCE_INLINE btVector3& operator/= | ( | const btScalar & | s | ) |

Inversely scale the vector.

Parameters:

  | s | Scale factor to divide by

SIMD_FORCE_INLINE bool operator== | ( | const btVector3 & | other | ) | const

SIMD_FORCE_INLINE btVector3 btVector3::rotate | ( | const btVector3 & | wAxis,
|  | const btScalar | angle |
| ) |  |  | const

Return a rotated version of this vector.

Parameters:

  | wAxis | The axis to rotate about
  | angle | The angle to rotate by

SIMD_FORCE_INLINE btVector3& safeNormalize | ( |  | ) |

SIMD_FORCE_INLINE void serialize | ( | struct btVector3Data & | dataOut | ) | const

SIMD_FORCE_INLINE void btVector3::serializeDouble | ( | struct btVector3DoubleData & | dataOut | ) | const

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

SIMD_FORCE_INLINE void btVector3::serializeFloat | ( | struct btVector3FloatData & | dataOut | ) | const

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

SIMD_FORCE_INLINE void setInterpolate3 | ( | const btVector3 & | v0,
|  | const btVector3 & | v1,
|  | btScalar | rt |
| ) |  |  |

SIMD_FORCE_INLINE void setMax | ( | const btVector3 & | other | ) |

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

Parameters:

  | other | The other btVector3 to compare with

SIMD_FORCE_INLINE void setMin | ( | const btVector3 & | other | ) |

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

Parameters:

  | other | The other btVector3 to compare with

SIMD_FORCE_INLINE void setValue | ( | const btScalar & | x,
|  | const btScalar & | y,
|  | const btScalar & | z |
| ) |  |  |

SIMD_FORCE_INLINE void setW | ( | btScalar | w | ) |

Set the w value.

SIMD_FORCE_INLINE void setX | ( | btScalar | x | ) |

Set the x value.

SIMD_FORCE_INLINE void setY | ( | btScalar | y | ) |

Set the y value.

SIMD_FORCE_INLINE void setZ | ( | btScalar | z | ) |

Set the z value.

void setZero | ( |  | ) |

SIMD_FORCE_INLINE btScalar triple | ( | const btVector3 & | v1,
|  | const btVector3 & | v2 |
| ) |  |  | const

SIMD_FORCE_INLINE const btScalar& w | ( |  | ) | const

Return the w value.

SIMD_FORCE_INLINE const btScalar& x | ( |  | ) | const

Return the x value.

SIMD_FORCE_INLINE const btScalar& y | ( |  | ) | const

Return the y value.

SIMD_FORCE_INLINE const btScalar& z | ( |  | ) | const

Return the z value.

## Variable Documentation

btScalar m_floats[4]

btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-byte alignment when btVector3 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