Sampling module
Random number generation, generation of points and directions, Monte Carlo utilities.
Functions
- auto randf() -> float
- Global random number generator that produces floats between
[0,1)
- auto random_in_unit_sphere() -> Vec3f
- Sample a random point uniformly within a unit sphere (uses the global randf() RNG and rejection sampling)
- auto random_in_unit_disk() -> Vec2f
- Sample a random point uniformly within a unit disk (uses the global randf() RNG and rejection sampling)
- auto sample_disk(const Vec2f& rv) -> Vec2f
- Uniformly sample a vector on a 2D disk with radius 1, centered around the origin.
- auto sample_disk_pdf(const Vec2f& p) -> float
- Probability density of sample_
disk() - auto sample_sphere(const Vec2f& rv) -> Vec3f
- Uniformly sample a vector on the unit sphere with respect to solid angles.
- auto sample_sphere_pdf() -> float
- Probability density of sample_
sphere() - auto sample_hemisphere(const Vec2f& rv) -> Vec3f
- Uniformly sample a vector on the unit hemisphere around the pole (0,0,1) with respect to solid angles.
- auto sample_hemisphere_pdf(const Vec3f& v) -> float
- Probability density of sample_
hemisphere() - auto sample_hemisphere_cosine(const Vec2f& rv) -> Vec3f
- Uniformly sample a vector on the unit hemisphere around the pole (0,0,1) with respect to projected solid angles.
- auto sample_hemisphere_cosine_pdf(const Vec3f& v) -> float
- Probability density of sample_
hemisphere_ cosine() - auto sample_hemisphere_cosine_power(float exponent, const Vec2f& rv) -> Vec3f
- Sample a vector on the unit hemisphere with a cosine-power density about the pole (0,0,1)
- auto sample_hemisphere_cosine_power_pdf(float exponent, float cosine) -> float
- Probability density of sample_
hemisphere_ cosine_ power() - auto sample_sphere_cap(const Vec2f& rv, float cos_theta_max) -> Vec3f
- Uniformly sample a vector on a spherical cap around (0, 0, 1)
- auto sample_sphere_cap_pdf(float cos_theta, float cos_theta_max) -> float
- Probability density of sample_
sphere_ cap() - auto sample_triangle(const Vec3f& v0, const Vec3f& v1, const Vec3f& v2, const Vec2f& rv) -> Vec3f
- Sample a point uniformly on a triangle with vertices
v0
,v1
,v2
. - auto sample_triangle_pdf(const Vec3f& v0, const Vec3f& v1, const Vec3f& v2) -> float
- Sampling density of sample_
triangle()
Function documentation
float randf()
#include <darts/sampling.h>
Global random number generator that produces floats between [0,1)
Vec3f random_in_unit_sphere()
#include <darts/sampling.h>
Sample a random point uniformly within a unit sphere (uses the global randf() RNG and rejection sampling)
Vec2f random_in_unit_disk()
#include <darts/sampling.h>
Sample a random point uniformly within a unit disk (uses the global randf() RNG and rejection sampling)
Vec2f sample_disk(const Vec2f& rv)
#include <darts/sampling.h>
Uniformly sample a vector on a 2D disk with radius 1, centered around the origin.
float sample_disk_pdf(const Vec2f& p)
#include <darts/sampling.h>
Probability density of sample_
Vec3f sample_sphere(const Vec2f& rv)
#include <darts/sampling.h>
Uniformly sample a vector on the unit sphere with respect to solid angles.
float sample_sphere_pdf()
#include <darts/sampling.h>
Probability density of sample_
Vec3f sample_hemisphere(const Vec2f& rv)
#include <darts/sampling.h>
Uniformly sample a vector on the unit hemisphere around the pole (0,0,1) with respect to solid angles.
float sample_hemisphere_pdf(const Vec3f& v)
#include <darts/sampling.h>
Probability density of sample_
Vec3f sample_hemisphere_cosine(const Vec2f& rv)
#include <darts/sampling.h>
Uniformly sample a vector on the unit hemisphere around the pole (0,0,1) with respect to projected solid angles.
float sample_hemisphere_cosine_pdf(const Vec3f& v)
#include <darts/sampling.h>
Probability density of sample_
Vec3f sample_hemisphere_cosine_power(float exponent,
const Vec2f& rv)
#include <darts/sampling.h>
Sample a vector on the unit hemisphere with a cosine-power density about the pole (0,0,1)
float sample_hemisphere_cosine_power_pdf(float exponent,
float cosine)
#include <darts/sampling.h>
Probability density of sample_
Vec3f sample_sphere_cap(const Vec2f& rv,
float cos_theta_max)
#include <darts/sampling.h>
Uniformly sample a vector on a spherical cap around (0, 0, 1)
A spherical cap is the subset of a unit sphere whose directions make an angle of less than 'theta' with the north pole. This function expects the cosine of 'theta' as a parameter.
float sample_sphere_cap_pdf(float cos_theta,
float cos_theta_max)
#include <darts/sampling.h>
Probability density of sample_
Vec3f sample_triangle(const Vec3f& v0,
const Vec3f& v1,
const Vec3f& v2,
const Vec2f& rv)
#include <darts/sampling.h>
Sample a point uniformly on a triangle with vertices v0
, v1
, v2
.
Parameters | |
---|---|
v0 | The vertices of the triangle to sample |
v1 | The vertices of the triangle to sample |
v2 | The vertices of the triangle to sample |
rv | Two random variables uniformly distributed in [0,1) |
float sample_triangle_pdf(const Vec3f& v0,
const Vec3f& v1,
const Vec3f& v2)
#include <darts/sampling.h>
Sampling density of sample_