ReactPhysics3D: reactphysics3d::Vector2 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::Vector2 Struct Reference

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

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

## Public Member Functions
| Vector2 ()
| Constructor of the struct Vector2.
| Vector2 (decimal newX, decimal newY)
| Constructor with arguments.
void | setAllValues (decimal newX, decimal newY)
| 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.
Vector2 | getUnit () const
| Return the corresponding unit vector.
Vector2 | 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 Vector2 &vector) const
| Dot product of two vectors.
void | normalize ()
| Normalize the vector.
Vector2 | 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.
bool | operator== (const Vector2 &vector) const
| Overloaded operator for the equality condition.
bool | operator!= (const Vector2 &vector) const
| Overloaded operator for the is different condition.
Vector2 & | operator+= (const Vector2 &vector)
| Overloaded operator for addition with assignment.
Vector2 & | operator-= (const Vector2 &vector)
| Overloaded operator for substraction with assignment.
Vector2 & | operator*= (decimal number)
| Overloaded operator for multiplication with a number with assignment.
Vector2 & | 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 Vector2 &vector) const
| Overloaded less than operator for ordering to be used inside std::set for instance.
std::string | to_string () const
| Return the string representation.

## Static Public Member Functions
static Vector2 | min (const Vector2 &vector1, const Vector2 &vector2)
| Return a vector taking the minimum components of two vectors.
static Vector2 | max (const Vector2 &vector1, const Vector2 &vector2)
| Return a vector taking the maximum components of two vectors.
static Vector2 | zero ()
| Return the zero vector.

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

## Detailed Description

This class represents a 2D vector.

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

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