Crate implicit3d

source ·
Expand description

implicit3d is a crate for creating 3d implicit functions. Implicit functions evaluate to a scalar value for each point the 3d space. They can be used to described object surfaces. If the function evaluates to negative values the point is in the object, if the function evaluates positve this is outside the object. If the function evaluates to zero the point is on the object surface. This library allows to create implicit functions for 3d primitives (sphere, cylinder, cone, box). Those primitives can be combined using CSG and transformed.

Examples

Create a Sphere:

let sphere = implicit3d::Sphere::new(1.0);

Create a rounded Cube (as rounded intersection of 6 planes):

use std::fs::OpenOptions;
let px = implicit3d::PlaneX::new(1.0);
let pnx = implicit3d::PlaneNegX::new(1.0);
let py = implicit3d::PlaneY::new(1.0);
let pny = implicit3d::PlaneNegY::new(1.0);
let pz = implicit3d::PlaneZ::new(1.0);
let pnz = implicit3d::PlaneNegZ::new(1.0);
let cube = implicit3d::Intersection::from_vec(vec![px, pnx, py, pny, pz, pnz], 0.2);

Structs

AffineTransformer is a primitive that takes an object as input and allows to modify it using affine transforms. Usually it is used indirectly through Object::scale(), Object::translate() or Object::rotate().
Bender create an implicit function that represents a bended version of it’s input. The object will be bend around the Z-Axis. E.g. bending a cylinder along the X-Axis (and translated away from the Z-Axis) will result in a Torus.
3D Bounding Box - defined by two diagonally opposing points.
A cone along the Z-Axis
A cylinder along the Z-Axis
Intersect objects.
Mesh generates an implicit function from a 3d object mesh. Warning! This primitive is currently horribly inefficient. That is, for each point it iterates over all faces and finds the closest. This implementation desperately needs some performance improvements, e.g. kd-tree support or similar.
This struct configures evaluation of rounded edges between object. The edge is evaluated in a different more computationally expensive way.
A sphere. Simple.
Twister will twist an object by rotating it along the Z-Axis.
Union create an implict function as the union of its inputs.

Traits

Object is the basic trait for any 3d implicit function.
Trait to allow cloning of Box<Object<_>>.

Type Definitions

A negative YZ-Plane.
A negative XZ-Plane
A negative XZ-Plane
A YZ-Plane.
A XZ-Plane
A XY-Plane