ricosjp / truck

Truck is a Rust CAD Kernel.
Apache License 2.0
992 stars 53 forks source link

Is there any way to 'rasterize' a polygon mesh from a solid yet? #35

Closed crabdancing closed 1 year ago

crabdancing commented 1 year ago

E.g.:

let bottle: Solid = bottle(1.4, 1.0, 0.6);
let bottle_mesh: PolygonMesh = PolygonMesh::from(bottle);
ytanimura commented 1 year ago

Thank you for the question. Sorry for the delay in updating the document.

The tessellation API is in truck-meshalgo::tessellation.

use truck_meshalgo::tessellation::*;
let solid: Solid = ...
// Create a solid with polyline as curve and trimmed polygon as face
let mesh_solid = solid.triangulation(0.01);
// Merge meshes
let mesh = mesh_solid.to_polygon();
crabdancing commented 1 year ago

Oh, awesome, thank you!