[−][src]Trait rpt::Shape
Represents a physical shape, which can be hit by a ray to find intersections
Required methods
pub 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
pub 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]
pub fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
pub fn sample(&self, target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
impl<T: Shape + ?Sized> Shape for Arc<T>
[src]
pub fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
pub fn sample(&self, target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
Implementors
impl Shape for Cube
[src]
pub fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
pub fn sample(&self, _target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
impl Shape for MonomialSurface
[src]
pub fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
pub fn sample(&self, _target: &DVec3, rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
impl Shape for Plane
[src]
pub fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
Ray-plane intersection
pub fn sample(&self, _target: &DVec3, _rng: &mut StdRng) -> (DVec3, DVec3, f64)
[src]
impl Shape for Sphere
[src]
pub fn intersect(&self, ray: &Ray, t_min: f64, record: &mut HitRecord) -> bool
[src]
pub 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.