Class 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:
TThe type of the vector coordinates.
Public Attributes Documentation
variable x
First coordinate
variable y
Second coordinate
variable z
Third coordinate
Public Functions Documentation
function Vector3D [1/2]
Construct a zero vector.
function Vector3D [2/2]
Construct a vector from its three coordinates.
Parameters:
xThe coordinates of the 3-dimensional vector.
function norm
Euclidean norm of this vector.
Returns:
The Euclidean norm (square root of the sum of squared components).
function normSquared
Squared Euclidean norm of this vector.
Returns:
The sum of the squared components (no square root).
function normalized
Return a unit-length vector pointing in the same direction.
Returns:
A new Vector3D equal to this vector divided by its norm.
function operator!=
Component-wise approximate inequality.
See operator== for the epsilon tolerance.
Parameters:
vectorThe 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.
Parameters:
scalThe scalar multiplier.
Returns:
A new Vector3D with each component multiplied by scal.
function operator*
Dot product of this vector with another vector.
Parameters:
vectorThe second vector.
Returns:
The dot product (sum of the component-wise products).
function operator*=
In-place scalar multiplication of this vector.
Parameters:
scalThe scalar multiplier.
Returns:
Reference to this vector after the multiplication.
function operator+
Component-wise addition of two vectors.
Parameters:
vectorThe right-hand side vector.
Returns:
A new Vector3D equal to the component-wise sum.
function operator+=
In-place component-wise addition of another vector.
Parameters:
vectorThe 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.
Parameters:
vectorThe right-hand side vector.
Returns:
A new Vector3D equal to the component-wise difference.
function operator-=
In-place component-wise subtraction of another vector.
Parameters:
vectorThe vector to subtract from this one.
Returns:
Reference to this vector after the subtraction.
function operator/
Division of this vector by a scalar.
Parameters:
scalThe scalar divisor (must be non-zero).
Returns:
A new Vector3D with each component divided by scal.
Exception:
std::overflow_errorifscalis zero.
function operator/=
In-place scalar division of this vector.
Parameters:
scalThe scalar divisor (must be non-zero).
Returns:
Reference to this vector after the division.
Exception:
std::overflow_errorifscalis zero.
function operator==
Component-wise approximate equality.
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:
vectorThe 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.
Parameters:
vectorThe second vector.
Returns:
A new Vector3D equal to the cross product.
function operator^=
In-place cross product of this vector with another vector.
Parameters:
vectorThe 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