Skip to main content

manifold_csg/
lib.rs

1//! Safe Rust bindings to [manifold3d](https://github.com/elalish/manifold) —
2//! a geometry kernel for constructive solid geometry (CSG).
3//!
4//! This crate provides safe, ergonomic wrappers around the manifold3d C API.
5//! For details on the underlying algorithms and behavior, see the
6//! [upstream documentation](https://elalish.github.io/manifold/docs/html/).
7//!
8//! - [`Manifold`] — 3D solid with boolean operations (union, difference, intersection)
9//! - [`CrossSection`] — 2D region with offset, boolean, and hull operations
10//! - [`MeshGL64`] / [`MeshGL`] — mesh data transfer (f64 and f32 precision)
11//! - [`triangulate_polygons`] — constrained Delaunay triangulation of 2D polygons
12//!
13//! # Key features
14//!
15//! - **f64 precision**: Uses MeshGL64 to avoid f32 precision loss
16//! - **`Send` + `Sync` safe**: All types can be moved across threads and shared for concurrent reads
17//! - **Memory safe**: All C handles are freed automatically via `Drop`
18
19pub mod bounding_box;
20pub mod cross_section;
21pub mod manifold;
22pub mod mesh;
23pub mod ray;
24pub mod rect;
25pub mod triangulation;
26pub mod types;
27
28pub use bounding_box::BoundingBox;
29pub use cross_section::{CrossSection, FillRule, JoinType, Rect2};
30pub use manifold::Manifold;
31pub use manifold::{
32    get_circular_segments, reserve_ids, reset_to_circular_defaults, set_circular_segments,
33    set_min_circular_angle, set_min_circular_edge_length,
34};
35pub use manifold_csg_sys::ManifoldOpType as OpType;
36pub use mesh::{MeshGL, MeshGL64};
37pub use ray::RayHit;
38pub use rect::Rect;
39pub use triangulation::triangulate_polygons;
40pub use types::CsgError;