Class endstone::Vector¶
template <typename T>
Represents a 3-dimensional vector.
#include <endstone/util/vector.h>
Public Functions¶
Type | Name |
---|---|
constexpr | Vector () |
constexpr | Vector (T x, T y, T z) |
constexpr T | distance (const Vector< T > & other) const |
constexpr T | distanceSquared (const Vector< T > & other) const |
constexpr T | getX () const Gets the X component. |
constexpr T | getY () const Gets the Y component. |
constexpr T | getZ () const Gets the Z component. |
constexpr T | length () const Gets the magnitude of the vector, defined as sqrt(x2+y2+z^2). |
constexpr T | lengthSquared () const Gets the magnitude of the vector squared. |
constexpr Vector< T > | operator* (const Vector< T > & other) const |
Vector< T > | operator* (T scalar) const |
Vector< T > & | operator*= (const Vector< T > & other) |
constexpr Vector< T > | operator+ (const Vector< T > & other) const |
Vector< T > | operator+ (T scalar) const |
Vector< T > & | operator+= (const Vector< T > & other) |
constexpr Vector< T > | operator- (const Vector< T > & other) const |
Vector< T > | operator- (T scalar) const |
Vector< T > & | operator-= (const Vector< T > & other) |
constexpr Vector< T > | operator/ (const Vector< T > & other) const |
Vector< T > | operator/ (T scalar) const |
Vector< T > & | operator/= (const Vector< T > & other) |
constexpr bool | operator== (const Vector< T > & other) const |
constexpr void | setX (T x) Set the X component. |
constexpr void | setY (T y) Set the Y component. |
constexpr void | setZ (T z) Set the Z component. |
Protected Attributes¶
Type | Name |
---|---|
T | x_ |
T | y_ |
T | z_ |
Public Functions Documentation¶
function Vector [½]¶
function Vector [2/2]¶
function distance¶
Get the distance between this vector and another.
Parameters:
other
The other vector
Returns:
the distance
function distanceSquared¶
Get the squared distance between this vector and another.
Parameters:
other
The other vector
Returns:
the distance
function getX¶
Gets the X component.
Returns:
The X component.
function getY¶
Gets the Y component.
Returns:
The Y component.
function getZ¶
Gets the Z component.
Returns:
The Z component.
function length¶
Gets the magnitude of the vector, defined as sqrt(x2+y2+z^2).
Returns:
the magnitude
function lengthSquared¶
Gets the magnitude of the vector squared.
Returns:
the magnitude
function operator*¶
function operator*¶
function operator*=¶
function operator+¶
function operator+¶
function operator+=¶
function operator-¶
function operator-¶
function operator-=¶
function operator/¶
function operator/¶
function operator/=¶
function operator==¶
function setX¶
Set the X component.
Parameters:
x
The new X component.
Returns:
This vector.
function setY¶
Set the Y component.
Parameters:
y
The new Y component.
Returns:
This vector.
function setZ¶
Set the Z component.
Parameters:
z
The new Z component.
Returns:
This vector.
Protected Attributes Documentation¶
variable x_¶
variable y_¶
variable z_¶
Friends Documentation¶
friend operator*¶
friend operator+¶
friend operator-¶
friend operator/¶
The documentation for this class was generated from the following file include/endstone/util/vector.h