Skip to main content

Crate brep_solvers

Crate brep_solvers 

Source
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§

AssemblyBody
One rigid body of the assembly with its initial (guess) pose.
AssemblyMate
One mate between two distinct bodies of the assembly.
AssemblySolution
AssemblySolveOptions
BodyFreedom
How free one body is left: free turns (rotations about its own origin) and the remaining free slides (pure translations). Both zero = fully defined.
BodyPose
Solved pose of one body (same order as the input bodies slice).
MateAxis
An axis in a body’s local frame (origin + unit direction).
MateCurve
A curve a curve mate follows, in its body’s LOCAL frame: an edge’s carrier over the edge’s parameter range [t0, t1].
MatePlane
A plane in a body’s local frame (origin + unit normal).
MateResidualReport
Worst absolute residual row of one mate at the solution.
Sketch3dConstraint
A 3D sketch constraint, kept as a transparent map so authoring metadata (expression text, label offsets) persists exactly.
Sketch3dConstraintType
One constraint type: its type string, how many point ids it takes, whether it carries a value, and a one-line meaning (the editor’s palette reads these; the solver dispatches on the string).
Sketch3dDiagnostics
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.
Sketch3dDoc
The editable 3D sketch document.
Sketch3dGeometry
A 3D sketch geometry (see the module doc for the point layouts).
Sketch3dPoint
A 3D sketch point: world coordinates plus the role flags the solver tracks.
Sketch3dSolveOptions
SketchSolverSettings
Solver tuning knobs. Defaults mirror constraintDefinitions.
SolveSketch3dRequest
The JSON request: the document plus optional solver options.
SolveSketchRequest

Enums§

LinearAlgebra
The LM step’s linear algebra (see AssemblySolveOptions::linear_algebra).
MateAlign
Direction-sense handling for direction-carrying mates. Mirrors the app’s “oppose normals” flag on parallel/coincident constraints.
MateKind
Mate geometry + semantics. All points/directions/planes/axes are expressed in the OWNING body’s local frame (*_a on body_a, *_b on body_b).
ResolveError
Typed resolution failure. Self::status maps each variant onto the constraint status vocabulary so the constraint lifecycle reports it without string-matching messages.
SelectionGeometry
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::transformed for the solver’s component-local mate inputs).
SolveStrategy
Solving strategy (§7.5–7.6). Auto decomposes when possible and falls back to the monolithic solve when it must, so it is always safe.
SymmetricElement
One side of a MateKind::Symmetric mate, in its owning body’s frame.

Constants§

SKETCH3D_CONSTRAINT_TYPES
The constraint vocabulary. Point layouts: a LINE is its two endpoints [a0, a1] (direction a1 − a0); a PLANE is [origin, normalTip] (normal normalTip − 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 EdgeRef lane).
resolve_face_selection
Resolve a face by topology id (the scene-map FaceRef lane: 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 type string.
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 doc in 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 matches ACOMP<digits> AND is followed by :, so a bare whole-component reference stays in the LOCAL position — callers detect it with is_component_reference: