Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

vlNormal< T > Class Template Reference

vlNormal is the implementation of a normal for OpenVL. More...

#include <vlnormal.h>

Inheritance diagram for vlNormal< T >:

vlVector< T > vlTriple< T > List of all members.

Public Member Functions

 vlNormal (T const &x=0, T const &y=0, T const &z=0)
 default constructor

 vlNormal (vlTriple< T > const &triple)
 Constructor when a triple is given as input.

 ~vlNormal ()
 default destructor

x () const
 get value of x

y () const
 get value of y

z () const
 get value of z

template<class S> void x (const S &value)
 set value of x

template<class S> void y (const S &value)
 set value of y

template<class S> void z (const S &value)
 set value of z

vlNormal< T > operator- () const
 multiples triple elements with -1

vlNormal< T > operator+ (vlTriple< T > const &other) const
 adds another triple to self and returns the sum

vlNormal< T > operator+ (T const &value) const
 adds a const value to self and returns the sum

vlNormal< T > operator- (vlTriple< T > const &other) const
 subtracts another triple from self and returns the result

vlNormal< T > operator- (T const &value) const
 subtracts a const value from self and returns the result

vlNormal< T > & operator+= (vlTriple< T > const &other)
 adds another triple to self

vlNormal< T > & operator-= (vlTriple< T > const &other)
 subtracts another triple from self

void operator *= (T const &value)
 multiples self with a const

void operator/= (T const &value)
 devides self with a const

vlNormal< T > operator * (T const &value) const
 multiples self with other and returns the result

vlNormal< T > operator/ (T const &value) const
 divides other from self and returns the result

vlNormal< T > cross (vlVector< T > const &other) const
 does a cross product between self and other

void clamp (T const &min, T const &max)
 clamps the vector to the given range

void scale (vlVector< T > const &other)
 scales the vector using other


Detailed Description

template<class T>
class vlNormal< T >

This class inherits from vlVector, which in turn is inherited from vlTriple. This class re-implements all the functions which require a call of normalize to re-normalize the normal after changes (+, -, * etc.). This class also allows you to access the member variables directly. The only advantage of direct access is speed.. so when you need raw speed, use this feature. In all other cases, do not access the member variables directly. Be careful because you could modify either of m_x, m_y, m_z directly and your normal won't be a normal anymore. Whereas, using access functions x(), y() and z(), its guarenteed that your normal always remains a normal.

Rule of Thumb: Always use access functions, unless the speed is really bothering you.

Author:
Sarang Lakare
See also:
vlVector

Definition at line 53 of file vlnormal.h.


Constructor & Destructor Documentation

template<class T>
vlNormal< T >::vlNormal T const &  x = 0,
T const &  y = 0,
T const &  z = 0
 

Parameters:
T data type.
x the x value.
y the y value.
z the z value

Definition at line 142 of file vlnormal.h.

References vlVector< T >::normalize(), x, y, and z.

Referenced by vlNormal< T >::operator *(), and vlNormal< T >::operator/().

template<class T>
vlNormal< T >::vlNormal vlTriple< T > const &  triple  ) 
 

Definition at line 150 of file vlnormal.h.

References vlVector< T >::normalize().

template<class T>
vlNormal< T >::~vlNormal  ) 
 

Parameters:
T data type.

Definition at line 163 of file vlnormal.h.


Member Function Documentation

template<class T>
void vlNormal< T >::clamp T const &  min,
T const &  max
[inline]
 

Parameters:
min the minimum value to clamp to.
max the maximum value to clamp to.

Reimplemented from vlVector< T >.

Definition at line 380 of file vlnormal.h.

template<class T>
vlNormal< T > vlNormal< T >::cross vlVector< T > const &  other  )  const [inline]
 

Parameters:
other the other vector to do cross product with.
Returns:
the resultant vector.

Definition at line 365 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, and vlTriple< T >::m_z.

template<class T>
vlNormal< T > vlNormal< T >::operator * T const &  value  )  const [inline]
 

Parameters:
T data type.
constValue the constValue vector to multiply.
Returns:
another triple with the result.

Definition at line 337 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, vlTriple< T >::m_z, and vlNormal< T >::vlNormal().

template<class T>
void vlNormal< T >::operator *= T const &  value  )  [inline]
 

