Expand description
Constraint solvers of the BREP kernel: 2D and 3D sketches and assemblies.
It is one of the implementation crates the kernel is built from. Applications
should depend on BREP_kernel, which
re-exports the public API of every kernel crate at its root (brep_kernel::…)
and adds the feature pipeline and the STEP, IGES, Parasolid (import), 3MF,
GLB, STL and OBJ exchange.
Many items here are public only so the other kernel crates can reach them;
those are hidden from the documentation and carry no stability promise beyond
the kernel’s own. The kernel crates are released together, at one version.
It contains:
- the 2D sketch solver;
- the 3D sketch solver;
- the assembly mate solver, its resolution of mates against parts, and assembly ids.
Kernel crates it requires: BREP_RANSAC, BREP_geometry, BREP_topology. It is required by BREP_kernel.
§Building
The crate builds natively and for wasm32-unknown-unknown. The parallel
feature runs some per-face loops on rayon; profile-wall turns on a diagnostic
wall-time partition. Both are off by default, and BREP_kernel forwards them.
The packaged crate ships the library sources, the README, the licence and the manifest; it carries no test suite.
§License
The Autodrop3d licence in LICENSE.md, shipped in the crate (license-file in
the manifest). Source: https://github.com/mmiscool/next.BREP.io_RUST_BREP_KERNEL
Re-exports§
pub use brep_geometry::*;pub use brep_topology::*;
Structs§
- Assembly
Body - One rigid body of the assembly with its initial (guess) pose.
- Assembly
Mate - One mate between two distinct bodies of the assembly.
- Assembly
Solution - Assembly
Solve Options - Body
Freedom - How free one body is left: free turns (rotations about its own origin) and the remaining free slides (pure translations). Both zero = fully defined.
- Body
Pose - Solved pose of one body (same order as the input
bodiesslice). - Mate
Axis - An axis in a body’s local frame (origin + unit direction).
- Mate
Curve - A curve a curve mate follows, in its body’s LOCAL frame: an edge’s carrier
over the edge’s parameter range
[t0, t1]. - Mate
Plane - A plane in a body’s local frame (origin + unit normal).
- Mate
Residual Report - Worst absolute residual row of one mate at the solution.
- Sketch3d
Constraint - A 3D sketch constraint, kept as a transparent map so authoring metadata (expression text, label offsets) persists exactly.
- Sketch3d
Constraint Type - One constraint type: its
typestring, how many point ids it takes, whether it carries avalue, and a one-line meaning (the editor’s palette reads these; the solver dispatches on the string). - Sketch3d
Diagnostics - The solver’s read-only diagnostics: the same shape the 2D sketch solver
publishes (
dof,rank,unknowns,equations,redundant,status,conflicting,conflictingConstraints,pointMobility,geometryMobility), so the editor’s readouts are shared. - Sketch3d
Doc - The editable 3D sketch document.
- Sketch3d
Geometry - A 3D sketch geometry (see the module doc for the point layouts).
- Sketch3d
Point - A 3D sketch point: world coordinates plus the role flags the solver tracks.
- Sketch3d
Solve Options - Sketch
Solver Settings - Solver tuning knobs. Defaults mirror constraintDefinitions.
- Solve
Sketch3d Request - The JSON request: the document plus optional solver options.
- Solve
Sketch Request
Enums§
- Linear
Algebra - The LM step’s linear algebra (see
AssemblySolveOptions::linear_algebra). - Mate
Align - Direction-sense handling for direction-carrying mates. Mirrors the app’s “oppose normals” flag on parallel/coincident constraints.
- Mate
Kind - Mate geometry + semantics. All points/directions/planes/axes are expressed
in the OWNING body’s local frame (
*_aonbody_a,*_bonbody_b). - Resolve
Error - Typed resolution failure.
Self::statusmaps each variant onto the constraint status vocabulary so the constraint lifecycle reports it without string-matching messages. - Selection
Geometry - A resolved analytic selection frame, in the coordinate space of the solid
it was resolved from (module docs: pass the component’s world→local inverse
to
Self::transformedfor the solver’s component-local mate inputs). - Solve
Strategy - Solving strategy (§7.5–7.6).
Autodecomposes when possible and falls back to the monolithic solve when it must, so it is always safe. - Symmetric
Element - One side of a
MateKind::Symmetricmate, in its owning body’s frame.
Constants§
- SKETC
H3D_ CONSTRAINT_ TYPES - The constraint vocabulary. Point layouts: a LINE is its two endpoints
[a0, a1](directiona1 − a0); a PLANE is[origin, normalTip](normalnormalTip − origin); an ARC is[center, start, end]. - SKETCH_
ORIGIN_ POINT_ ID - The reserved id of every sketch’s PART ORIGIN reference point: world
(0, 0, 0)projected onto the sketch plane. The editor adds it on entry as a fixed, grounded, construction external reference, so geometry can be constrained to the origin. The sketch feature re-projects it onto the resolved frame before solving and never publishes it — it exists only inside the sketch (no scene point, no hole center, no 3D display).
Functions§
- is_
component_ reference ACOMP<digits>— an ACOMP feature id, i.e. a whole-component selection or one namespace segment of a nested chain — or a Pattern Component instance id (APAT1.ACOMP3.i4), which namespaces its geometry the same way.- is_
sketch_ origin_ point_ id - Whether a sketch point id is the reserved
SKETCH_ORIGIN_POINT_ID. - mint_
sketch_ id - Mint a collision-free sketch ID, with caller-selected reserved IDs omitted.
- resolve_
component_ point - Whole-component representative point: the center of the aggregate AABB of every face surface’s control-point hull (plus topology vertices) across the component’s solids. The hull BOUNDS the exact surfaces (convex-hull property) without touching tessellation; it overshoots curved faces, so this is a representative anchor for coincident/parallel-with-component semantics, not an exact bounding box.
- resolve_
edge_ selection - Resolve an edge by topology id (the
EdgeReflane). - resolve_
face_ selection - Resolve a face by topology id (the scene-map
FaceReflane: the caller already resolved the selection name to(handle, face_id)). - resolve_
named_ selection - Resolve a component-LOCAL topology name (already namespace-stripped) against one solid: faces first, then edges. Names never collide across the two kinds under the deterministic-naming scheme; the order only settles pathological ties.
- resolve_
vertex_ selection - Resolve a vertex selection by position (vertices have no kernel names; the renderer references them by owning solid + position). Nearest topology vertex wins — deterministic when two vertices are close — then the scale-relative snap tolerance gates acceptance; the returned point is the EXACT vertex position, not the query.
- sketch3d_
constraint_ type - Look up a constraint type by its
typestring. - sketch_
id_ key - Canonical sketch entity key. Numeric IDs normalize integral floats and signed zero; string IDs are preserved. Other JSON values use their JSON spelling.
- solve_
assembly - Solve the assembly mates in least squares from the bodies’ initial poses.
- solve_
sketch - solve_
sketch3d - Solve a JSON request: returns
{"sketch": {points, geometries, constraints, diagnostics}}, the 2D solver’s response shape. - solve_
sketch3d_ doc - Solve
docin place: the free points take their solved coordinates and the diagnostics describe the constraint system at that configuration. - solve_
sketch3d_ from_ json - Solve a JSON request given as text; the response is JSON text.
- solve_
sketch_ from_ json - split_
component_ namespace - Split a possibly-namespaced topology name into its
ACOMP…:component-id chain (outermost first) and the remaining component-LOCAL name. A segment is peeled only when it matchesACOMP<digits>AND is followed by:, so a bare whole-component reference stays in the LOCAL position — callers detect it withis_component_reference: