[][src]Trait tray_rust::geometry::Sampleable

pub trait Sampleable {
    fn sample_uniform(&self, samples: &(f32, f32)) -> (Point, Normal);
fn sample(&self, p: &Point, samples: &(f32, f32)) -> (Point, Normal);
fn surface_area(&self) -> f32;
fn pdf(&self, p: &Point, w_i: &Vector) -> f32; }

Trait implemented by geometry that can sample a point on its surface

Required methods

fn sample_uniform(&self, samples: &(f32, f32)) -> (Point, Normal)

Uniformly sample a position and normal on the surface using the samples passed

fn sample(&self, p: &Point, samples: &(f32, f32)) -> (Point, Normal)

Sample the object using the probability density of the solid angle from p to the sampled point on the surface. Returns the sampled point and the surface normal at that point

fn surface_area(&self) -> f32

Return the surface area of the shape

fn pdf(&self, p: &Point, w_i: &Vector) -> f32

Compute the PDF that the ray from p with direction w_i intersects the shape

Loading content...

Implementors

impl Sampleable for Disk[src]

impl Sampleable for Rectangle[src]

fn sample_uniform(&self, samples: &(f32, f32)) -> (Point, Normal)[src]

Uniform sampling for a rect is simple: just scale the two samples into the rectangle's space and return them as the x,y coordinates of the point chosen

fn surface_area(&self) -> f32[src]

Compute the sphere's surface area

fn pdf(&self, p: &Point, w_i: &Vector) -> f32[src]

Compute the PDF that the ray from p with direction w_i intersects the shape. This is the same as disk for computing PDF, we just use the rectangle's surface area instead

impl Sampleable for Sphere[src]

fn sample(&self, p: &Point, samples: &(f32, f32)) -> (Point, Normal)[src]

Sample the object using the probability density of the solid angle from p to the sampled point on the surface. Returns the sampled point and the surface normal at that point

fn surface_area(&self) -> f32[src]

Compute the sphere's surface area

fn pdf(&self, p: &Point, _: &Vector) -> f32[src]

Compute the PDF that the ray from p with direction w_i intersects the shape

Loading content...