Library of Assembled Shared Sources
lass::prim::Vector3D< T > Struct Template Reference

3D Vector More...

#include <vector_3d.h>

Inheritance diagram for lass::prim::Vector3D< T >:

Public Member Functions

Vector3D::TConstReference at (signed index) const
 Wrap index around range.
 
Vector3D::TReference at (signed index)
 Wrap index around range.
 
const Vector3D< T > & operator+ () const
 A weird way to get back the same object.
 
Vector3D< T > & operator+= (const Vector3D< T > &other)
 componentwise addition
 
Vector3D< T > & operator-= (const Vector3D< T > &other)
 componentwise subtraction
 
Vector3D< T > & operator*= (const Vector3D< T > &other)
 Componentwise multiplication.
 
Vector3D< T > & operator/= (const Vector3D< T > &other)
 Componentwise division.
 
Vector3D< T > & operator+= (TParam other)
 add other to each component of this.
 
Vector3D< T > & operator-= (TParam other)
 subtract other of each component of this.
 
Vector3D< T > & operator*= (TParam other)
 multiply each component of this with other.
 
Vector3D< T > & operator/= (TParam other)
 divide each component of this by other.
 
bool isZero () const
 Return true if all the components are (exactly!) zero.
 
bool isNaN () const
 Return true if at least one of the components is NaN.
 
const TValue squaredNorm () const
 Return squared norm of vector.
 
const TValue norm () const
 Return norm of vector.
 
XYZ majorAxis () const
 Return axis with the greatest absolute value.
 
const Vector3D< T > normal () const
 return a unit vector with same direction/sense as this vector.
 
const Vector3D< T > reciprocal () const
 return the reciprocal version of this vector
 
const Vector3D< T > project (const Vector3D< T > &other) const
 Project vector on this one.
 
const Vector3D< T > reject (const Vector3D< T > &other) const
 Reject vector from this one.
 
const Vector3D< T > transform (T(*op)(T)) const
 apply a function to every component
 
void normalize ()
 Normalize vector.
 

Static Public Member Functions

template<class RandomGenerator>
static Vector3D< T > random (RandomGenerator &generator)
 Random unit vector.
 

Related Symbols

(Note that these are not member symbols.)

template<typename T>
Vector3D< T >::TValue dot (const Vector3D< T > &a, const Vector3D< T > &b)
 dot product.
 
template<typename T>
Vector3D< T > cross (const Vector3D< T > &a, const Vector3D< T > &b)
 cross product
 
template<typename T>
Vector3D< T > operator+ (const Vector3D< T > &a, const Vector3D< T > &b)
 componentwise addition
 
template<typename T>
Vector3D< T > operator- (const Vector3D< T > &a, const Vector3D< T > &b)
 componentwise subtraction
 
template<typename T>
Vector3D< T > operator* (const Vector3D< T > &a, const Vector3D< T > &b)
 Componentwise multiplication.
 
template<typename T>
Vector3D< T > operator/ (const Vector3D< T > &a, const Vector3D< T > &b)
 Componentwise division.
 
template<typename T>
Vector3D< T > operator+ (const Vector3D< T > &a, typename Vector3D< T >::TParam b)
 add b to all components of a.
 
template<typename T>
Vector3D< T > operator- (const Vector3D< T > &a, typename Vector3D< T >::TParam b)
 subtract b of all components of a.
 
template<typename T>
Vector3D< T > operator* (const Vector3D< T > &a, typename Vector3D< T >::TParam b)
 muliply all components of a by b
 
template<typename T>
Vector3D< T > operator/ (const Vector3D< T > &a, typename Vector3D< T >::TParam b)
 divide all components of a by b
 
template<typename T>
Vector3D< T > operator+ (typename Vector3D< T >::TParam a, const Vector3D< T > &b)
 add a to all components of b
 
template<typename T>
Vector3D< T > operator- (typename Vector3D< T >::TParam a, const Vector3D< T > &b)
 subtract a of all components of b
 
template<typename T>
Vector3D< T > operator* (typename Vector3D< T >::TParam a, const Vector3D< T > &b)
 multiply all components of b with a
 
template<typename T>
Vector3D< T > pointwiseMin (const Vector3D< T > &a, const Vector3D< T > &b)
 return a vector with, for each coordinate, the minimum value of a and b
 
template<typename T>
Vector3D< T > pointwiseMax (const Vector3D< T > &a, const Vector3D< T > &b)
 return a vector with, for each coordinate, the maximum value of a and b
 
template<typename T>
Vector3D< T > lerp (const Vector3D< T > &a, const Vector3D< T > &b, typename Vector3D< T >::TParam t)
 interpolate linearly between two vectors: a + t * (b - a)
 

Detailed Description

template<typename T>
struct lass::prim::Vector3D< T >

3D Vector

Author
BdG
Date
2003

Definition at line 72 of file vector_3d.h.

Member Function Documentation

◆ normal()

template<typename T>
const Vector3D< T > lass::prim::Vector3D< T >::normal ( ) const

return a unit vector with same direction/sense as this vector.

The normalized vector of X is a vector in the same direction but with norm (length) 1. It is denoted X^ and given by X^ = X / |X|, http://mathworld.wolfram.com/NormalizedVector.html.

Definition at line 335 of file vector_3d.inl.

References normal(), and normalize().

Referenced by normal(), lass::prim::Transformation3D< T >::rotation(), lass::prim::SimplePolygon3D< T, PlaneEquationPolicy, PlaneNormalizingPolicy >::signedArea(), and lass::prim::SimplePolygon3D< T, PlaneEquationPolicy, PlaneNormalizingPolicy >::surfaceCentroid().


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