Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
sample.h File Reference

Basic sampling routines. More...

#include "Math/math.h"
#include <Common/assertion.h>
#include <Common/primitive_type.h>
#include <cstddef>
#include <array>
#include <utility>
#include <type_traits>
#include <climits>

Go to the source code of this file.

Namespaces

namespace  ph
 The root for all renderer implementations.
 
namespace  ph::math
 Math functions and utilities.
 

Functions

template<typename To , typename From , std::size_t N>
std::array< To, N > ph::math::sample_cast (const std::array< From, N > &sample)
 
template<typename T >
bool ph::math::pick (const T pickProbability, const T sample)
 Randomly pick a branch with some probability.
 
template<typename T >
bool ph::math::reused_pick (const T pickProbability, T &sample)
 
template<typename T , typename BitsType >
ph::math::bits_to_sample (const BitsType &bits)
 Converts input bits to a sample. For standard unsigned integral types, this is effectively normalizing the integer value represented by bits into the range [0, 1].
 

Detailed Description

Basic sampling routines.

A "sample" is expected to be uniformly and randomly distributed in [0, 1].