# [−][src]Crate implicit3d

`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 = Box::new(implicit3d::PlaneX::new(1.0)); let pnx = Box::new(implicit3d::PlaneNegX::new(1.0)); let py = Box::new(implicit3d::PlaneY::new(1.0)); let pny = Box::new(implicit3d::PlaneNegY::new(1.0)); let pz = Box::new(implicit3d::PlaneZ::new(1.0)); let pnz = Box::new(implicit3d::PlaneNegZ::new(1.0)); let cube = implicit3d::Intersection::from_vec(vec![px, pnx, py, pny, pz, pnz], 0.2);

## Structs

AffineTransformer | AffineTransformer is a primitive that takes an object as input and allows to modify it using
affine transforms.
Usually it is used indirectly through |

Bender | 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. |

BoundingBox | 3D Bounding Box - defined by two diagonally opposing points. |

Cone | A cone along the Z-Axis |

Cylinder | A cylinder along the Z-Axis |

Intersection | Intersect objects. |

Mesh | 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. |

NormalPlane | An arbitrary (not axis aligned) plane. |

PrimitiveParameters | This struct configures evaluation of rounded edges between object. The edge is evaluated in a different more computationally expensive way. |

Sphere | A sphere. Simple. |

Twister | Twister will twist an object by rotating it along the Z-Axis. |

Union | Union create an implict function as the union of its inputs. |

## Traits

Object | Object is the basic trait for any 3d implicit function. |

ObjectClone | Trait to allow cloning of |

## Type Definitions

PlaneNegX | A negative YZ-Plane. |

PlaneNegY | A negative XZ-Plane |

PlaneNegZ | A negative XZ-Plane |

PlaneX | A YZ-Plane. |

PlaneY | A XZ-Plane |

PlaneZ | A XY-Plane |