BREP_kernel 0.2.0

A boundary representation (BREP) geometry kernel for building CAD applications.
Documentation
//! Direct editing — Golovanov §6.12: "delete face and heal" and "move a face
//! group" (see [`move_faces`] for the sibling operation's algorithm and
//! honest v1 scope).
//!
//! Removes a transition face (a chamfer, a constant-radius fillet, or any
//! simple 4-sided face) that sits between two larger neighbour faces, and
//! heals the resulting hole by EXTENDING the neighbours' carrier surfaces and
//! RE-INTERSECTING them so the neighbours meet each other directly where the
//! deleted face used to be. The classic use is "undo a chamfer/fillet": the
//! two large planes that flanked the bevel extend and re-intersect at the
//! original sharp edge, the end-cap faces lose the bevel corner, and the
//! solid returns to its pre-blend shape.
//!
//! ## Algorithm (extend → re-intersect → re-trim → reconnect)
//!
//! For a 4-sided transition face `F` with neighbours `N0..N3` (one per
//! boundary edge, in loop order):
//!
//! 1. **Classify.** The two neighbours on OPPOSITE boundary edges whose
//!    (planar) carriers re-intersect in a line passing through `F`'s region
//!    are the *primary* pair (the faces to extend and rejoin). The other two
//!    opposite neighbours are the *lateral* faces (the end caps). Exactly one
//!    opposite pairing must qualify, otherwise the heal is refused.
//! 2. **Re-intersect (extend).** Because analytic planes are unbounded
//!    carriers, the primary pair's intersection line `S` is computed in closed
//!    form (no marching within a bounded patch). `S` clipped by each lateral
//!    plane gives the two recovered corner points — the new sharp edge's
//!    endpoints (`triple points`).
//! 3. **Re-trim.** Every side edge that met `F` at a transition corner is
//!    relocated onto the recovered corner; the deleted face's two support
//!    edges become the single new edge `S` in both primary faces; the two
//!    lateral (cap) edges collapse to points. Each affected neighbour face's
//!    carrier plane is rebuilt large enough to cover its new boundary and all
//!    its pcurves are recomputed against it (analytic planes extend for free).
//! 4. **Reconnect.** `F` and its boundary edges/vertices are pruned, `S` and
//!    its two vertices are inserted, the shell is reassembled, the genus is
//!    preserved, and the result must `validate()` or the whole operation is
//!    refused.
//!
//! ## Covered vs deferred (honest scope of this first slice)
//!
//! - COVERED: a 4-sided chamfer/fillet (or any simple 4-edge transition face)
//!   between two PLANAR primary neighbours with two PLANAR lateral caps, convex
//!   or concave. Chamfer (planar transition) and fillet (cylindrical
//!   transition) both reduce to the same planar-neighbour heal. CURVED
//!   ANALYTIC neighbours route to [`heal_open_transition_mixed`], which
//!   handles both curved primaries (plane × cylinder/ruled revolution
//!   re-intersection) and curved lateral caps (the re-intersection branch is
//!   clipped by curve×surface intersection against the cap's carrier).
//! - DEFERRED (returns a clear `Err`, never a bad solid): free-form
//!   neighbours (need NURBS carrier extension + marched re-intersect),
//!   transition faces that are not 4-sided (multi-face gaps), a neighbour that
//!   borders the transition more than once (periodic/closed transition), and
//!   configurations where the neighbours cannot re-intersect cleanly (parallel
//!   planes, non-adjacent healing).

use crate::topology::{CoedgeRecord, EdgeRecord, FaceRecord, VertexRecord};
use crate::transform_topology::{transform_curve, transform_surface};
use crate::{
    build_pcurve_on_surface, build_pcurve_on_surface_range, intersect_analytic_pair,
    intersect_curve_surface, make_line, make_plane, make_revolution, project_point_to_curve,
    solid_signed_volume, AffineTransform, AnalyticSurface, BrepSolid, KnotVector, NurbsCurve,
    NurbsSurface, Vec3,
};
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};

#[path = "direct_edit/geom.rs"]
mod geom;
#[path = "direct_edit/delete_face.rs"]
mod delete_face;
#[path = "direct_edit/face_move.rs"]
mod face_move;
#[path = "direct_edit/closed_heal.rs"]
mod closed_heal;
#[path = "direct_edit/open_carriers.rs"]
mod open_carriers;
#[path = "direct_edit/open_heal.rs"]
mod open_heal;

#[cfg(test)]
#[path = "direct_edit/tests.rs"]
mod tests;
#[cfg(test)]
#[path = "direct_edit/closed_heal_tests.rs"]
mod closed_heal_tests;
#[cfg(test)]
#[path = "direct_edit/open_heal_tests.rs"]
mod open_heal_tests;

use closed_heal::*;
use delete_face::*;
use geom::*;
use open_carriers::*;
use open_heal::*;

pub use delete_face::{delete_face_and_heal, resolve_face_by_point};
pub use face_move::move_faces;