Path Class Reference

Core data structure for manipulating a sequence x0,x1,...,xk of points on scene surfaces. Paths are the central unit in the path integral formulation of light transport, upon which path tracing, bidirectional path tracing, and MLT are all founded. More...

#include <Path.h>

List of all members.

Public Member Functions

Constructors
 Path (const PathVertexList &vertices, Renderer *renderer)
 Path (Renderer *renderer)
Functionality related to path as a whole
real_t getContribution () const
SpectralSampleSet getRadiance () const
SpectralSampleSet getContribution (unsigned s, unsigned t, bool tentative=false)
real_t getPdf (unsigned s, unsigned t, bool tentative=false)
void getPdfs (unsigned k, unsigned actualS, real_t *pdfs)
void preview ()
 Draws an OpenGL preview of this path by rendering edges between adjacent vertices using a single GL_LINE_STRIP.
Path deletion operations
void clear ()
 Clears this Path of all vertices, resulting in an empty path.
Path left (unsigned n)
Path right (unsigned n)
void pop_back ()
 Removes the back vertex (last light vertex) in this Path.
void pop_front ()
 Removes the front vertex (last eye vertex) in this Path.
Path addition operations
bool append (bool roulette=false)
 Samples the BSDF at the end of this light path, and attempts to add a new PathVertex corresponding to the first surface intersected in the sampled direction, updating all internal data as necessary.
bool prepend (bool roulette=false)
 Samples the BSDF at the end of this eye path, and attempts to add a new PathVertex corresponding to the first surface intersected in the sampled direction, updating all internal data as necessary.
bool prepend (const PathVertex &v1)
 Adds the given PathVertex at the end of this eye path.
bool append (const Path &path)
 Appends the given eye subpath onto this light subpath, updating both the cumulative eye and light contributions along the way.
PathVertex accessors
PathVertexoperator[] (unsigned index)
const PathVertexoperator[] (unsigned index) const
PathVertexfront ()
const PathVertexfront () const
PathVertexback ()
const PathVertexback () const
Size accessors
unsigned length () const
unsigned getNoVertices () const
unsigned getNoEdges () const
Miscellaneous functionality
RenderergetRenderer ()
void setRenderer (Renderer *renderer)
std::string toHeckbertNotation () const

Protected Member Functions

bool _samplePathVertex (bool roulette, bool adjoint)
 Samples the BSDF at the end of the path (which end is determined implicitly by the adjoint parameter), and attempts to add a new PathVertex corresponding to the first surface intersected in the sampled direction, updating all internal data as necessary.
bool _initL (PathVertex &y, const Vector3 &wo, real_t t, SurfacePoint *pt, SpectralSampleSet &alphaL, real_t &pL, bool roulette=false) const
 Initializes light-path vertex y with respect to the point given.
bool _initE (PathVertex &z, const Vector3 &wo, real_t t, SurfacePoint *pt, SpectralSampleSet &alphaE, real_t &pE, bool roulette=false) const
 Initializes eye-path vertex z with respect to the point given.

Protected Attributes

PathVertexList m_vertices
Rendererm_renderer


Detailed Description

Core data structure for manipulating a sequence x0,x1,...,xk of points on scene surfaces. Paths are the central unit in the path integral formulation of light transport, upon which path tracing, bidirectional path tracing, and MLT are all founded.

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008
Each Path is assumed to either start at an emitter (light subpath), end at a sensor (eye subpath), or both start at an emitter and end at a sensor (complete, valid path).

Definition at line 25 of file Path.h.


Constructor & Destructor Documentation

Path::Path ( const PathVertexList &  vertices,
Renderer renderer 
) [inline]

Definition at line 30 of file Path.h.

Path::Path ( Renderer renderer  )  [inline]

Definition at line 34 of file Path.h.


Member Function Documentation

real_t Path::getContribution (  )  const [inline]

Returns:
the luminance propagated along this path in the direction of lightflow (beginning with an emitter)

Definition at line 47 of file Path.h.

