Public Member Functions | Related Functions | List of all members
RVO::Vector3 Class Reference

Defines a three-dimensional vector. More...

#include <Vector3.h>

Public Member Functions

RVO_API Vector3 ()
 Constructs and initializes a three-dimensional vector instance to zero.
 
RVO_API Vector3 (const Vector3 &vector)
 Constructs and initializes a three-dimensional vector from the specified three-dimensional vector. More...
 
RVO_API Vector3 (const float val[3])
 Constructs and initializes a three-dimensional vector from the specified three-element array. More...
 
RVO_API Vector3 (float x, float y, float z)
 Constructs and initializes a three-dimensional vector from the specified xyz-coordinates. More...
 
RVO_API float x () const
 Returns the x-coordinate of this three-dimensional vector. More...
 
RVO_API float y () const
 Returns the y-coordinate of this three-dimensional vector. More...
 
RVO_API float z () const
 Returns the z-coordinate of this three-dimensional vector. More...
 
RVO_API float operator[] (size_t i) const
 Returns the specified coordinate of this three-dimensional vector. More...
 
RVO_API float & operator[] (size_t i)
 Returns a reference to the specified coordinate of this three-dimensional vector. More...
 
RVO_API Vector3 operator- () const
 Computes the negation of this three-dimensional vector. More...
 
RVO_API float operator* (const Vector3 &vector) const
 Computes the dot product of this three-dimensional vector with the specified three-dimensional vector. More...
 
RVO_API Vector3 operator* (float scalar) const
 Computes the scalar multiplication of this three-dimensional vector with the specified scalar value. More...
 
RVO_API Vector3 operator/ (float scalar) const
 Computes the scalar division of this three-dimensional vector with the specified scalar value. More...
 
RVO_API Vector3 operator+ (const Vector3 &vector) const
 Computes the vector sum of this three-dimensional vector with the specified three-dimensional vector. More...
 
RVO_API Vector3 operator- (const Vector3 &vector) const
 Computes the vector difference of this three-dimensional vector with the specified three-dimensional vector. More...
 
RVO_API bool operator== (const Vector3 &vector) const
 Tests this three-dimensional vector for equality with the specified three-dimensional vector. More...
 
RVO_API bool operator!= (const Vector3 &vector) const
 Tests this three-dimensional vector for inequality with the specified three-dimensional vector. More...
 
RVO_API Vector3operator*= (float scalar)
 Sets the value of this three-dimensional vector to the scalar multiplication of itself with the specified scalar value. More...
 
RVO_API Vector3operator/= (float scalar)
 Sets the value of this three-dimensional vector to the scalar division of itself with the specified scalar value. More...
 
RVO_API Vector3operator+= (const Vector3 &vector)
 Sets the value of this three-dimensional vector to the vector sum of itself with the specified three-dimensional vector. More...
 
RVO_API Vector3operator-= (const Vector3 &vector)
 Sets the value of this three-dimensional vector to the vector difference of itself with the specified three-dimensional vector. More...
 

Related Functions

(Note that these are not member functions.)

Vector3 operator* (float scalar, const Vector3 &vector)
 Computes the scalar multiplication of the specified three-dimensional vector with the specified scalar value. More...
 
Vector3 cross (const Vector3 &vector1, const Vector3 &vector2)
 Computes the cross product of the specified three-dimensional vectors. More...
 
std::ostream & operator<< (std::ostream &os, const Vector3 &vector)
 Inserts the specified three-dimensional vector into the specified output stream. More...
 
float abs (const Vector3 &vector)
 Computes the length of a specified three-dimensional vector. More...
 
float absSq (const Vector3 &vector)
 Computes the squared length of a specified three-dimensional vector. More...
 
Vector3 normalize (const Vector3 &vector)
 Computes the normalization of the specified three-dimensional vector. More...
 

Detailed Description

Defines a three-dimensional vector.

Constructor & Destructor Documentation

◆ Vector3() [1/3]

RVO_API RVO::Vector3::Vector3 ( const Vector3 vector)
inline

Constructs and initializes a three-dimensional vector from the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector containing the xyz-coordinates.

◆ Vector3() [2/3]

RVO_API RVO::Vector3::Vector3 ( const float  val[3])
inlineexplicit

Constructs and initializes a three-dimensional vector from the specified three-element array.

Parameters
valThe three-element array containing the xyz-coordinates.

◆ Vector3() [3/3]

RVO_API RVO::Vector3::Vector3 ( float  x,
float  y,
float  z 
)
inline

Constructs and initializes a three-dimensional vector from the specified xyz-coordinates.

Parameters
xThe x-coordinate of the three-dimensional vector.
yThe y-coordinate of the three-dimensional vector.
zThe z-coordinate of the three-dimensional vector.

Member Function Documentation

◆ operator!=()

RVO_API bool RVO::Vector3::operator!= ( const Vector3 vector) const
inline

Tests this three-dimensional vector for inequality with the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector with which to test for inequality.
Returns
True if the three-dimensional vectors are not equal.

◆ operator*() [1/2]

RVO_API float RVO::Vector3::operator* ( const Vector3 vector) const
inline

Computes the dot product of this three-dimensional vector with the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector with which the dot product should be computed.
Returns
The dot product of this three-dimensional vector with a specified three-dimensional vector.

◆ operator*() [2/2]

RVO_API Vector3 RVO::Vector3::operator* ( float  scalar) const
inline

Computes the scalar multiplication of this three-dimensional vector with the specified scalar value.

