pub struct Shape<F, T = ()> { /* private fields */ }Expand description
A shape represents an implicit surface
It is mostly agnostic to how that surface is represented, wrapping a
Function and a set of axes.
Shapes are shared between threads, so they should be cheap to clone. In
most cases, they’re a thin wrapper around an Arc<..>.
At construction, a shape has no associated transformation. A transformation
matrix can be applied by calling Shape::with_transform.
The shape’s transformation matrix is propagated into tapes (constructed by
*_tape functions), which use the matrix to transform incoming coordinates
during evaluation.
Note that with_transform returns a Shape with Transformed as the
second template parameter; to preserve immutability, the marker prevents
further mutation of the transform.
Implementations§
Source§impl<F: Function + Clone, T> Shape<F, T>
impl<F: Function + Clone, T> Shape<F, T>
Sourcepub fn new_point_eval() -> ShapeTracingEval<F::PointEval>
pub fn new_point_eval() -> ShapeTracingEval<F::PointEval>
Builds a new point evaluator
Sourcepub fn new_interval_eval() -> ShapeTracingEval<F::IntervalEval>
pub fn new_interval_eval() -> ShapeTracingEval<F::IntervalEval>
Builds a new interval evaluator
Sourcepub fn new_float_slice_eval() -> ShapeBulkEval<F::FloatSliceEval>
pub fn new_float_slice_eval() -> ShapeBulkEval<F::FloatSliceEval>
Builds a new float slice evaluator
Sourcepub fn new_grad_slice_eval() -> ShapeBulkEval<F::GradSliceEval>
pub fn new_grad_slice_eval() -> ShapeBulkEval<F::GradSliceEval>
Builds a new gradient slice evaluator
Sourcepub fn point_tape(
&self,
storage: F::TapeStorage,
) -> ShapeTape<<F::PointEval as TracingEvaluator>::Tape>
pub fn point_tape( &self, storage: F::TapeStorage, ) -> ShapeTape<<F::PointEval as TracingEvaluator>::Tape>
Returns an evaluation tape for a point evaluator
Sourcepub fn interval_tape(
&self,
storage: F::TapeStorage,
) -> ShapeTape<<F::IntervalEval as TracingEvaluator>::Tape>
pub fn interval_tape( &self, storage: F::TapeStorage, ) -> ShapeTape<<F::IntervalEval as TracingEvaluator>::Tape>
Returns an evaluation tape for a interval evaluator
Sourcepub fn float_slice_tape(
&self,
storage: F::TapeStorage,
) -> ShapeTape<<F::FloatSliceEval as BulkEvaluator>::Tape>
pub fn float_slice_tape( &self, storage: F::TapeStorage, ) -> ShapeTape<<F::FloatSliceEval as BulkEvaluator>::Tape>
Returns an evaluation tape for a float slice evaluator
Sourcepub fn grad_slice_tape(
&self,
storage: F::TapeStorage,
) -> ShapeTape<<F::GradSliceEval as BulkEvaluator>::Tape>
pub fn grad_slice_tape( &self, storage: F::TapeStorage, ) -> ShapeTape<<F::GradSliceEval as BulkEvaluator>::Tape>
Returns an evaluation tape for a gradient slice evaluator
Sourcepub fn simplify(
&self,
trace: &F::Trace,
storage: F::Storage,
workspace: &mut F::Workspace,
) -> Result<Self, Error>where
Self: Sized,
pub fn simplify(
&self,
trace: &F::Trace,
storage: F::Storage,
workspace: &mut F::Workspace,
) -> Result<Self, Error>where
Self: Sized,
Computes a simplified tape using the given trace, and reusing storage
Source§impl<F: Clone> Shape<F, ()>
impl<F: Clone> Shape<F, ()>
Sourcepub fn with_transform(&self, mat: Matrix4<f32>) -> Shape<F, Transformed>
pub fn with_transform(&self, mat: Matrix4<f32>) -> Shape<F, Transformed>
Returns a shape with the given transform applied
Source§impl<F: Clone> Shape<F, Transformed>
impl<F: Clone> Shape<F, Transformed>
Trait Implementations§
Source§impl<F: Function, T> EzShape<F> for Shape<F, T>
impl<F: Function, T> EzShape<F> for Shape<F, T>
Source§fn ez_point_tape(&self) -> ShapeTape<<F::PointEval as TracingEvaluator>::Tape>
fn ez_point_tape(&self) -> ShapeTape<<F::PointEval as TracingEvaluator>::Tape>
Source§fn ez_interval_tape(
&self,
) -> ShapeTape<<F::IntervalEval as TracingEvaluator>::Tape>
fn ez_interval_tape( &self, ) -> ShapeTape<<F::IntervalEval as TracingEvaluator>::Tape>
Source§fn ez_float_slice_tape(
&self,
) -> ShapeTape<<F::FloatSliceEval as BulkEvaluator>::Tape>
fn ez_float_slice_tape( &self, ) -> ShapeTape<<F::FloatSliceEval as BulkEvaluator>::Tape>
Source§fn ez_grad_slice_tape(
&self,
) -> ShapeTape<<F::GradSliceEval as BulkEvaluator>::Tape>
fn ez_grad_slice_tape( &self, ) -> ShapeTape<<F::GradSliceEval as BulkEvaluator>::Tape>
Auto Trait Implementations§
impl<F, T> Freeze for Shape<F, T>where
F: Freeze,
impl<F, T> RefUnwindSafe for Shape<F, T>where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<F, T> Send for Shape<F, T>
impl<F, T> Sync for Shape<F, T>
impl<F, T> Unpin for Shape<F, T>
impl<F, T> UnsafeUnpin for Shape<F, T>where
F: UnsafeUnpin,
impl<F, T> UnwindSafe for Shape<F, T>where
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.