Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
John Collins committed Mar 10, 2024
1 parent 726eda2 commit 083c8c3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,23 @@ import manifold3d.manifold.ExportOptions;
public class ManifoldExample {

public static void main(String[] args) {
// Create basic shapes
Manifold sphere = Manifold.Sphere(10.0f, 20);
Manifold cube = Manifold.Cube(new DoubleVec3(15.0f, 15.0f, 15.0f), false);
Manifold cylinder = Manifold.Cylinder(3, 30.0f, 30.0f, 0, false)
.translateX(20).translateY(20).translateZ(-3.0);

// Perform Boolean operations
Manifold diff = cube.subtract(sphere); // Cube minus Sphere
Manifold intersection = cube.intersect(sphere); // Cube intersecting with Sphere
Manifold union = cube.add(sphere); // Cube union with Sphere
Manifold diff = cube.subtract(sphere);
Manifold intersection = cube.intersect(sphere);
Manifold union = cube.add(sphere);

// Export results with options
ExportOptions opts = new ExportOptions();
opts.faceted(false); // Smooth surface
opts.faceted(false);

MeshIO.ExportMesh("CubeMinusSphere.stl", diff.getMesh(), opts);
MeshIO.ExportMesh("CubeIntersectSphere.glb", intersection.getMesh(), opts);
MeshIO.ExportMesh("CubeUnionSphere.obj", union.getMesh(), opts);

// Create a convex hull combining Cube and Cylinder, then translate the Cube
Manifold hull = cylinder.convexHull(cube.translateZ(100.0));
MeshIO.ExportMesh("hull.glb", hull.getMesh(), opts);
}
Expand Down

0 comments on commit 083c8c3

Please sign in to comment.