sequence

package
v0.0.0-...-405cb25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sequence implements a low-discrepancy sequence for Quasi Monte Carlo integration, and mappings from a uniform sequence to a disk or sphere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CosineSphere

func CosineSphere(u, v float64, normal geom.Vec) geom.Vec

CosineSphere transforms a point (u,v) from the unit square to a vector on the heimsphere around the given normal, cosine weighted. I.e. the resulting vectors are distributed proportionally to the cosine of the angle with the normal, assuming that the original (u,v) are uniformly distributed.

This is used for cosine-weighted importance sampling. E.g. for Lambertian scattering (materials.Matte).

func Halton

func Halton(b, i int) float64

Halton(b, i) returns the i'th element of the Halton series with base b. i starts from 0. The base b should be >= 2. See https://en.wikipedia.org/wiki/Halton_sequence

func UniformDisk

func UniformDisk(u, v float64) (x, y float64)

UniformDisk maps a point (u,v) from the unit square to the unit disk, preserving uniformity.

This is used for sampling a disk-shaped light source.

Types

type Sequence

type Sequence interface {
	Init(pixel, pass int)
	Generate2() (u, v float64)
}

func NewHalton

func NewHalton(baseU, baseV, stride int, shifts []geom.Vec2) Sequence

func PseudoRandom

func PseudoRandom() Sequence

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL