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

4D Vector More...

#include <vector_4d.h>

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

Public Member Functions

Vector4D::TConstReference at (signed index) const
 Wrap index around range.
 
Vector4D::TReference at (signed index)
 Wrap index around range.
 
const Vector4D< T > & operator+ () const
 A weird way to get back the same object.
 
Vector4D< T > & operator+= (const Vector4D< T > &other)
 componentwise addition
 
Vector4D< T > & operator-= (const Vector4D< T > &other)
 componentwise subtraction
 
Vector4D< T > & operator*= (const Vector4D< T > &other)
 Componentwise multiplication.
 
Vector4D< T > & operator/= (const Vector4D< T > &other)
 Componentwise division.
 
Vector4D< T > & operator+= (TParam other)
 add other to each component of this.
 
Vector4D< T > & operator-= (TParam other)
 subtract other of each component of this.
 
Vector4D< T > & operator*= (TParam other)
 multiply each component of this with other.
 
Vector4D< 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.
 
const Vector4D< T > normal () const
 return a unit vector with same direction/sense as this vector.
 
const Vector4D< T > project (const Vector4D< T > &other) const
 Project vector on this one.
 
const Vector4D< T > reject (const Vector4D< T > &other) const
 Project vector on this one.
 
const Vector4D< T > transform (T(*op)(T)) const
 apply a function to every component
 
void normalize ()
 Normalize vector.
 

Related Symbols

(Note that these are not member symbols.)

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

Detailed Description

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

4D Vector

Author
BdG
Date
2003

Definition at line 70 of file vector_4d.h.

Member Function Documentation

◆ normal()

template<typename T>
const Vector4D< T > lass::prim::Vector4D< 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 323 of file vector_4d.inl.

References normal(), and normalize().

Referenced by normal().


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