Trait rpt::Shape [−][src]
Represents a physical shape, which can be hit by a ray to find intersections
Required methods
fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
Intersect the shape with a ray, for t >= t_min
, returning true and mutating
h
if an intersection was found before the current closest one
fn sample(&self, target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
Sample the shape for a random point on its surface, also returning the normal and PDF
Implementations on Foreign Types
impl<T: Shape + ?Sized> Shape for Box<T>
[src]
fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
fn sample(&self, target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
impl<T: Shape + ?Sized> Shape for Arc<T>
[src]
fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
fn sample(&self, target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
Implementors
impl Shape for Cube
[src]
fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
fn sample(&self, _target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
impl Shape for MonomialSurface
[src]
fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
fn sample(&self, _target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
impl Shape for Plane
[src]
fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
Ray-plane intersection
fn sample(&self, _target: &DVec3, _rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
impl Shape for Sphere
[src]
fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
fn sample(&self, target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
Sample a spherical light source, somewhat respecting the solid angle from a target point
Currently, this implementation just generates a random point in the hemisphere facing the target point, weighted by the cosine. This isn’t the most sophisticated technique, since you can sample the solid angle exactly, but it’s pretty good.