Skip to main content

Object

Trait Object 

Source
pub trait Object<S: RealField + Float + From<f32>>:
    ObjectClone<S>
    + Debug
    + Sync
    + Send {
    // Required method
    fn bbox(&self) -> &BoundingBox<S>;

    // Provided methods
    fn set_bbox(&mut self, _: &BoundingBox<S>) { ... }
    fn set_parameters(&mut self, _: &PrimitiveParameters<S>) { ... }
    fn approx_value(&self, _: &Point3<S>, _: S) -> S { ... }
    fn normal(&self, _: &Point3<S>) -> Vector3<S> { ... }
    fn translate(&self, v: &Vector3<S>) -> Box<dyn Object<S>> { ... }
    fn rotate(&self, r: &Vector3<S>) -> Box<dyn Object<S>> { ... }
    fn scale(&self, s: &Vector3<S>) -> Box<dyn Object<S>> { ... }
}
Expand description

Object is the basic trait for any 3d implicit function.

Required Methods§

Source

fn bbox(&self) -> &BoundingBox<S>

Get the Bounding Box of this Object.

Provided Methods§

Source

fn set_bbox(&mut self, _: &BoundingBox<S>)

Explicitly set the Bounding Box.

Source

fn set_parameters(&mut self, _: &PrimitiveParameters<S>)

Allows to set parameters.

Source

fn approx_value(&self, _: &Point3<S>, _: S) -> S

Value is 0 on object surfaces, negative inside and positive outside of objects. If positive, value is guarateed to be the minimum distance to the object surface. return some approximation (which is always larger then the proper value). Only do a proper calculation, for values smaller then slack.

Source

fn normal(&self, _: &Point3<S>) -> Vector3<S>

Evaluate the normal of self at the given point.

Source

fn translate(&self, v: &Vector3<S>) -> Box<dyn Object<S>>

Return a translated version of self.

Source

fn rotate(&self, r: &Vector3<S>) -> Box<dyn Object<S>>

Return a rotated version of self.

Source

fn scale(&self, s: &Vector3<S>) -> Box<dyn Object<S>>

Return a scaled version of self.

Trait Implementations§

Source§

impl<S> Clone for Box<dyn Object<S>>

Source§

fn clone(&self) -> Box<dyn Object<S>>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S> PartialEq for Box<dyn Object<S>>

Source§

fn eq(&self, _: &Box<dyn Object<S>>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S> PartialOrd for Box<dyn Object<S>>

Source§

fn partial_cmp(&self, _: &Box<dyn Object<S>>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Implementors§