Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::TVector4< T > Struct Template Reference

Parameterizable four-dimensional vector data structure. More...

#include <mitsuba/mitsuba.h>

Public Types

typedef T Scalar
 
typedef TPoint4< T > PointType
 
typedef detail::VectorLength
< T, std::numeric_limits< T >
::is_integer >::type 
LengthType
 

Public Member Functions

 TVector4 ()
 Construct a new vector without initializing it. More...
 
 TVector4 (T x, T y, T z, T w)
 Initialize the vector with the specified X, Y and Z components. More...
 
 TVector4 (T val)
 Initialize all components of the the vector with the specified value. More...
 
template<typename T2 >
 TVector4 (const TVector4< T2 > &v)
 Initialize the vector with the components of another vector data structure. More...
 
template<typename T2 >
 TVector4 (const TPoint4< T2 > &p)
 Initialize the vector with the components of a point data structure. More...
 
 TVector4 (Stream *stream)
 Unserialize a vector from a binary data stream. More...
 
TVector4 operator+ (const TVector4 &v) const
 Add two vectors and return the result. More...
 
TVector4 operator- (const TVector4 &v) const
 Subtract two vectors and return the result. More...
 
TVector4operator+= (const TVector4 &v)
 Add another vector to the current one. More...
 
TVector4operator-= (const TVector4 &v)
 Subtract another vector from the current one. More...
 
TVector4 operator* (T f) const
 Multiply the vector by the given scalar and return the result. More...
 
TVector4operator*= (T f)
 Multiply the vector by the given scalar. More...
 
TVector4 operator- () const
 Return a negated version of the vector. More...
 
TVector4 operator/ (T f) const
 Divide the vector by the given scalar and return the result. More...
 
TVector4operator/= (T f)
 Divide the vector by the given scalar. More...
 
T & operator[] (int i)
 Index into the vector's components. More...
 
operator[] (int i) const
 Index into the vector's components (const version) More...
 
lengthSquared () const
 Return the squared 2-norm of this vector. More...
 
LengthType length () const
 Return the 2-norm of this vector. More...
 
bool isZero () const
 Return whether or not this vector is identically zero. More...
 
bool operator== (const TVector4 &v) const
 Equality test. More...
 
bool operator!= (const TVector4 &v) const
 Inequality test. More...
 
void serialize (Stream *stream) const
 Serialize this vector to a binary data stream. More...
 
std::string toString () const
 Return a readable string representation of this vector. More...
 

Public Attributes

x
 
y
 
z
 
w
 

Static Public Attributes

static const int dim = 4
 Number of dimensions. More...
 

Detailed Description

template<typename T>
struct mitsuba::TVector4< T >

Parameterizable four-dimensional vector data structure.

Member Typedef Documentation

template<typename T>
typedef detail::VectorLength<T, std::numeric_limits<T>::is_integer>::type mitsuba::TVector4< T >::LengthType
template<typename T>
typedef TPoint4<T> mitsuba::TVector4< T >::PointType
template<typename T>
typedef T mitsuba::TVector4< T >::Scalar

Constructor & Destructor Documentation

template<typename T>
mitsuba::TVector4< T >::TVector4 ( )
inline

Construct a new vector without initializing it.

This construtor is useful when the vector will either not be used at all (it might be part of a larger data structure) or initialized at a later point in time. Always make sure that one of the two is the case! Otherwise your program will do computations involving uninitialized memory, which will probably lead to a difficult-to-find bug.

template<typename T>
mitsuba::TVector4< T >::TVector4 ( x,
y,
z,
w 
)
inline

Initialize the vector with the specified X, Y and Z components.

template<typename T>
mitsuba::TVector4< T >::TVector4 ( val)
inlineexplicit

Initialize all components of the the vector with the specified value.

template<typename T>
template<typename T2 >
mitsuba::TVector4< T >::TVector4 ( const TVector4< T2 > &  v)
inlineexplicit

Initialize the vector with the components of another vector data structure.

template<typename T>
template<typename T2 >
mitsuba::TVector4< T >::TVector4 ( const TPoint4< T2 > &  p)
inlineexplicit

Initialize the vector with the components of a point data structure.

template<typename T>
mitsuba::TVector4< T >::TVector4 ( Stream stream)
inlineexplicit

Unserialize a vector from a binary data stream.

Member Function Documentation

template<typename T>
bool mitsuba::TVector4< T >::isZero ( ) const
inline

Return whether or not this vector is identically zero.

template<typename T>
LengthType mitsuba::TVector4< T >::length ( ) const
inline

Return the 2-norm of this vector.

template<typename T>
T mitsuba::TVector4< T >::lengthSquared ( ) const
inline

Return the squared 2-norm of this vector.

template<typename T>
bool mitsuba::TVector4< T >::operator!= ( const TVector4< T > &  v) const
inline

Inequality test.

template<typename T>
TVector4 mitsuba::TVector4< T >::operator* ( f) const
inline

Multiply the vector by the given scalar and return the result.

template<typename T>
TVector4& mitsuba::TVector4< T >::operator*= ( f)
inline

Multiply the vector by the given scalar.

template<typename T>
TVector4 mitsuba::TVector4< T >::operator+ ( const TVector4< T > &  v) const
inline

Add two vectors and return the result.

template<typename T>
TVector4& mitsuba::TVector4< T >::operator+= ( const TVector4< T > &  v)
inline

Add another vector to the current one.

template<typename T>
TVector4 mitsuba::TVector4< T >::operator- ( const TVector4< T > &  v) const
inline

Subtract two vectors and return the result.

template<typename T>
TVector4 mitsuba::TVector4< T >::operator- ( ) const
inline

Return a negated version of the vector.

template<typename T>
TVector4& mitsuba::TVector4< T >::operator-= ( const TVector4< T > &  v)
inline

Subtract another vector from the current one.

template<typename T>
TVector4 mitsuba::TVector4< T >::operator/ ( f) const
inline

Divide the vector by the given scalar and return the result.

template<typename T>
TVector4& mitsuba::TVector4< T >::operator/= ( f)
inline

Divide the vector by the given scalar.

template<typename T>
bool mitsuba::TVector4< T >::operator== ( const TVector4< T > &  v) const
inline

Equality test.

template<typename T>
T& mitsuba::TVector4< T >::operator[] ( int  i)
inline

Index into the vector's components.

template<typename T>
T mitsuba::TVector4< T >::operator[] ( int  i) const
inline

Index into the vector's components (const version)

template<typename T>
void mitsuba::TVector4< T >::serialize ( Stream stream) const
inline

Serialize this vector to a binary data stream.

template<typename T>
std::string mitsuba::TVector4< T >::toString ( ) const
inline

Return a readable string representation of this vector.

Member Data Documentation

template<typename T>
const int mitsuba::TVector4< T >::dim = 4
static

Number of dimensions.

template<typename T>
T mitsuba::TVector4< T >::w
template<typename T>
T mitsuba::TVector4< T >::x
template<typename T>
T mitsuba::TVector4< T >::y
template<typename T>
T mitsuba::TVector4< T >::z

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