Skip to main content

brep_solvers/
lib.rs

1//! Constraint solvers of the BREP kernel: 2D and 3D sketches and assemblies.
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//! - the 2D sketch solver;
15//! - the 3D sketch solver;
16//! - the assembly mate solver, its resolution of mates against parts, and assembly ids.
17//!
18//! 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_kernel`](https://crates.io/crates/BREP_kernel).
19//!
20//! ## Building
21//!
22//! The crate builds natively and for `wasm32-unknown-unknown`. The `parallel`
23//! feature runs some per-face loops on rayon; `profile-wall` turns on a diagnostic
24//! wall-time partition. Both are off by default, and `BREP_kernel` forwards them.
25//!
26//! The packaged crate ships the library sources, the README, the licence and the
27//! manifest; it carries no test suite.
28//!
29//! ## License
30//!
31//! The Autodrop3d licence in `LICENSE.md`, shipped in the crate (`license-file` in
32//! the manifest). Source: <https://github.com/mmiscool/next.BREP.io_RUST_BREP_KERNEL>
33// Implementation crate of the kernel: its formerly crate-private items are public for the crates above
34// (documented hidden), and their docs may name private helpers.
35#![allow(rustdoc::private_intra_doc_links)]
36use serde::{Deserialize, Serialize};
37#[allow(unused_imports)]
38use wasm_bindgen::prelude::*;
39#[macro_use]
40extern crate brep_geometry;
41#[allow(unused_imports)]
42#[doc(no_inline)]
43pub use brep_geometry::*;
44#[macro_use]
45extern crate brep_topology;
46#[allow(unused_imports)]
47#[doc(no_inline)]
48pub use brep_topology::*;
49
50#[path = "solvers/sketch_solver.rs"]
51#[doc(hidden)]
52pub mod sketch_solver;
53pub use sketch_solver::{
54    is_sketch_origin_point_id, sketch_id_key, mint_sketch_id, solve_sketch, solve_sketch_from_json,
55    solve_sketch_min_change,
56    SketchSolverSettings, SolveSketchRequest, SKETCH_ORIGIN_POINT_ID,
57};
58#[path = "solvers/assembly_solver.rs"]
59#[doc(hidden)]
60pub mod assembly_solver;
61pub use assembly_solver::{
62    solve_assembly, AssemblyBody, AssemblyMate, AssemblySolution, AssemblySolveOptions, BodyFreedom, BodyPose,
63    LinearAlgebra, MateAlign, MateAxis, MateCurve, MateKind, MatePlane, MateResidualReport,
64    SolveStrategy, SymmetricElement,
65};
66// Assembly selection resolution: a namespaced selection ref resolved to an
67// analytic frame (plane/axis/sphere/circle/line/point) read from the exact
68// BREP, feeding `MateKind` inputs in component-local coordinates.
69#[path = "solvers/sketch3d_solver.rs"]
70#[doc(hidden)]
71pub mod sketch3d_solver;
72pub use sketch3d_solver::{
73    sketch3d_constraint_type, solve_sketch3d, solve_sketch3d_doc, solve_sketch3d_from_json,
74    Sketch3dConstraint, Sketch3dConstraintType, Sketch3dDiagnostics, Sketch3dDoc,
75    Sketch3dGeometry, Sketch3dPoint, Sketch3dSolveOptions, SolveSketch3dRequest,
76    SKETCH3D_CONSTRAINT_TYPES,
77};
78#[path = "solvers/assembly_resolve.rs"]
79#[doc(hidden)]
80pub mod assembly_resolve;
81pub use assembly_resolve::{
82    is_component_reference, resolve_component_point, resolve_edge_selection,
83    resolve_face_selection, resolve_named_selection, resolve_vertex_selection,
84    split_component_namespace, ResolveError, SelectionGeometry,
85};
86
87/// Hash of this crate's source (`build.rs`), one part of the kernel's source stamp.
88#[doc(hidden)]
89pub const SOURCE_HASH: Option<&str> = option_env!("BREP_KERNEL_SOURCE_HASH");
90#[doc(hidden)]
91#[path = "solvers/assembly_ids.rs"]
92pub mod assembly_ids;