#3d #manifold #dual-contouring

tessellation

3d tessellation library

14 releases

0.8.2 Oct 19, 2020
0.8.1 Oct 19, 2020
0.7.5 Oct 17, 2020
0.7.2 Dec 2, 2019
0.5.3 May 6, 2018

#8 in #tessellation

Download history 23/week @ 2023-10-14 20/week @ 2023-10-21 36/week @ 2023-10-28 7/week @ 2023-11-04 19/week @ 2023-11-11 5/week @ 2023-11-18 20/week @ 2023-11-25 31/week @ 2023-12-02 35/week @ 2023-12-09 18/week @ 2023-12-16 35/week @ 2023-12-23 2/week @ 2023-12-30 18/week @ 2024-01-06 4/week @ 2024-01-13 17/week @ 2024-01-20 31/week @ 2024-01-27

70 downloads per month

Apache-2.0 OR MIT

79KB
2K SLoC

tessellation

Build Status Codecov Cargo License: Apache-2.0 License: MIT Downloads

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:

use nalgebra as na;
//!
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();

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~5.5MB
~105K SLoC