Parameters:
T data type.
constValue the constValue vector to multiply.
Returns:
self with the new value.

Definition at line 270 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, vlTriple< T >::m_z, and vlVector< T >::normalize().

template<class T>
vlNormal< T > vlNormal< T >::operator+ T const &  value  )  const [inline]
 

Parameters:
T data type.
constValue the constant value to add.
Returns:
another triple with the sum.

Reimplemented from vlTriple< T >.

Definition at line 201 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, and vlTriple< T >::m_z.

template<class T>
vlNormal< T > vlNormal< T >::operator+ vlTriple< T > const &  other  )  const [inline]
 

Parameters:
T data type.
other the other triple.
Returns:
another normal with the sum.

Definition at line 188 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, and vlTriple< T >::m_z.

template<class T>
vlNormal< T > & vlNormal< T >::operator+= vlTriple< T > const &  other  )  [inline]
 

Parameters:
T data type.
other the other triple.
Returns:
self with the new value.

Definition at line 240 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, vlTriple< T >::m_z, and vlVector< T >::normalize().

template<class T>
vlNormal< T > vlNormal< T >::operator- T const &  value  )  const [inline]
 

Parameters:
T data type.
constValue the constant value to subtract.
Returns:
another triple with the result.

Definition at line 227 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, and vlTriple< T >::m_z.

template<class T>
vlNormal< T > vlNormal< T >::operator- vlTriple< T > const &  other  )  const [inline]
 

Parameters:
T data type.
other the other triple.
Returns:
another triple with the result.

Definition at line 214 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, and vlTriple< T >::m_z.

template<class T>
vlNormal< T > vlNormal< T >::operator-  )  const [inline]
 

Parameters:
T data type
Returns:
another normal with the result.

Reimplemented from vlTriple< T >.

Definition at line 175 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, and vlTriple< T >::m_z.

template<class T>
vlNormal< T > & vlNormal< T >::operator-= vlTriple< T > const &  other  )  [inline]
 

Parameters:
T data type.
other the other triple.
Returns:
self with the new value.

Definition at line 255 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, vlTriple< T >::m_z, and vlVector< T >::normalize().

template<class T>
vlNormal< T > vlNormal< T >::operator/ T const &  value  )  const [inline]
 

Parameters:
T data type.
constValue the constValue vector to devide with.
Returns:
another triple with the result.

Definition at line 350 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, vlTriple< T >::m_z, and vlNormal< T >::vlNormal().

template<class T>
void vlNormal< T >::operator/= T const &  value  )  [inline]
 

Parameters:
T data type.
constValue the constValue vector to divide.
Returns:
self with the new value.

Definition at line 287 of file vlnormal.h.

References vlTriple< T >::m_x, vlTriple< T >::m_y, vlTriple< T >::m_z, and vlVector< T >::normalize().

template<class T>
void vlNormal< T >::scale vlVector< T > const &  other  )  [inline]
 

Parameters:
other the other vector to scale the current with.

Reimplemented from vlVector< T >.

Definition at line 392 of file vlnormal.h.

template<class T>
template<class S>
void vlNormal< T >::x const S &  value  )  [inline]
 

Reimplemented from vlTriple< T >.

Definition at line 76 of file vlnormal.h.

template<class T>
T vlNormal< T >::x  )  const [inline]
 

Reimplemented from vlTriple< T >.

Definition at line 66 of file vlnormal.h.

template<class T>
template<class S>
void vlNormal< T >::y const S &  value  )  [inline]
 

Reimplemented from vlTriple< T >.

Definition at line 80 of file vlnormal.h.

template<class T>
T vlNormal< T >::y  )  const [inline]
 

Reimplemented from vlTriple< T >.

Definition at line 69 of file vlnormal.h.

template<class T>
template<class S>
void vlNormal< T >::z const S &  value  )  [inline]
 

Reimplemented from vlTriple< T >.

Definition at line 84 of file vlnormal.h.

template<class T>
T vlNormal< T >::z  )  const [inline]
 

Reimplemented from vlTriple< T >.

Definition at line 72 of file vlnormal.h.


The documentation for this class was generated from the following file:
Generated on Fri Mar 18 11:33:19 2005 for OpenVL by doxygen 1.3.3