Skip to main content

Crate tessellation

Crate tessellation 

Source
Expand description

tessellation is crate for creating polygons from implicit functions or volumes. It uses Manifold Dual Contouring.

§Examples

Create a unit sphere and tessellate it:

use nalgebra as na;

struct UnitSphere;

impl tessellation::ImplicitFunction<f64> for UnitSphere {
  fn value(&self, p: &na::Point3<f64>) -> f64 {
    na::Vector3::new(p.x, p.y, p.z).norm() - 1.0
  }
  fn normal(&self, p: &na::Point3<f64>) -> na::Vector3<f64> {
    na::Vector3::new(p.x, p.y, p.z).normalize()
  }
}

let sphere = UnitSphere;
let mut mdc = tessellation::ManifoldDualContouring::new(&sphere, 0.2, 0.1);
let triangles = mdc.tessellate().unwrap();

Structs§

ManifoldDualContouring
Struct containing all the intermediary state for the different stages of tessellation.
Mesh
Mesh that will be returned from tessellate.

Enums§

ProgressEvent
Progress event emitted by ManifoldDualContouring::tessellate_with_progress.

Traits§

AsUSize
Trait which allows to convert Self to usize, since To is not implemented by f32 and f64.
ImplicitFunction
Trait to be implemented by functions that should be tessellated.
RealField
Trait alias for nalgebra’s RealField.