Skip to content

Class Argos::Vector3D

template <typename T>

ClassList > Argos > Vector3D

Generic 3-dimensional vector. More...

  • #include <Vector3D.h>

Public Attributes

Type Name
T x
T y
T z

Public Functions

Type Name
Vector3D ()
Construct a zero vector.
Vector3D (T x, T y, T z)
Construct a vector from its three coordinates.
T norm () const
Euclidean norm of this vector.
T normSquared () const
Squared Euclidean norm of this vector.
Vector3D normalized () const
Return a unit-length vector pointing in the same direction.
bool operator!= (const Vector3D & vector) const
Component-wise approximate inequality.
Vector3D operator* (const T & scal) const
Multiplication of this vector by a scalar.
T operator* (const Vector3D & vector) const
Dot product of this vector with another vector.
Vector3D & operator*= (const T & scal)
In-place scalar multiplication of this vector.
Vector3D operator+ (const Vector3D & vector) const
Component-wise addition of two vectors.
Vector3D & operator+= (const Vector3D & vector)
In-place component-wise addition of another vector.
Vector3D operator- (const Vector3D & vector) const
Component-wise subtraction of another vector from this vector.
Vector3D & operator-= (const Vector3D & vector)
In-place component-wise subtraction of another vector.
Vector3D operator/ (const T & scal) const
Division of this vector by a scalar.
Vector3D & operator/= (const T & scal)
In-place scalar division of this vector.
bool operator== (const Vector3D & vector) const
Component-wise approximate equality.
Vector3D operator^ (const Vector3D & vector) const
Cross product of this vector with another vector.
Vector3D & operator^= (const Vector3D & vector)
In-place cross product of this vector with another vector.

Detailed Description

Template parameters:

  • T The type of the vector coordinates.

Public Attributes Documentation

variable x

T Argos::Vector3D< T >::x;

First coordinate


variable y

T Argos::Vector3D< T >::y;

Second coordinate


variable z

T Argos::Vector3D< T >::z;

Third coordinate


Public Functions Documentation

function Vector3D [1/2]

Construct a zero vector.

Argos::Vector3D::Vector3D () 


function Vector3D [2/2]

Construct a vector from its three coordinates.

Argos::Vector3D::Vector3D (
    T x,
    T y,
    T z
) 

Parameters:

  • x The coordinates of the 3-dimensional vector.

function norm

Euclidean norm of this vector.

T Argos::Vector3D::norm () const

Returns:

The Euclidean norm (square root of the sum of squared components).


function normSquared

Squared Euclidean norm of this vector.

T Argos::Vector3D::normSquared () const

Returns:

The sum of the squared components (no square root).


function normalized

Return a unit-length vector pointing in the same direction.

Vector3D Argos::Vector3D::normalized () const

Returns:

A new Vector3D equal to this vector divided by its norm.


function operator!=

Component-wise approximate inequality.

bool Argos::Vector3D::operator!= (
    const  Vector3D & vector
) const

See operator== for the epsilon tolerance.

Parameters:

  • vector The second vector to compare.

Returns:

True if at least one component differs by epsilon or more.


function operator*

Multiplication of this vector by a scalar.

Vector3D Argos::Vector3D::operator* (
    const  T & scal
) const

Parameters:

  • scal The scalar multiplier.

Returns:

A new Vector3D with each component multiplied by scal.


function operator*

Dot product of this vector with another vector.

T Argos::Vector3D::operator* (
    const  Vector3D & vector
) const

Parameters:

  • vector The second vector.

Returns:

The dot product (sum of the component-wise products).


function operator*=

In-place scalar multiplication of this vector.

Vector3D & Argos::Vector3D::operator*= (
    const  T & scal
) 

Parameters:

  • scal The scalar multiplier.

Returns:

Reference to this vector after the multiplication.


function operator+

Component-wise addition of two vectors.

Vector3D Argos::Vector3D::operator+ (
    const  Vector3D & vector
) const

Parameters:

  • vector The right-hand side vector.

Returns:

A new Vector3D equal to the component-wise sum.


function operator+=

In-place component-wise addition of another vector.

Vector3D & Argos::Vector3D::operator+= (
    const  Vector3D & vector
) 

Parameters:

  • vector The vector to add to this one.

Returns:

Reference to this vector after the addition.


function operator-

Component-wise subtraction of another vector from this vector.

Vector3D Argos::Vector3D::operator- (
    const  Vector3D & vector
) const

Parameters:

  • vector The right-hand side vector.

Returns:

A new Vector3D equal to the component-wise difference.


function operator-=

In-place component-wise subtraction of another vector.

Vector3D & Argos::Vector3D::operator-= (
    const  Vector3D & vector
) 

Parameters:

  • vector The vector to subtract from this one.

Returns:

Reference to this vector after the subtraction.


function operator/

Division of this vector by a scalar.

Vector3D Argos::Vector3D::operator/ (
    const  T & scal
) const

Parameters:

  • scal The scalar divisor (must be non-zero).

Returns:

A new Vector3D with each component divided by scal.

Exception:

  • std::overflow_error if scal is zero.

function operator/=

In-place scalar division of this vector.

Vector3D & Argos::Vector3D::operator/= (
    const  T & scal
) 

Parameters:

  • scal The scalar divisor (must be non-zero).

Returns:

Reference to this vector after the division.

Exception:

  • std::overflow_error if scal is zero.

function operator==

Component-wise approximate equality.

bool Argos::Vector3D::operator== (
    const  Vector3D & vector
) const

Two vectors are considered equal when each component differs by less than the machine epsilon of the underlying scalar type. The reference epsilon is stored in a local float, which may narrow the tolerance when T is double.

Parameters:

  • vector The second vector to compare.

Returns:

True if every component is within epsilon of the other vector.


function operator^

Cross product of this vector with another vector.

Vector3D Argos::Vector3D::operator^ (
    const  Vector3D & vector
) const

Parameters:

  • vector The second vector.

Returns:

A new Vector3D equal to the cross product.


function operator^=

In-place cross product of this vector with another vector.

Vector3D & Argos::Vector3D::operator^= (
    const  Vector3D & vector
) 

Parameters:

  • vector The second vector.

Returns:

Reference to this vector after the cross product.



The documentation for this class was generated from the following file include/mesh/Vector3D.h