Struct tinyraytracer::blocks::Rectangle2D[][src]

pub struct Rectangle2D {
    width: Vec3,
    height: Vec3,
    plane: Plane,
    material: Material,
}

2D rectangle in a 3D space

Fields

width: Vec3height: Vec3plane: Planematerial: Material

Implementations

impl Rectangle2D[src]

pub fn new(
    origin: Vec3,
    center: Vec3,
    side_dir: Vec3,
    material: Material
) -> Self
[src]

We need 3 points to define a plane. Here we use two points on a plane and a vector that is used as the side of the rectangle.

Trait Implementations

impl Debug for Rectangle2D[src]

impl RayCollision for Rectangle2D[src]

fn ray_intersect(&self, ray: &Ray) -> HitPoint[src]

This is easy. We look for plane-ray intersection and check if it is withing the rectangle

Auto Trait Implementations

impl RefUnwindSafe for Rectangle2D

impl Send for Rectangle2D

impl Sync for Rectangle2D

impl Unpin for Rectangle2D

impl UnwindSafe for Rectangle2D

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.