Skip to content

can't get minimal exemple to work #11

@bekraoui

Description

@bekraoui

I’m interested in ploting 3D implicite functions, i was trying to compile the sphere exemple, unfortunatly i didn't success to compile it even i'm using a minimal code:

extern crate nalgebra;
extern crate tessellation;

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 {
    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()
  }
}


fn main() {

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

    println!("Hello, world!");
}

Can you help me solve this error please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions