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 functions that accept a 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_with_transform(
    &tape, 0.25, 0.0, 0.0, &nalgebra::Matrix4::identity()
)?;
assert_eq!(value, 0.25);

Structs§

BoundShape
Shape with bound variables
MissingVar
A VarIndex variable is missing
Shape
A shape represents an implicit surface with X/Y/Z variables
ShapeBulkEval
Wrapper around a BulkEvaluator
ShapeTape
Wrapper around a single-output function tape
ShapeTracingEval
Wrapper around a TracingEvaluator
ShapeVars
Variables bound to values for shape evaluation

Enums§

ShapeBulkEvalError
Error type for shape bulk evaluation
ShapeTracingEvalError
Error type for shape tracing evaluation

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