I was able to generate a Cylinder Mesh using this code:
use truck_meshalgo::tessellation::{MeshableShape, MeshedShape};
use truck_modeling::builder::{rsweep, try_attach_plane, tsweep, vertex};
use truck_modeling::{Point3, Vector3};
use truck_polymesh::{obj, EuclideanSpace, Rad};
fn main() {
let point = vertex(Point3::new(50.0, 0.0, 0.0));
let circle = rsweep(&point, Point3::origin(), Vector3::unit_z(), Rad(7.0));
let disk = try_attach_plane(&[circle]).unwrap();
let cylinder = tsweep(&disk, Vector3::new(0.0, 0.0, 50.0));
// save the cylinder to a file
let mesh = cylinder.triangulation(0.01).to_polygon();
let file = std::fs::File::create("test_cylinder.obj").unwrap();
obj::write(&mesh, file).unwrap();
}
When I import the mesh into 3D printer slicing software (PrusaSlicer) I see that there appears to be a triangle missing from the top:
When I open the mesh using MeshLab I don't see any missing triangles, but I can see that the triangle layout contains some artifacts:
The biggest artifacts are three large seams that produce "eyes" on the straight edge. I think these are probably not desirable.
A secondary concern is that this mesh uses 24,578 faces, which I believe is too many. Many of these faces are on the straight edge and so could be combined with no loss in fidelity.
I know that Truck is not optimized for meshes and downstream tools could easily be used to remesh the model, but I'm using Truck to build a CAD program which needs to be able to render the shapes in real time for the user. To do that I need to generate meshes, and big meshes take a lot longer to render to the screen.
I was able to generate a Cylinder Mesh using this code:
With the following dependencies in Cargo.toml:
When I import the mesh into 3D printer slicing software (PrusaSlicer) I see that there appears to be a triangle missing from the top:
When I open the mesh using MeshLab I don't see any missing triangles, but I can see that the triangle layout contains some artifacts:
The biggest artifacts are three large seams that produce "eyes" on the straight edge. I think these are probably not desirable.
A secondary concern is that this mesh uses 24,578 faces, which I believe is too many. Many of these faces are on the straight edge and so could be combined with no loss in fidelity.
I know that Truck is not optimized for meshes and downstream tools could easily be used to remesh the model, but I'm using Truck to build a CAD program which needs to be able to render the shapes in real time for the user. To do that I need to generate meshes, and big meshes take a lot longer to render to the screen.