Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::lta::SurfaceHitRefinery Class Referencefinal

Algorithms for various hit point adjustments. For surface escaping routines, the generated ray is not guaranteed to "actually" avoid the surface. In other words, self-intersection may still happen under different circumstances dpending on the method used. More...

#include <SurfaceHitRefinery.h>

Public Member Functions

 SurfaceHitRefinery (const SurfaceHit &X)
 
Ray escape (const math::Vector3R &dir) const
 Escape this surface in a specific direction. The method to use for escaping the surface is determined by engine settings.
 
Ray escapeManually (const math::Vector3R &dir, real delta=selfIntersectDelta()) const
 Escape this surface in a specific direction by a small offset.
 
Ray escapeEmpirically (const math::Vector3R &dir) const
 Escape this surface in a specific direction by some adaptive offset.
 
Ray escapeIteratively (const math::Vector3R &dir, std::size_t numIters=numIterations()) const
 Escape this surface in a specific direction by iteratively re-intersect with the surface. This variant is in general the most accurate one but is 5 % ~ 15 % more expensive than escapeManually().
 
std::optional< RaytryEscape (const SurfaceHit &X2) const
 Mutually escape from X and X2. The method to use for escaping the surfaces is determined by engine settings.
 
std::optional< RaytryEscapeManually (const SurfaceHit &X2, real delta=selfIntersectDelta()) const
 Mutually escape from X and X2 by a small offset.
 
std::optional< RaytryEscapeEmpirically (const SurfaceHit &X2) const
 Mutually escape from X and X2 by some adaptive offset.
 
std::optional< RaytryEscapeIteratively (const SurfaceHit &X2, std::size_t numIters=numIterations()) const
 Mutually escape from X and X2 by iteratively re-intersect with the surfaces.
 

Static Public Member Functions

static void init (const EngineInitSettings &settings)
 Initialize from engine settings.
 
static real selfIntersectDelta ()
 A small value for resolving self-intersections.
 
static std::size_t numIterations ()
 Number of iterations to perform when escaping in iterative mode.
 

Detailed Description

Algorithms for various hit point adjustments. For surface escaping routines, the generated ray is not guaranteed to "actually" avoid the surface. In other words, self-intersection may still happen under different circumstances dpending on the method used.

Constructor & Destructor Documentation

◆ SurfaceHitRefinery()

ph::lta::SurfaceHitRefinery::SurfaceHitRefinery ( const SurfaceHit & X)
inlineexplicit

Member Function Documentation

◆ escape()

Ray ph::lta::SurfaceHitRefinery::escape ( const math::Vector3R & dir) const
inline

Escape this surface in a specific direction. The method to use for escaping the surface is determined by engine settings.

Parameters
dirThe direction to escape. No need to be normalized.
Returns
The longest ray in dir that avoids this surface.

◆ escapeEmpirically()

Ray ph::lta::SurfaceHitRefinery::escapeEmpirically ( const math::Vector3R & dir) const
inline

Escape this surface in a specific direction by some adaptive offset.

Parameters
dirThe direction to escape. No need to be normalized.
Returns
The longest ray in dir that avoids this surface.

◆ escapeIteratively()

Ray ph::lta::SurfaceHitRefinery::escapeIteratively ( const math::Vector3R & dir,
std::size_t numIters = numIterations() ) const
inline

Escape this surface in a specific direction by iteratively re-intersect with the surface. This variant is in general the most accurate one but is 5 % ~ 15 % more expensive than escapeManually().

Parameters
dirThe direction to escape. No need to be normalized.
numItersThe desired number of improvements to have on the offset.
Returns
The longest ray in dir that avoids this surface.

◆ escapeManually()

Ray ph::lta::SurfaceHitRefinery::escapeManually ( const math::Vector3R & dir,
real delta = selfIntersectDelta() ) const
inline

Escape this surface in a specific direction by a small offset.

Parameters
dirThe direction to escape. No need to be normalized.
deltaThe amount to offset.
Returns
The longest ray in dir that avoids this surface.

◆ init()

void ph::lta::SurfaceHitRefinery::init ( const EngineInitSettings & settings)
static

Initialize from engine settings.

◆ numIterations()

std::size_t ph::lta::SurfaceHitRefinery::numIterations ( )
inlinestatic

Number of iterations to perform when escaping in iterative mode.

◆ selfIntersectDelta()

real ph::lta::SurfaceHitRefinery::selfIntersectDelta ( )
inlinestatic

A small value for resolving self-intersections.

◆ tryEscape()

std::optional< Ray > ph::lta::SurfaceHitRefinery::tryEscape ( const SurfaceHit & X2) const
inline

Mutually escape from X and X2. The method to use for escaping the surfaces is determined by engine settings.

Parameters
X2The other surface to escape from.
Returns
The ray that avoids both surfaces.

◆ tryEscapeEmpirically()

std::optional< Ray > ph::lta::SurfaceHitRefinery::tryEscapeEmpirically ( const SurfaceHit & X2) const
inline

Mutually escape from X and X2 by some adaptive offset.

Parameters
X2The other surface to escape from.
Returns
The ray that avoids both surfaces.

◆ tryEscapeIteratively()

std::optional< Ray > ph::lta::SurfaceHitRefinery::tryEscapeIteratively ( const SurfaceHit & X2,
std::size_t numIters = numIterations() ) const
inline

Mutually escape from X and X2 by iteratively re-intersect with the surfaces.

Parameters
X2The other surface to escape from.
numItersThe desired number of improvements to have on the offset.
Returns
The ray that avoids both surfaces.

◆ tryEscapeManually()

std::optional< Ray > ph::lta::SurfaceHitRefinery::tryEscapeManually ( const SurfaceHit & X2,
real delta = selfIntersectDelta() ) const
inline

Mutually escape from X and X2 by a small offset.

Parameters
X2The other surface to escape from.
deltaThe amount to offset.
Returns
The ray that avoids both surfaces.

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