OpenGLPrakt --> math

class cVertex

A class for easy matrix math.

Always remember: This class might be used a lot and during time-critical operations. Thus, it's optimized for speed, which has the consequence that it cannot be derived from this class.

Source:
../src/cVertex.hh:30

Constructors Index

cVertex
[public] default constructor (initializes to zero)
cVertex
[public] constructor accepting a vertex split into it's components


Methods Index

Assign
[public] assign a new value to all three components (it's basically superfluous)
CrossProd
[public] calculate cross product of two given vertices
CrossProd
[public] calculate cross product (does not change class)
GetLength
[public] determine length of vertex
GetX
[public] query current x component of vector
GetY
[public] query current y component of vector
GetZ
[public] query current z component of vector
Invert
[public] invert direction of vector by inverting all its components
Normalize
[public] normalize the vertex (make it length 1)
operator *
[public] operator for multiplying any cVertex with a scalar
operator *
[public] operator to multiply two cVertex objects (dot product)
operator *=
[public] operator for scaling by a given value
operator +
[public] operator to add two cVertex objects
operator +=
[public] operator for adding two cVertex objects
operator -
[public] operator for subtracting two cVertex objects
operator -=
[public] operator for subtracting two cVertex objects
operator []
[public] operator to retrieve a component of an cVertex by index
operator GLfloat*
[public] converting to GLfloat *
SetZero
[public] set vertex to zero vector
Translate
[public] convenience function: translate by given vertex


Constructors

cVertex

public cVertex ( ) ;

default constructor (initializes to zero)

cVertex

public cVertex ( GLfloat vx ,
                 GLfloat vy ,
                 GLfloat vz ) ;

constructor accepting a vertex split into it's components

Parameters:
vx n.x component
vy n.y component
vz n.z component

Methods

operator *=

public inline cVertex & operator *= ( const GLfloat s ) ;

operator for scaling by a given value

Parameters:
s scale factor

operator +=

public inline cVertex & operator += ( const cVertex & v ) ;

operator for adding two cVertex objects

Parameters:
v cVertex to add

operator -=

public inline cVertex & operator -= ( const cVertex & v ) ;

operator for subtracting two cVertex objects

Parameters:
v cVertex to subtract

operator *

public inline cVertex operator * ( const GLfloat s ) const ;

operator for multiplying any cVertex with a scalar

Parameters:
s value to scale by

operator +

public inline cVertex operator + ( const cVertex & v ) const ;

operator to add two cVertex objects

Parameters:
v cVertex object to add

operator -

public inline cVertex operator - ( const cVertex & v ) const ;

operator for subtracting two cVertex objects

Parameters:
v cVertex object to substract

operator *

public inline GLfloat operator * ( const cVertex & v ) const ;

operator to multiply two cVertex objects (dot product)

Parameters:
v cVertex to calculate dot product with

Return:
dot product of the two cVertex's

operator []

public inline GLfloat & operator [ ] ( const int idx ) ;

operator to retrieve a component of an cVertex by index

Parameters:
idx index of value (0 = x, 1 = y, 2 = z)

operator GLfloat*

public inline operator GLfloat * ( ) ;

converting to GLfloat *

Assign

public inline cVertex Assign ( GLfloat vx ,
                               GLfloat vy ,
                               GLfloat vz ) ;

assign a new value to all three components (it's basically superfluous)

Parameters:
vx n.x component
vy n.y component
vz n.z component

Normalize

public inline cVertex & Normalize ( ) ;

normalize the vertex (make it length 1)

Return:
reference to normalized cVertex

Translate

public inline void Translate ( GLfloat tx ,
                               GLfloat ty ,
                               GLfloat tz ) ;

convenience function: translate by given vertex

Parameters:
tx n.x component
ty n.y component
tz n.z component

Invert

public inline cVertex & Invert ( ) ;

invert direction of vector by inverting all its components

Return:
reference to inverted cVertex

CrossProd

public inline cVertex CrossProd ( const cVertex & v1 ,
                                  const cVertex & v2 ) const ;

calculate cross product of two given vertices

Parameters:
v1 first vertex
v2 second vertex

Return:
cVertex object

CrossProd

public inline cVertex CrossProd ( const cVertex & v ) const ;

calculate cross product (does not change class)

Parameters:
v vector to calculate cross product with

Return:
a cVertex object

SetZero

public inline void SetZero ( ) ;

set vertex to zero vector

GetX

public inline GLfloat GetX ( ) const ;

query current x component of vector

Return:
GLfloat - value of x component

GetY

public inline GLfloat GetY ( ) const ;

query current y component of vector

Return:
GLfloat - value of y component

GetZ

public inline GLfloat GetZ ( ) const ;

query current z component of vector

Return:
GLfloat - value of z component

GetLength

public inline GLfloat GetLength ( ) const ;

determine length of vertex

Return:
length of vertex

This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to submit a bug report or feature request.

Click here to return to the top of the page.