CVector3f Class Reference
[Utility classes]

This class represents a 3D vector (with float precision) class. More...

#include <CVector3f.h>

List of all members.

Public Member Functions

 CVector3f (float a=0, float b=0, float c=0)
 CVector3f (const CVector3f &v)
float & operator[] (int i)
float Norm () const
void Normalize ()
CVector3f operator+ (const CVector3f &v) const
CVector3f operator- (const CVector3f &v) const
float operator * (const CVector3f &v) const
CVector3f operator^ (const CVector3f &v) const
CVector3f operator * (float k) const
CVector3f operator/ (float k) const
CVector3f operator>> (const CVector3f &v) const
CVector3f operator- () const
CVector3foperator+= (const CVector3f &v)
CVector3foperator-= (const CVector3f &v)
CVector3foperator^= (const CVector3f &v)
CVector3foperator *= (float k)
CVector3foperator/= (float k)
CVector3foperator>>= (const CVector3f &v)

Public Attributes

float x
float y
float z

Friends

CVector3f operator * (float k, const CVector3f &v)


Detailed Description

This class represents a 3D vector (with float precision) class.

Definition at line 20 of file CVector3f.h.


Constructor & Destructor Documentation

CVector3f::CVector3f ( float  a = 0,
float  b = 0,
float  c = 0 
) [inline]

The CVector3f class parameter constructor. It does only simple member assignment.

Definition at line 31 of file CVector3f.h.

References x, y, and z.

Referenced by operator *(), operator+(), operator-(), operator/(), operator>>(), operator^(), and operator^=().

CVector3f::CVector3f ( const CVector3f v  )  [inline]

The CVector3f class copy constructor. It does only simple member assignment.

Definition at line 38 of file CVector3f.h.

References x, y, and z.


Member Function Documentation

float& CVector3f::operator[] ( int  i  )  [inline]

This operator return a reference to the coordinate corresponding to the index.

Definition at line 45 of file CVector3f.h.

References x, y, and z.

float CVector3f::Norm (  )  const [inline]

This function calculates the lenght of the vector.

$ | \vec{a} | = \sqrt{a_x^2 + a_y^2 + a_z^2}$.

Definition at line 61 of file CVector3f.h.

References x, y, and z.

Referenced by CRenderObj::GetPixelColor(), and CRenderObj::GetStartingPoint().

void CVector3f::Normalize (  )  [inline]

This function normalizes the vector.

$ normalized( \vec{a} ) = \left ( \frac{a_x}{| \vec{a} | } , \frac{a_y}{| \vec{a} | } , \frac{a_z}{| \vec{a} | } \right ) $.

Definition at line 71 of file CVector3f.h.

References x, y, and z.

Referenced by CRenderObj::GetPixelColor(), and CVectBase::Update().

CVector3f CVector3f::operator+ ( const CVector3f v  )  const [inline]

This operator adds two vectors.

$ \vec{a} + \vec{b} = \left ( a_x+b_x , a_y+b_y , a_z+b_z \right ) $

Definition at line 80 of file CVector3f.h.

References CVector3f(), x, y, and z.

CVector3f CVector3f::operator- ( const CVector3f v  )  const [inline]

This operator substracts two vectors.

$ \vec{a} - \vec{b} = \left ( a_x-b_x , a_y-b_y , a_z-b_z \right ) $

Definition at line 90 of file CVector3f.h.

References CVector3f(), x, y, and z.

float CVector3f::operator * ( const CVector3f v  )  const [inline]

This operator returns the dot product of two vectors.

$ \vec{a} \cdot \vec{b} = a_x b_x + a_y b_y + a_z b_z $.

Definition at line 100 of file CVector3f.h.

References x, y, and z.

CVector3f CVector3f::operator^ ( const CVector3f v  )  const [inline]

This operator returns the cross product of two vectors.

$ \vec{a} \times \vec{b} = \left | \begin{array}{ccc} \vec{i} & \vec{j} & \vec{k} \\ a_x & a_y & a_z \\ b_x & b_y & b_z \end{array} \right | = \left ( a_y b_z - a_z b_y , a_z b_x - a_x b_z , a_x b_y - a_y b_z \right ) $

Definition at line 117 of file CVector3f.h.

References CVector3f(), x, y, and z.