SpectralSampleSet Path::getRadiance (  )  const [inline]

Returns:
the radiance propagated along this path in the direction of lightflow (beginning with an emitter)

Definition at line 55 of file Path.h.

SpectralSampleSet Path::getContribution ( unsigned  s,
unsigned  t,
bool  tentative = false 
)

Returns:
the unweighted contribution of this path broken up into a light subpath prefix of length s and an eye subpath suffix of length t
Note:
this method contains an implicit visibility check between the connecting edge which will not be performed if (s + t) is equal to the length of this path (since this path is already assumed to be 'valid', visibility is therefore guaranteed in this case)

if tentative is true, the aforementioned visibility check will not be evaluated (visibility is assumed)

either this light subpath or the given eye subpath may be empty, but not both (an empty path is considered invalid), which implies that (s + t) >= 2

See also:
section 10.2 (pgs 302-305) of Veach's thesis for more details

Definition at line 23 of file Path.cpp.

real_t Path::getPdf ( unsigned  s,
unsigned  t,
bool  tentative = false 
)

Definition at line 117 of file Path.cpp.

void Path::getPdfs ( unsigned  k,
unsigned  actualS,
real_t pdfs 
)

Returns:
an array of k + 1 probability densities in pdfs, corresponding to all of the k + 1 ways in which this path with k vertices could be broken up into different length light and eye subpaths
Parameters:
k denotes the path length of interest (k <= the length of this path)
actualS denotes the length of the actual light path which this path was generated from (actualS <= the length of this path)
pdfs is an out-array which is assumed to be preallocated to hold at least k + 1 real_ts
Note:
probability densities are with respect to a surface area measure on the space of all paths
See also:
section 10.2 (pgs 302-305) of Veach's thesis for more details

Definition at line 181 of file Path.cpp.

void Path::preview (  ) 

Draws an OpenGL preview of this path by rendering edges between adjacent vertices using a single GL_LINE_STRIP.

void Path::clear (  )  [inline]

Clears this Path of all vertices, resulting in an empty path.

Definition at line 120 of file Path.h.

Path Path::left ( unsigned  n  )  [inline]

Returns:
a copy of the path formed by the left n + 1 vertices of the form: x0,x1,...,xn
Note:
n is inclusive here

Definition at line 129 of file Path.h.

Path Path::right ( unsigned  n  )  [inline]

Returns:
a copy of the path formed by the right-most vertices starting at the nth vertex of the form: x(n),x(n+1),...,xk
Note:
n is inclusive here

Definition at line 139 of file Path.h.

void Path::pop_back (  )  [inline]

Removes the back vertex (last light vertex) in this Path.

Definition at line 148 of file Path.h.

void Path::pop_front (  )  [inline]

Removes the front vertex (last eye vertex) in this Path.

Definition at line 157 of file Path.h.

bool Path::append ( bool  roulette = false  ) 

Samples the BSDF at the end of this light path, and attempts to add a new PathVertex corresponding to the first surface intersected in the sampled direction, updating all internal data as necessary.

Parameters:
roulette denotes whether or not to apply standard russian roulette to the decision of whether or not to add a vertex
Returns:
whether or not a vertex was successfully added
Note:
may return false if no surface was found in the sampled direction or if roulette is true and the random walk is terminated via russian roulette

Definition at line 308 of file Path.cpp.

bool Path::prepend ( bool  roulette = false  ) 

Samples the BSDF at the end of this eye path, and attempts to add a new PathVertex corresponding to the first surface intersected in the sampled direction, updating all internal data as necessary.

Parameters:
roulette denotes whether or not to apply standard russian roulette to the decision of whether or not to add a vertex
Returns:
whether or not a vertex was successfully added
Note:
may return false if no surface was found in the sampled direction or if roulette is true and the random walk is terminated via russian roulette

(camera->getSurfaceArea());

Definition at line 323 of file Path.cpp.

bool Path::prepend ( const PathVertex v1  ) 

Adds the given PathVertex at the end of this eye path.

