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> 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<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§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.