Skip to main content

brep_boolean/
lib.rs

1//! Booleans and healing of the BREP kernel: imprint, fragment, boolean assembly, sewing and face merging.
2//!
3//! It is one of the implementation crates the kernel is built from. Applications
4//! should depend on [`BREP_kernel`](https://crates.io/crates/BREP_kernel), which
5//! re-exports the public API of every kernel crate at its root (`brep_kernel::…`)
6//! and adds the feature pipeline and the STEP, IGES, Parasolid (import), 3MF,
7//! GLB, STL and OBJ exchange.
8//! Many items here are public only so the other kernel crates can reach them;
9//! those are hidden from the documentation and carry no stability promise beyond
10//! the kernel's own. The kernel crates are released together, at one version.
11//!
12//! It contains:
13//!
14//! - face splitting, imprinting, edge splits and fragmentation;
15//! - boolean union, subtraction and intersection (`boolean_operation`) with its acceptance checks and oracle;
16//! - healing: curve coalescing, same-surface face merging, sewing and pinched-vertex splits;
17//! - triangle-soup repair into a faceted B-rep, mesh segmentation and spherical mesh unions.
18//!
19//! Kernel crates it requires: [`BREP_RANSAC`](https://crates.io/crates/BREP_RANSAC), [`BREP_geometry`](https://crates.io/crates/BREP_geometry), [`BREP_topology`](https://crates.io/crates/BREP_topology). It is required by [`BREP_construction`](https://crates.io/crates/BREP_construction), [`BREP_blend`](https://crates.io/crates/BREP_blend), [`BREP_offset`](https://crates.io/crates/BREP_offset), [`BREP_direct_edit`](https://crates.io/crates/BREP_direct_edit), [`BREP_kernel`](https://crates.io/crates/BREP_kernel).
20//!
21//! ## Building
22//!
23//! The crate builds natively and for `wasm32-unknown-unknown`. The `parallel`
24//! feature runs some per-face loops on rayon; `profile-wall` turns on a diagnostic
25//! wall-time partition. Both are off by default, and `BREP_kernel` forwards them.
26//!
27//! The packaged crate ships the library sources, the README, the licence and the
28//! manifest; it carries no test suite.
29//!
30//! ## License
31//!
32//! The Autodrop3d licence in `LICENSE.md`, shipped in the crate (`license-file` in
33//! the manifest). Source: <https://github.com/mmiscool/next.BREP.io_RUST_BREP_KERNEL>
34// Implementation crate of the kernel: its formerly crate-private items are public for the crates above
35// (documented hidden), and their docs may name private helpers.
36#![allow(rustdoc::private_intra_doc_links)]
37use serde::{Deserialize, Serialize};
38#[allow(unused_imports)]
39use wasm_bindgen::prelude::*;
40#[macro_use]
41extern crate brep_geometry;
42#[allow(unused_imports)]
43#[doc(no_inline)]
44pub use brep_geometry::*;
45#[macro_use]
46extern crate brep_topology;
47#[allow(unused_imports)]
48#[doc(no_inline)]
49pub use brep_topology::*;
50
51#[path = "edit/split.rs"]
52#[doc(hidden)]
53pub mod split;
54pub use split::{
55    split_solid_by_face_surface, solid_piece_by_plane, split_solid_by_plane, split_solid_by_surface, SplitSurface,
56};
57#[path = "csg/imprint.rs"]
58#[doc(hidden)]
59pub mod imprint;
60pub use imprint::{
61    build_imprints, EdgeSplitRecord, FaceImprints, FaceKey, FacePcurve, ImprintOptions,
62    ImprintPieceRecord, ImprintResultRecord, ImprintVertex, TangentSectionRecord,
63};
64#[path = "csg/feature_scale.rs"]
65#[doc(hidden)]
66pub mod feature_scale;
67#[path = "csg/edge_split.rs"]
68#[doc(hidden)]
69pub mod edge_split;
70pub use edge_split::{apply_edge_splits, apply_edge_splits_with_map};
71#[path = "csg/fragment.rs"]
72#[doc(hidden)]
73pub mod fragment;
74pub use fragment::{
75    fragment_face, fragment_solid, FaceFragmentRecord, FragmentCoedge, FragmentEdgeSource,
76    FragmentLoop, FragmentOrder,
77};
78#[path = "csg/boolean/mod.rs"]
79#[doc(hidden)]
80pub mod boolean;
81pub use boolean::{
82    boolean_operation, boolean_operation_nary, boolean_operation_nary_with_options, boolean_operation_with_diagnostics, boolean_operation_with_diagnostics_at_offset, boolean_split_operands,
83    BooleanOperation, BooleanOptions,
84};
85#[path = "csg/oracle.rs"]
86#[doc(hidden)]
87pub mod oracle;
88pub use oracle::{
89    boolean_residual_fusables, boolean_semantic_disagreement, boolean_semantic_disagreement_nary,
90    OracleReport, ResidualFusable, ResidualKind, SemanticDisagreement, DISAGREEMENT_THRESHOLD,
91};
92#[path = "healing/heal.rs"]
93#[doc(hidden)]
94pub mod heal;
95// The soundness ACCEPTANCE: the one place a construction lane asks "is this
96// result sound enough to return", repairs it where it can and refuses it by
97// name where it cannot. Declared beside the heal pre-pass it is the mirror of
98// — that one removes noise from an operand before the work, this one refuses a
99// wrong answer after it.
100#[path = "healing/accept.rs"]
101#[doc(hidden)]
102pub mod accept;
103pub use accept::{
104    accept_sound, accept_sound_against, accept_sound_against_scoped, resolve_face_crossing, resolve_face_crossing_between,
105    take_crossing_repairs,
106    CrossingRepairRecord,
107};
108#[path = "healing/coalesce.rs"]
109#[doc(hidden)]
110pub mod coalesce;
111pub use coalesce::{concatenate_exact_curve_pieces, merge_curve_continuation_edges};
112#[path = "healing/face_merge.rs"]
113#[doc(hidden)]
114pub mod face_merge;
115// Retained for potential mesh-import repair; no exact operation may fall
116// back to it (offset shell must produce real surfaces or fail loudly).
117#[allow(dead_code)]
118#[path = "healing/faceted_repair.rs"]
119#[doc(hidden)]
120pub mod faceted_repair;
121pub use face_merge::{merge_faces_within, merge_same_surface_faces, merge_same_surface_faces_excluding, merge_same_surface_faces_scoped};
122pub use faceted_repair::{mesh_to_faceted_brep, repair_triangle_soup, MeshRepairReport};
123#[path = "healing/sew.rs"]
124#[doc(hidden)]
125pub mod sew;
126pub use sew::{sew_rotated_copies, sew_solid, split_pinched_vertices, SewReport};
127#[path = "meshing/mesh_segment.rs"]
128#[doc(hidden)]
129pub mod mesh_segment;
130pub use mesh_segment::{
131    mesh_regions_to_brep, segment_mesh_faces, MeshRegion, MeshSegmentation, RegionCarrier,
132    SegmentOptions, UNASSIGNED_REGION,
133};
134
135#[path = "meshing/spherical_union.rs"]
136#[doc(hidden)]
137pub mod spherical_union;
138pub use spherical_union::reconstruct_spherical_mesh_union;
139
140/// Hash of this crate's source (`build.rs`), one part of the kernel's source stamp.
141#[doc(hidden)]
142pub const SOURCE_HASH: Option<&str> = option_env!("BREP_KERNEL_SOURCE_HASH");