Note:
only valid if the current path is empty, and 'v1' is assumed to be on a sensor
Returns:
true if the point was successfully added or false if the operation would invalidate this path

Definition at line 338 of file Path.cpp.

bool Path::append ( const Path path  ) 

Appends the given eye subpath onto this light subpath, updating both the cumulative eye and light contributions along the way.

Note:
either there are no restrictions or edge cases with respect to path lengths; either or both paths may be empty
Returns:
true if the resulting path is valid, false otherwise (the resulting path will be invalid -- zero contribution -- if the last light subpath vertex first eye subpath vertex are not mutually visible)

Definition at line 345 of file Path.cpp.

PathVertex& Path::operator[] ( unsigned  index  )  [inline]

Definition at line 229 of file Path.h.

const PathVertex& Path::operator[] ( unsigned  index  )  const [inline]

Definition at line 235 of file Path.h.

PathVertex& Path::front (  )  [inline]

Definition at line 241 of file Path.h.

const PathVertex& Path::front (  )  const [inline]

Definition at line 247 of file Path.h.

PathVertex& Path::back (  )  [inline]

Definition at line 253 of file Path.h.

const PathVertex& Path::back (  )  const [inline]

Definition at line 259 of file Path.h.

unsigned Path::length (  )  const [inline]

Definition at line 270 of file Path.h.

unsigned Path::getNoVertices (  )  const [inline]

Definition at line 274 of file Path.h.

unsigned Path::getNoEdges (  )  const [inline]

Definition at line 278 of file Path.h.

Renderer* Path::getRenderer (  )  [inline]

Definition at line 289 of file Path.h.

void Path::setRenderer ( Renderer renderer  )  [inline]

Definition at line 293 of file Path.h.

std::string Path::toHeckbertNotation (  )  const

Definition at line 669 of file Path.cpp.

bool Path::_samplePathVertex ( bool  roulette,
bool  adjoint 
) [protected]

Samples the BSDF at the end of the path (which end is determined implicitly by the adjoint parameter), and attempts to add a new PathVertex corresponding to the first surface intersected in the sampled direction, updating all internal data as necessary.

Parameters:
roulette denotes whether or not to apply standard russian roulette to the decision of whether or not to add a vertex
Returns:
whether or not a vertex was successfully added
Note:
may return false if no surface was found in the sampled direction or if roulette is true and the random walk is terminated via russian roulette

Definition at line 540 of file Path.cpp.

bool Path::_initL ( PathVertex y,
const Vector3 wo,
real_t  t,
SurfacePoint pt,
SpectralSampleSet alphaL,
real_t pL,
bool  roulette = false 
) const [protected]

Initializes light-path vertex y with respect to the point given.

Parameters:
roulette denotes whether or not to apply standard russian roulette to the decision of whether or not to add a vertex
Note:
y and pt are assumed to be mutually visible to each other
Returns:
the updated cumulative light subpath contribution (alphaL) and the updated cumulative light subpath probability density (pL) and whether or not to add the vertex (if russian roulette is disabled or succeeded)

Definition at line 601 of file Path.cpp.

bool Path::_initE ( PathVertex z,
const Vector3 wo,
real_t  t,
SurfacePoint pt,
SpectralSampleSet alphaE,
real_t pE,
bool  roulette = false 
) const [protected]

Initializes eye-path vertex z with respect to the point given.

Parameters:
roulette denotes whether or not to apply standard russian roulette to the decision of whether or not to add a vertex
Note:
z and pt are assumed to be mutually visible to each other
Returns:
the updated cumulative eye subpath contribution (alphaE) and the updated cumulative eye subpath probability density (pE) and whether or not to add the vertex (if russian roulette is disabled or succeeded)

Definition at line 635 of file Path.cpp.


Member Data Documentation

PathVertexList Path::m_vertices [protected]

Definition at line 353 of file Path.h.

Renderer* Path::m_renderer [protected]

Definition at line 354 of file Path.h.


The documentation for this class was generated from the following files:

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6