Skip to main content

Module shape

Module shape 

Source
Expand description

Data structures for shape evaluation

Types in this module are typically thin (generic) wrappers around objects that implement traits in fidget_core::eval. The wrapper types are specialized to operate on x, y, z arguments, rather than taking arbitrary numbers of variables.

For example, a Shape is a wrapper which makes it easier to treat a Function as an implicit surface (with X, Y, Z axes and an optional transform matrix).

use fidget_core::vm::VmShape;
use fidget_core::context::Context;
use fidget_core::shape::EzShape;

let mut ctx = Context::new();
let x = ctx.x();
let shape = VmShape::new(&ctx, x)?;

// Let's build a single point evaluator:
let mut eval = VmShape::new_point_eval();
let tape = shape.ez_point_tape();
let (value, _trace) = eval.eval(&tape, 0.25, 0.0, 0.0)?;
assert_eq!(value, 0.25);

Structs§

Shape
A shape represents an implicit surface
ShapeBulkEval
Wrapper around a BulkEvaluator
ShapeTape
Wrapper around a function tape, with axes and an optional transform matrix
ShapeTracingEval
Wrapper around a TracingEvaluator
ShapeVars
Variables bound to values for shape evaluation
Transformed
Marker struct indicating that a shape has a transform applied

Traits§

EzShape
Extension trait for working with a shape without thinking much about memory
Transformable
Trait for types that can be transformed by a 4x4 homogeneous transform matrix