8 releases

new 0.7.2 Dec 2, 2019
0.7.0 Sep 30, 2018
0.6.2 Sep 29, 2018
0.6.1 May 15, 2018
0.5.3 May 6, 2018

#18 in Data formats

Download history 8/week @ 2019-08-25 18/week @ 2019-09-01 29/week @ 2019-09-08 34/week @ 2019-09-15 76/week @ 2019-09-22 7/week @ 2019-09-29 7/week @ 2019-10-06 21/week @ 2019-10-13 7/week @ 2019-10-20 57/week @ 2019-10-27 8/week @ 2019-11-03 2/week @ 2019-11-10 24/week @ 2019-11-17 21/week @ 2019-11-24

101 downloads per month

GPL-3.0 license

78KB
2K SLoC

tessellation

Build Status Codecov Cargo License: GPL-3.0 Downloads

Tessellation implements Manifold Dual Contouring.

Tessellation is a library for 3d tessellation, e.g. it will create a set of triangles from any implicit function of volume. Tessellation implements Manifold Dual Contouring.

Examples

Create a unit sphere and tessellate it:

extern crate nalgebra as na;
extern crate tessellation;
//!
struct UnitSphere {
  bbox : tessellation::BoundingBox<f64>
}
//!
impl UnitSphere {
  fn new() -> UnitSphere {
    UnitSphere {
      bbox: tessellation::BoundingBox::new(&na::Point3::new(-1., -1., -1.),
                                           &na::Point3::new( 1.,  1.,  1.)) }
  }
}

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

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

Dependencies

~4MB
~80K SLoC