Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cylindrical Mesh Improvements #70

Open
MattFerraro opened this issue Jun 3, 2024 · 0 comments
Open

Cylindrical Mesh Improvements #70

MattFerraro opened this issue Jun 3, 2024 · 0 comments

Comments

@MattFerraro
Copy link

MattFerraro commented Jun 3, 2024

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

With the following dependencies in Cargo.toml:

truck-meshalgo = { git = "https://github.com/ricosjp/truck.git", rev = "c84318b8dec" }
truck-modeling = { git = "https://github.com/ricosjp/truck.git", rev = "c84318b8dec" }
truck-shapeops = { git = "https://github.com/ricosjp/truck.git", rev = "c84318b8dec" }
truck-polymesh = { git = "https://github.com/ricosjp/truck.git", rev = "c84318b8dec" }
truck-topology = { git = "https://github.com/ricosjp/truck.git", rev = "c84318b8dec" }
truck-stepio = { git = "https://github.com/ricosjp/truck.git", rev = "c84318b8dec" }

When I import the mesh into 3D printer slicing software (PrusaSlicer) I see that there appears to be a triangle missing from the top:
Screenshot 2024-06-02 at 9 09 27 PM

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:
Screenshot 2024-06-02 at 9 07 47 PM

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant