ReactPhysics3D: reactphysics3d::Vector3 Struct Reference

| ReactPhysics3D v0.10.2 C++ Physics engine library

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
reactphysics3d::Vector3 Struct Reference

This class represents a 3D vector. More...

`#include <include/reactphysics3d/mathematics/Vector3.h>`

## Public Member Functions
| Vector3 ()
| Constructor of the struct Vector3.
| Vector3 (decimal newX, decimal newY, decimal newZ)
| Constructor with arguments.
void | setAllValues (decimal newX, decimal newY, decimal newZ)
| Set all the values of the vector.
void | setToZero ()
| Set the vector to zero.
decimal | length () const
| Return the length of the vector.
decimal | lengthSquare () const
| Return the square of the length of the vector.
Vector3 | getUnit () const
| Return the corresponding unit vector.
Vector3 | getOneUnitOrthogonalVector () const
| Return one unit orthogonal vector of the current vector.
bool | isUnit () const
| Return true if the vector is unit and false otherwise.
bool | isFinite () const
| Return true if the values are not NAN OR INF.
bool | isZero () const
| Return true if the current vector is the zero vector.
decimal | dot (const Vector3 &vector) const
| Dot product of two vectors.
Vector3 | cross (const Vector3 &vector) const
| Cross product of two vectors.
void | normalize ()
| Normalize the vector.
Vector3 | getAbsoluteVector () const
| Return the corresponding absolute value vector.
int | getMinAxis () const
| Return the axis with the minimal value.
int | getMaxAxis () const
| Return the axis with the maximal value.
decimal | getMinValue () const
| Return the minimum value among the three components of a vector.
decimal | getMaxValue () const
| Return the maximum value among the three components of a vector.
bool | operator== (const Vector3 &vector) const
| Overloaded operator for the equality condition.
bool | operator!= (const Vector3 &vector) const
| Overloaded operator for the is different condition.
Vector3 & | operator+= (const Vector3 &vector)
| Overloaded operator for addition with assignment.
Vector3 & | operator-= (const Vector3 &vector)
| Overloaded operator for substraction with assignment.
Vector3 & | operator*= (decimal number)
| Overloaded operator for multiplication with a number with assignment.
Vector3 & | operator/= (decimal number)
| Overloaded operator for division by a number with assignment.
decimal & | operator[] (int index)
| Overloaded operator for value access.
const decimal & | operator[] (int index) const
| Overloaded operator for value access.
bool | operator< (const Vector3 &vector) const
| Overloaded less than operator for ordering to be used inside std::set for instance.
std::string | to_string () const
| Get the string representation.

## Static Public Member Functions
static Vector3 | min (const Vector3 &vector1, const Vector3 &vector2)
| Return a vector taking the minimum components of two vectors.
static Vector3 | max (const Vector3 &vector1, const Vector3 &vector2)
| Return a vector taking the maximum components of two vectors.
static Vector3 | zero ()
| Return the zero vector.
static bool | approxEqual (const Vector3 &vec1, const Vector3 &vec2, decimal epsilon=MACHINE_EPSILON)
| Function to test if two vectors are (almost) equal.

## Public Attributes
decimal | x
| Component x.
decimal | y
| Component y.
decimal | z
| Component z.

## Detailed Description

This class represents a 3D vector.

The documentation for this struct was generated from the following files:

- include/reactphysics3d/mathematics/Vector3.h
- src/mathematics/Vector3.cpp