IrradianceCache::Node Class Reference

#include <IrradianceCache.h>

List of all members.

Public Member Functions

 Node (float s, float cX, float cY, float cZ)
virtual ~Node ()
void addValue (const Vector3 &position, const Vector3 &normal, const Vector3 &color, float meanDistance, float minSize, float maxSize)
void getValue (const Vector3 &position, const Vector3 &normal, vector< IrradianceCache::Value * > &buffer, float maxError)
unsigned int getNumStoredValues () const
unsigned int getNumNodes () const
float getSize () const
void getNodeValues (vector< vector< IrradianceCache::Value * > * > &irValues)

Protected Member Functions

void allocate (unsigned int nodeIndex)
bool isAllocated (unsigned int nodeIndex) const
unsigned int selectSubnode (const Vector3 &position) const
bool necessaryToSearch (const Vector3 &position) const

Protected Attributes

vector< IrradianceCache::Value * > irradianceValues
 irradiance values stored in the node
Nodesubnodes [8]
 eight children or NULL
const Vector3 center
 center of the node
const float size
 legth of side


Detailed Description

Definition at line 252 of file IrradianceCache.h.


Constructor & Destructor Documentation

Node float  s,
float  cX,
float  cY,
float  cZ
 

Parameters:
s legth of node's side
cX X coord. of the center of the node
cY Y coord. of the center of the node
cZ Z coord. of the center of the node

Definition at line 309 of file IrradianceCache.cc.

References IrradianceCache::Node::subnodes.

Referenced by IrradianceCache::Node::allocate().

~Node  )  [virtual]
 

Destructor.

Definition at line 317 of file IrradianceCache.cc.

References IrradianceCache::Node::irradianceValues.


Member Function Documentation

void addValue const Vector3 position,
const Vector3 normal,
const Vector3 color,
float  meanDistance,
float  minSize,
float  maxSize
 

Stores irradiance value in the node or its sub-node

Parameters:
position irradiance position
normal normalized normal vector or irradiance value
color irradiance (RGB)
meanDistance harmonic mean distance of objects visible from the irradiance position
minSize = 2 * maxError * meanDistance
maxSize = 4 * maxError * meanDistance

Definition at line 334 of file IrradianceCache.cc.

References IrradianceCache::Node::addValue(), IrradianceCache::Node::allocate(), IrradianceCache::Node::irradianceValues, IrradianceCache::Node::isAllocated(), IrradianceCache::Node::selectSubnode(), IrradianceCache::Node::size, and IrradianceCache::Node::subnodes.

Referenced by IrradianceCache::Node::addValue().

void allocate unsigned int  nodeIndex  )  [protected]
 

Allocates memory for the child at index nodeIndex.

Parameters:
nodeIndex index of the child

Definition at line 205 of file IrradianceCache.cc.

References IrradianceCache::Node::center, IrradianceCache::Node::Node(), IrradianceCache::Node::size, and IrradianceCache::Node::subnodes.

Referenced by IrradianceCache::Node::addValue().

void getNodeValues vector< vector< IrradianceCache::Value * > * > &  irValues  ) 
 

Returnes pointers to containers of irradiance values of the node all its sub-nodes.

Parameters:
irValues container of pointers to containers of irradiance values

Definition at line 412 of file IrradianceCache.cc.

References IrradianceCache::Node::irradianceValues, IrradianceCache::Node::isAllocated(), and IrradianceCache::Node::subnodes.

Referenced by IrradianceCache::getNextValuePointer().

unsigned int getNumNodes  )  const
 

Returns:
number of subnodes

Definition at line 403 of file IrradianceCache.cc.

References IrradianceCache::Node::isAllocated(), and IrradianceCache::Node::subnodes.

Referenced by IrradianceCache::getNumNodes().

unsigned int getNumStoredValues  )  const
 

Returns:
number of stored irradiance values in the node and all its sub-nodes

Definition at line 391 of file IrradianceCache.cc.

References IrradianceCache::Node::irradianceValues, IrradianceCache::Node::isAllocated(), and IrradianceCache::Node::subnodes.

Referenced by IrradianceCache::getNumStoredValues().

float getSize  )  const [inline]
 

Returns:
legth of side of the node

Definition at line 373 of file IrradianceCache.h.

Referenced by IrradianceCache::isInside().

void getValue const Vector3 position,
const Vector3 normal,
vector< IrradianceCache::Value * > &  buffer,
float  maxError
 

In the node and all its sub-nodes finds irradiance values that are valid for given 3D point. Values are stored in the buffer container.

Parameters:
position position of the point in space
normal normalized normal vector at the point in space
buffer container with found irradiance values
maxError user-defined constat, which inverse restricts domain of irradiance value
Returns:
1 if the octree contains irradiance value identical to given 3D point (location and normal); in such case the buffer container contains only this single value; 0 otherwise

Definition at line 367 of file IrradianceCache.cc.

References IrradianceCache::Node::irradianceValues.

bool isAllocated unsigned int  nodeIndex  )  const [inline, protected]
 

Checks whether the sub-node exists.

Parameters:
nodeIndex index of the sub-node
Returns:
true if sub-node already exists, false otherwise

Definition at line 274 of file IrradianceCache.h.

Referenced by IrradianceCache::Node::addValue(), IrradianceCache::Node::getNodeValues(), IrradianceCache::Node::getNumNodes(), and IrradianceCache::Node::getNumStoredValues().

bool necessaryToSearch const Vector3 position  )  const [protected]
 

Determines whether the node contains any irradiance value which has a valid domain interfering with the given 3D point.

Parameters:
position point in space
Exceptions:
out_of_range if nodeIndex is not in between 0 and 7
Returns:
true if the node contains valid irradiance value(s), false otherwise

Definition at line 302 of file IrradianceCache.cc.

References IrradianceCache::Node::center, and IrradianceCache::Node::size.

unsigned int selectSubnode const Vector3 position  )  const [protected]
 

Having a 3D point determines in which sub-node the point lies.

Parameters:
position point in space; the point have to lie inside the root of the octree
Returns:
index of the sub-node (from 0 to 7)

Definition at line 256 of file IrradianceCache.cc.

References IrradianceCache::Node::center.

Referenced by IrradianceCache::Node::addValue().


Member Data Documentation

const Vector3 center [protected]
 

center of the node

Definition at line 256 of file IrradianceCache.h.

Referenced by IrradianceCache::Node::allocate(), IrradianceCache::Node::necessaryToSearch(), and IrradianceCache::Node::selectSubnode().

vector<IrradianceCache::Value*> irradianceValues [protected]
 

irradiance values stored in the node

Definition at line 254 of file IrradianceCache.h.

Referenced by IrradianceCache::Node::addValue(), IrradianceCache::Node::getNodeValues(), IrradianceCache::Node::getNumStoredValues(), IrradianceCache::Node::getValue(), and IrradianceCache::Node::~Node().

const float size [protected]
 

legth of side

Definition at line 257 of file IrradianceCache.h.

Referenced by IrradianceCache::Node::addValue(), IrradianceCache::Node::allocate(), and IrradianceCache::Node::necessaryToSearch().

Node* subnodes[8] [protected]
 

eight children or NULL

Definition at line 255 of file IrradianceCache.h.

Referenced by IrradianceCache::Node::addValue(), IrradianceCache::Node::allocate(), IrradianceCache::Node::getNodeValues(), IrradianceCache::Node::getNumNodes(), IrradianceCache::Node::getNumStoredValues(), and IrradianceCache::Node::Node().


The documentation for this class was generated from the following files:
Generated on Wed Jun 28 12:24:33 2006 for esg by  doxygen 1.4.6