CVector3f CVector3f::operator * ( float  k  )  const [inline]

This operator returns the product of a vector and a scalar.

$ k \vec{a} = \left ( k a_x , k a_y , k a_z \right ) $

Definition at line 127 of file CVector3f.h.

References CVector3f(), x, y, and z.

CVector3f CVector3f::operator/ ( float  k  )  const [inline]

This operator returns a vector divised by a scalar.

$ \frac{\vec{a}}{k} = \left ( \frac{a_x}{k} , \frac{a_y}{k} , \frac{a_z}{k} \right ) $

Definition at line 139 of file CVector3f.h.

References CVector3f(), x, y, and z.

CVector3f CVector3f::operator>> ( const CVector3f v  )  const [inline]

This operator projects a vector on another one.

$ \vec{a} _{\vec{b}} = \frac{ \vec{a} \cdot \vec{b}} { \vec{b} \cdot \vec{b}} \vec{b} $

Definition at line 150 of file CVector3f.h.

References CVector3f(), x, y, and z.

CVector3f CVector3f::operator- (  )  const [inline]

This operator returns the opposite of a vector

$ - \vec{a} = \left ( - a_x, - a_y, - a_z \right ) $

Definition at line 161 of file CVector3f.h.

References CVector3f(), x, y, and z.

CVector3f& CVector3f::operator+= ( const CVector3f v  )  [inline]

This operator is the same as + with an additionnal assignment.

Definition at line 170 of file CVector3f.h.

References x, y, and z.

CVector3f& CVector3f::operator-= ( const CVector3f v  )  [inline]

This operator is the same as - with an additionnal assignment.

Definition at line 181 of file CVector3f.h.

References x, y, and z.

CVector3f& CVector3f::operator^= ( const CVector3f v  )  [inline]

This operator is the same as ^ with an additionnal assignment.

Definition at line 192 of file CVector3f.h.

References CVector3f(), x, y, and z.

CVector3f& CVector3f::operator *= ( float  k  )  [inline]

This operator is the same as * with an additionnal assignment.

Definition at line 201 of file CVector3f.h.

References x, y, and z.

CVector3f& CVector3f::operator/= ( float  k  )  [inline]

This operator is the same as / with an additionnal assignment.

Definition at line 212 of file CVector3f.h.

References x, y, and z.

CVector3f& CVector3f::operator>>= ( const CVector3f v  )  [inline]

This operator is the same as >> with an additionnal assignment.

Definition at line 223 of file CVector3f.h.

References x, y, and z.


Friends And Related Function Documentation

CVector3f operator * ( float  k,
const CVector3f v 
) [friend]

This operator returns the product of a scalar and a vector.

$ \vec{a} k = \left ( k a_x , k a_y , k a_z \right ) $

Definition at line 240 of file CVector3f.h.


Member Data Documentation

float CVector3f::x

x coordinate.

Definition at line 23 of file CVector3f.h.

Referenced by CVariable::Compute(), CVector3f(), CRenderObj::GetCloseToBoundingBox(), CRenderObj::GetPixelColor(), CRenderObj::InBoundingBox(), Norm(), Normalize(), operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator>>(), operator>>=(), operator[](), operator^(), operator^=(), CVectBase::Update(), and CRenderObj::Validate().

float CVector3f::y

y coordinate.

Definition at line 24 of file CVector3f.h.

Referenced by CVariable::Compute(), CVector3f(), CRenderObj::GetCloseToBoundingBox(), CRenderObj::GetPixelColor(), CRenderObj::InBoundingBox(), Norm(), Normalize(), operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator>>(), operator>>=(), operator[](), operator^(), operator^=(), CVectBase::Update(), and CRenderObj::Validate().

float CVector3f::z

z coordinate.

Definition at line 25 of file CVector3f.h.

Referenced by CVariable::Compute(), CVector3f(), CRenderObj::GetCloseToBoundingBox(), CRenderObj::GetPixelColor(), CRenderObj::InBoundingBox(), Norm(), Normalize(), operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator>>(), operator>>=(), operator[](), operator^(), operator^=(), and CRenderObj::Validate().


The documentation for this class was generated from the following file:
Generated on Fri Dec 5 03:20:33 2008 for Mathematical Ray-tracer by  doxygen 1.5.4