Trait fidget::eval::Shape

source ·
pub trait Shape: Send + Sync + Clone {
    type Trace: Clone + Eq + Send + Trace;
    type Storage: Default + Send;
    type Workspace: Default + Send;
    type TapeStorage: Default + Send;
    type PointEval: TracingEvaluator<Data = f32, Trace = Self::Trace, TapeStorage = Self::TapeStorage> + Send + Sync;
    type IntervalEval: TracingEvaluator<Data = Interval, Trace = Self::Trace, TapeStorage = Self::TapeStorage> + Send + Sync;
    type FloatSliceEval: BulkEvaluator<Data = f32, TapeStorage = Self::TapeStorage> + Send + Sync;
    type GradSliceEval: BulkEvaluator<Data = Grad, TapeStorage = Self::TapeStorage> + Send + Sync;
    type TransformedShape: Shape;

Show 15 methods // Required methods fn point_tape( &self, storage: Self::TapeStorage ) -> <Self::PointEval as TracingEvaluator>::Tape; fn interval_tape( &self, storage: Self::TapeStorage ) -> <Self::IntervalEval as TracingEvaluator>::Tape; fn float_slice_tape( &self, storage: Self::TapeStorage ) -> <Self::FloatSliceEval as BulkEvaluator>::Tape; fn grad_slice_tape( &self, storage: Self::TapeStorage ) -> <Self::GradSliceEval as BulkEvaluator>::Tape; fn simplify( &self, trace: &Self::Trace, storage: Self::Storage, workspace: &mut Self::Workspace ) -> Result<Self, Error> where Self: Sized; fn recycle(self) -> Option<Self::Storage>; fn size(&self) -> usize; fn tile_sizes_3d() -> &'static [usize]; fn tile_sizes_2d() -> &'static [usize]; fn apply_transform( self, mat: Matrix4<f32> ) -> <Self as Shape>::TransformedShape; // Provided methods fn new_point_eval() -> Self::PointEval { ... } fn new_interval_eval() -> Self::IntervalEval { ... } fn new_float_slice_eval() -> Self::FloatSliceEval { ... } fn new_grad_slice_eval() -> Self::GradSliceEval { ... } fn simplify_tree_during_meshing(_d: usize) -> bool { ... }
}
Expand description

A shape represents an implicit surface

It is mostly agnostic to how that surface is represented; we simply require that the shape can generate evaluators of various kinds.

Shapes are shared between threads, so they should be cheap to clone. In most cases, they’re a thin wrapper around an Arc<..>.

Required Associated Types§

source

type Trace: Clone + Eq + Send + Trace

Associated type traces collected during tracing evaluation

source

type Storage: Default + Send

Associated type for storage used by the shape itself

source

type Workspace: Default + Send

Associated type for workspace used during shape simplification

source

type TapeStorage: Default + Send

Associated type for storage used by tapes

For simplicity, we require that every tape use the same type for storage. This could change in the future!

source

type PointEval: TracingEvaluator<Data = f32, Trace = Self::Trace, TapeStorage = Self::TapeStorage> + Send + Sync

Associated type for single-point tracing evaluation

source

type IntervalEval: TracingEvaluator<Data = Interval, Trace = Self::Trace, TapeStorage = Self::TapeStorage> + Send + Sync

Associated type for single interval tracing evaluation

source

type FloatSliceEval: BulkEvaluator<Data = f32, TapeStorage = Self::TapeStorage> + Send + Sync

Associated type for evaluating many points in one call

source

type GradSliceEval: BulkEvaluator<Data = Grad, TapeStorage = Self::TapeStorage> + Send + Sync

Associated type for evaluating many gradients in one call

source

type TransformedShape: Shape

Associated type returned when applying a transform

This is normally TransformedShape<Self>, but if Self is already TransformedShape, then the transform is stacked (instead of creating a wrapped object).

Required Methods§

source

fn point_tape( &self, storage: Self::TapeStorage ) -> <Self::PointEval as TracingEvaluator>::Tape

Returns an evaluation tape for a point evaluator

source

fn interval_tape( &self, storage: Self::TapeStorage ) -> <Self::IntervalEval as TracingEvaluator>::Tape

Returns an evaluation tape for an interval evaluator

source

fn float_slice_tape( &self, storage: Self::TapeStorage ) -> <Self::FloatSliceEval as BulkEvaluator>::Tape

Returns an evaluation tape for a float slice evaluator

source

fn grad_slice_tape( &self, storage: Self::TapeStorage ) -> <Self::GradSliceEval as BulkEvaluator>::Tape

Returns an evaluation tape for a float slice evaluator

source

fn simplify( &self, trace: &Self::Trace, storage: Self::Storage, workspace: &mut Self::Workspace ) -> Result<Self, Error>
where Self: Sized,

Computes a simplified tape using the given trace, and reusing storage

source

fn recycle(self) -> Option<Self::Storage>

Attempt to reclaim storage from this shape

This may fail, because shapes are Clone and are often implemented using an Arc around a heavier data structure.

source

fn size(&self) -> usize

Returns a size associated with this shape

This is underspecified and only used for unit testing; for tape-based shapes, it’s typically the length of the tape,

source

fn tile_sizes_3d() -> &'static [usize]

Recommended tile sizes for 3D rendering

source

fn tile_sizes_2d() -> &'static [usize]

Recommended tile sizes for 2D rendering

source

fn apply_transform(self, mat: Matrix4<f32>) -> <Self as Shape>::TransformedShape

Returns a shape with the given transform applied

Provided Methods§

source

fn new_point_eval() -> Self::PointEval

Builds a new point evaluator

source

fn new_interval_eval() -> Self::IntervalEval

Builds a new interval evaluator

source

fn new_float_slice_eval() -> Self::FloatSliceEval

Builds a new float slice evaluator

source

fn new_grad_slice_eval() -> Self::GradSliceEval

Builds a new gradient slice evaluator

source

fn simplify_tree_during_meshing(_d: usize) -> bool

Indicates whether we run tape simplification at the given cell depth during meshing.

By default, this is always true; for evaluators where simplification is more expensive than evaluation (i.e. the JIT), it may only be true at certain depths.

Object Safety§

This trait is not object safe.

Implementors§