Parameters
scalarThe scalar value with which the scalar multiplication should be computed.
Returns
The scalar multiplication of this three-dimensional vector with a specified scalar value.

◆ operator*=()

RVO_API Vector3& RVO::Vector3::operator*= ( float  scalar)
inline

Sets the value of this three-dimensional vector to the scalar multiplication of itself with the specified scalar value.

Parameters
scalarThe scalar value with which the scalar multiplication should be computed.
Returns
A reference to this three-dimensional vector.

◆ operator+()

RVO_API Vector3 RVO::Vector3::operator+ ( const Vector3 vector) const
inline

Computes the vector sum of this three-dimensional vector with the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector with which the vector sum should be computed.
Returns
The vector sum of this three-dimensional vector with a specified three-dimensional vector.

◆ operator+=()

RVO_API Vector3& RVO::Vector3::operator+= ( const Vector3 vector)
inline

Sets the value of this three-dimensional vector to the vector sum of itself with the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector with which the vector sum should be computed.
Returns
A reference to this three-dimensional vector.

◆ operator-() [1/2]

RVO_API Vector3 RVO::Vector3::operator- ( ) const
inline

Computes the negation of this three-dimensional vector.

Returns
The negation of this three-dimensional vector.

◆ operator-() [2/2]

RVO_API Vector3 RVO::Vector3::operator- ( const Vector3 vector) const
inline

Computes the vector difference of this three-dimensional vector with the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector with which the vector difference should be computed.
Returns
The vector difference of this three-dimensional vector with a specified three-dimensional vector.

◆ operator-=()

RVO_API Vector3& RVO::Vector3::operator-= ( const Vector3 vector)
inline

Sets the value of this three-dimensional vector to the vector difference of itself with the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector with which the vector difference should be computed.
Returns
A reference to this three-dimensional vector.

◆ operator/()

RVO_API Vector3 RVO::Vector3::operator/ ( float  scalar) const
inline

Computes the scalar division of this three-dimensional vector with the specified scalar value.

Parameters
scalarThe scalar value with which the scalar division should be computed.
Returns
The scalar division of this three-dimensional vector with a specified scalar value.

◆ operator/=()

RVO_API Vector3& RVO::Vector3::operator/= ( float  scalar)
inline

Sets the value of this three-dimensional vector to the scalar division of itself with the specified scalar value.

Parameters
scalarThe scalar value with which the scalar division should be computed.
Returns
A reference to this three-dimensional vector.

◆ operator==()

RVO_API bool RVO::Vector3::operator== ( const Vector3 vector) const
inline

Tests this three-dimensional vector for equality with the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector with which to test for equality.
Returns
True if the three-dimensional vectors are equal.

◆ operator[]() [1/2]

RVO_API float& RVO::Vector3::operator[] ( size_t  i)
inline

Returns a reference to the specified coordinate of this three-dimensional vector.

Parameters
iThe coordinate to which a reference should be returned (0 <= i < 3).
Returns
A reference to the specified coordinate of the three-dimensional vector.

◆ operator[]() [2/2]

RVO_API float RVO::Vector3::operator[] ( size_t  i) const
inline

Returns the specified coordinate of this three-dimensional vector.

Parameters
iThe coordinate that should be returned (0 <= i < 3).
Returns
The specified coordinate of the three-dimensional vector.

◆ x()

RVO_API float RVO::Vector3::x ( ) const
inline

Returns the x-coordinate of this three-dimensional vector.

Returns
The x-coordinate of the three-dimensional vector.

◆ y()

RVO_API float RVO::Vector3::y ( ) const
inline

Returns the y-coordinate of this three-dimensional vector.

Returns
The y-coordinate of the three-dimensional vector.

◆ z()

RVO_API float RVO::Vector3::z ( ) const
inline

Returns the z-coordinate of this three-dimensional vector.

Returns
The z-coordinate of the three-dimensional vector.

Friends And Related Function Documentation

◆ abs()

float abs ( const Vector3 vector)
related

Computes the length of a specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector whose length is to be computed.
Returns
The length of the three-dimensional vector.

◆ absSq()

float absSq ( const Vector3 vector)
related

Computes the squared length of a specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector whose squared length is to be computed.
Returns
The squared length of the three-dimensional vector.

◆ cross()

Vector3 cross ( const Vector3 vector1,
const Vector3 vector2 
)
related

Computes the cross product of the specified three-dimensional vectors.

Parameters
vector1The first vector with which the cross product should be computed.
vector2The second vector with which the cross product should be computed.
Returns
The cross product of the two specified vectors.

◆ normalize()

Vector3 normalize ( const Vector3 vector)
related

Computes the normalization of the specified three-dimensional vector.

Parameters
vectorThe three-dimensional vector whose normalization is to be computed.
Returns
The normalization of the three-dimensional vector.

◆ operator*()

Vector3 operator* ( float  scalar,
const Vector3 vector 
)
related

Computes the scalar multiplication of the specified three-dimensional vector with the specified scalar value.

Parameters
scalarThe scalar value with which the scalar multiplication should be computed.
vectorThe three-dimensional vector with which the scalar multiplication should be computed.
Returns
The scalar multiplication of the three-dimensional vector with the scalar value.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const Vector3 vector 
)
related

Inserts the specified three-dimensional vector into the specified output stream.

Parameters
osThe output stream into which the three-dimensional vector should be inserted.
vectorThe three-dimensional vector which to insert into the output stream.
Returns
A reference to the output stream.

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