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//! - **Browser-capable**: Builds for `wasm32-unknown-emscripten` and
19//! `wasm32-unknown-unknown` (the wasm-bindgen-compatible target) for
20//! in-browser geometry. See the README's "Browser / WebAssembly" sections.
21//!
22//! # Upgrading
23//!
24//! See [`CHANGELOG.md`](https://github.com/zmerlynn/manifold-csg/blob/main/crates/manifold-csg/CHANGELOG.md)
25//! (also shipped inside the crate) for per-version release notes. It flags
26//! *behavioral* changes that compile cleanly but change output - notably the
27//! `EvenOdd` -> `Positive` default fill-rule flip in 0.3.0 - alongside the
28//! full migration guides for compile-breaking changes.
29
30pub mod bounding_box;
31pub mod cross_section;
32pub mod execution;
33pub mod manifold;
34pub mod mesh;
35pub mod ray;
36pub mod rect;
37pub mod samples;
38pub mod triangulation;
39pub mod types;
40
41pub use bounding_box::BoundingBox;
42pub use cross_section::{CrossSection, FillRule, JoinType, Rect2};
43pub use execution::ExecutionContext;
44pub use manifold::Manifold;
45pub use manifold::{
46 get_circular_segments, reserve_ids, reset_to_circular_defaults, set_circular_segments,
47 set_min_circular_angle, set_min_circular_edge_length,
48};
49pub use mesh::{MeshGL, MeshGL64, MeshGL64Options, MeshGLOptions};
50pub use ray::RayHit;
51pub use rect::Rect;
52pub use triangulation::triangulate_polygons;
53pub use types::{CsgError, OpType};