PhotonMap Class Reference

#include <PhotonMap.h>

List of all members.

Public Member Functions

 PhotonMap ()
 PhotonMap (const vector< Photon > &photons)
virtual ~PhotonMap ()
virtual void set (const vector< Photon > &photons)
virtual unsigned numPhotons (void) const
virtual vector< Photon * > * getNeighbourhood (const Vector3 &spoint, const Vector3 *snormal, float maxdist, unsigned nphotons) const
virtual bool getIrradiance (const Vector3 &spoint, const Vector3 *snormal, float maxdist, unsigned nphotons, Vector3 &irrad) const
virtual PhotonsIteratoriterator () const

Protected Member Functions

void _build (const vector< Photon > &)
 declaration
void _median_split (Photon **, int, int, int, const int)
void _balance_segment (Photon **, Photon **, int, int, int)
void _locate_photons (NearestPhotons *const, unsigned) const

Protected Attributes

Photon_map
 compact kd-tree with photons
unsigned _storedPhotons
 number of photons in kd-tree
float _bboxMin [3]
 bounding box of the scene
float _bboxMax [3]

Friends

class Iterator

Classes

class  Iterator
class  NearestPhotons


Detailed Description

Basic photon map implementation without irradiance caching. Implementation is based on the original code of Henrik Wann Jensen. Photons are stored in static balanced k-d tree in very compact form (single array) consuming minimal memory. This kind of map is usefull mainly for caustics maps.

Definition at line 21 of file PhotonMap.h.


Constructor & Destructor Documentation

PhotonMap  ) 
 

Implicit constructor creating empty map, see set() method.

Definition at line 263 of file PhotonMap.cc.

References PhotonMap::_bboxMax, and PhotonMap::_bboxMin.

PhotonMap const vector< Photon > &  photons  ) 
 

Constructor.

Parameters:
photons Container of photons that will be stored in map.

Definition at line 270 of file PhotonMap.cc.

References PhotonMap::_build().

~PhotonMap  )  [virtual]
 

Destructor.

Definition at line 276 of file PhotonMap.cc.

References PhotonMap::_map.


Member Function Documentation

void _balance_segment Photon **  ,
Photon **  ,
int  ,
int  ,
int 
[protected]
 

Definition at line 109 of file PhotonMap.cc.

References PhotonMap::_bboxMax, PhotonMap::_bboxMin, PhotonMap::_median_split(), Photon::_plane, and Photon::_position.

void _build const vector< Photon > &   )  [protected]
 

declaration

Definition at line 7 of file PhotonMap.cc.

References PhotonMap::_bboxMax, PhotonMap::_bboxMin, PhotonMap::_map, and PhotonMap::_storedPhotons.

Referenced by PhotonMap::PhotonMap(), and PhotonMap::set().

void _locate_photons NearestPhotons const,
unsigned 
const [protected]
 

Definition at line 175 of file PhotonMap.cc.

References Photon::_plane, Photon::_position, PhotonMap::NearestPhotons::dist2, PhotonMap::NearestPhotons::found, PhotonMap::NearestPhotons::gotHeap, PhotonMap::NearestPhotons::index, PhotonMap::NearestPhotons::max, PhotonMap::NearestPhotons::photons, and PhotonMap::NearestPhotons::pos.

Referenced by PhotonMap::getIrradiance(), and PhotonMap::getNeighbourhood().

void _median_split Photon **  ,
int  ,
int  ,
int  ,
const   int
[protected]
 

Definition at line 83 of file PhotonMap.cc.

References Photon::_position, and swap.

Referenced by PhotonMap::_balance_segment().

bool getIrradiance const Vector3 spoint,
const Vector3 snormal,
float  maxdist,
unsigned  nphotons,
Vector3 irrad
const [virtual]
 

Finds and returns average irradiance of photons from the closest neighbourhood of given point.

Parameters:
spoint Surface point.
snormal Normalized normal vector of point 'spoint', can be NULL
maxdist Maximal distance.
nphotons Maxiaml number of returned photons.
irrad Avarage irradiance set by this method
Returns:
true on success, false if no photon is found

Definition at line 321 of file PhotonMap.cc.

References PhotonMap::_locate_photons(), PhotonMap::_map, PhotonMap::_storedPhotons, PhotonMap::NearestPhotons::found, and PhotonMap::NearestPhotons::numPhotons().

vector< Photon * > * getNeighbourhood const Vector3 spoint,
const Vector3 snormal,
float  maxdist,
unsigned  nphotons
const [virtual]
 

Finds and returns the closes photons from the neightbourhood of a surface point.

Parameters:
spoint Surface point.
snormal Normalized normal vector of point 'spoint', can be NULL
maxdist Maximal distance.
nphotons Maxiaml number of returned photons.
irrad Avarage irradiance of returned photons, can be NULL
Returns:
The closest photons from the 'spoint' neighbourhood or null.

Definition at line 292 of file PhotonMap.cc.

References PhotonMap::_locate_photons(), PhotonMap::_map, PhotonMap::_storedPhotons, PhotonMap::NearestPhotons::found, and PhotonMap::NearestPhotons::numPhotons().

virtual PhotonsIterator* iterator  )  const [inline, virtual]
 

Returns:
Iterator that allows to traverse the map photon by photon.

Definition at line 132 of file PhotonMap.h.

References esg::Iterator.

unsigned numPhotons void   )  const [virtual]
 

Returns:
Number of stored photons.

Definition at line 287 of file PhotonMap.cc.

References PhotonMap::_storedPhotons.

void set const vector< Photon > &  photons  )  [virtual]
 

Deletes old photons and builds new map from given photons.

Parameters:
photons New photons to store in map

Definition at line 281 of file PhotonMap.cc.

References PhotonMap::_build(), and PhotonMap::_map.


Friends And Related Function Documentation

friend class Iterator [friend]
 

Definition at line 22 of file PhotonMap.h.


Member Data Documentation

float _bboxMax[3] [protected]
 

Definition at line 52 of file PhotonMap.h.

Referenced by PhotonMap::_balance_segment(), PhotonMap::_build(), and PhotonMap::PhotonMap().

float _bboxMin[3] [protected]
 

bounding box of the scene

Definition at line 51 of file PhotonMap.h.

Referenced by PhotonMap::_balance_segment(), PhotonMap::_build(), and PhotonMap::PhotonMap().

Photon* _map [protected]
 

compact kd-tree with photons

Definition at line 49 of file PhotonMap.h.

Referenced by PhotonMap::_build(), PhotonMap::getIrradiance(), PhotonMap::getNeighbourhood(), PhotonMap::set(), and PhotonMap::~PhotonMap().

unsigned _storedPhotons [protected]
 

number of photons in kd-tree

Definition at line 50 of file PhotonMap.h.

Referenced by PhotonMap::_build(), PhotonMap::getIrradiance(), PhotonMap::getNeighbourhood(), and PhotonMap::numPhotons().


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