Expand description
Integration boundary between neutral recognition and BREP topology.
This crate joins the kernel-free brep_ransac recognizer (whose public API
it re-exports) to brep_kernel:
brepconverts between kernel meshes/surfaces and recognition carriers and attaches face metadata;stlreads ASCII and binary STL with deterministic vertex welding;stl_conversionturns a welded STL mesh into a validated STEP document (stl_conversion::convert_stl_mesh_to_step), keeping analytic regions where their boundaries can be rebuilt and otherwise able to fall back to a faceted BREP;import_sessionexposes the region analysis and per-region refits of an interactive mesh import;step_validationchecks STEP faces against exact analytic carriers.
See the README for an overview.
Modules§
- brep
- Optional interoperability with the public
brep_kernelAPI. - import_
session - Interactive mesh import: the phases of a reconstruction as data an application can show while it runs, and the per-region refit a user drives from them.
- step_
validation - STEP face-level validation against exact analytic carriers imported by
brep_kernel. - stl
- Binary and ASCII STL import with deterministic vertex welding.
- stl_
conversion - STL-mesh to STEP conversion orchestration.
Structs§
- Analyzed
Mesh - A validated mesh with cached geometry, topology, and sampling weights.
- Component
Candidate - A carrier another stage already fitted to exactly the triangles of one
connected component, offered to
recognize_surfaces_with_candidates. - Cone
Refine Policy - Iteration and acceptance policy of
refine_cone. - Cone
Surface - One nappe of a right circular cone.
- Constraint
Mask - Parameter-level constraints. Vector fields constrain all three components; axis origins/centers still use the conventional along-axis gauge freedom.
- Cylinder
Surface - An infinite circular cylinder.
- Debug
ObjExport - In-memory Wavefront OBJ geometry and its companion material library.
- FitDiagnostics
- Provenance and execution details for a fitted surface.
- FitMetrics
- Residual and support measurements for a fitted surface.
- Geometric
Error - Residual-only snapshot used to compare a supplied/initialized carrier with the final refined carrier without duplicating support bookkeeping.
- Mesh
- An indexed triangle mesh and optional recognition metadata.
- Mesh
Analysis Options - Controls mesh validation and feature-edge classification.
- Phase
Timings - Optional wall-clock phase measurements. Timing is disabled by default so deterministic results remain bit-for-bit comparable.
- Plane
Surface - A plane represented by a point and unit normal.
- Recognition
Options - Controls surface recognition, refinement, and region discovery.
- Recognition
Result - All recognized regions and triangles left unresolved by discovery.
- Recognition
Work - Work spent by
recognize_surfaces_with_attempt_budget. - Source
Metadata - Versioned sidecar metadata. Stable source IDs are deliberately distinct from sequential tessellation face indices.
- Sphere
Surface - A sphere represented by its center and radius.
- Surface
Constraints - Initial surface parameters and the subset held fixed during fitting.
- Surface
FitResult - The fitted carrier and quality information for one requested selection.
- Surface
Parameter Delta - Gauge-aware change from an initial/supplied carrier to its final carrier.
Fields that do not apply to a primitive remain
None. - Surface
Region - A recognized surface and the mesh triangles assigned to it.
- Torus
Surface - A circular torus represented by its center, axis, and radii.
- Triangle
Data - Geometry and topology derived for one input triangle.
- Unresolved
Region Diagnostic - Why a metadata-associated triangle subset remained unresolved after both metadata-guided reconstruction and generic analytic fallback failed.
- Vec3
- A three-dimensional vector with double-precision components.
Enums§
- Analytic
Surface - Parameters for one supported analytic surface.
- Design
Intent Error - Failure to express a requested design-intent relation with the current parameter-group constraint model.
- FitPath
- The recognition or refinement route that produced a fit.
- Jacobi
Zero Turn - How
jacobi_eigen_symmetric3turns a pivot pair with equal diagonals (tau= ±0, where(1 + tau²)givest = ±1). - Metadata
Trust - Describes how strongly imported metadata should influence fitting.
- Recognition
Error - An error produced while validating geometry or recognizing a surface.
- Sampling
Mode - Selects which geometric samples are used during fitting.
- Surface
Hint - Optional source knowledge used to guide surface recognition.
- Surface
Type - The supported analytic primitive families.
Functions§
- constrain_
concentric_ centers - Fix sphere or torus centers to an existing sphere/torus center.
- constrain_
cylinder_ coaxial - Constrain a cylinder to the complete axis line of another axial carrier. This is safe because a cylinder’s axis origin has gauge freedom along the line; cone apex and torus center locations do not, so those target types are intentionally unsupported here.
- constrain_
equal_ radii - Fix equal radius groups for two carriers of the same type. For tori this copies and fixes both major and minor radii; mixed-type radius semantics are deliberately rejected.
- constrain_
plane_ perpendicular_ to_ axis - Constrain a plane to be perpendicular to a known axis. The plane normal is the axis direction; its offset remains free.
- constrain_
planes_ coplanar - Fix a plane to the same infinite carrier as a reference plane. Tangential origin coordinates are a gauge and are preserved from the target.
- constrain_
planes_ parallel - Preserve parallelism to a reference plane while leaving plane offset free.
- constrain_
planes_ perpendicular - Preserve perpendicularity to a reference plane using the target’s current normal to select the otherwise non-unique perpendicular direction.
- constrain_
shared_ axis - Fix a target cylinder, cone, or torus axis direction to an existing axial carrier. Cone-to-nondirected-carrier transfer is rejected because a cone’s nappe direction is not sign-equivalent.
- constrain_
tangent - Derive exact sphere/plane tangency from the target’s current side and orientation. Other tangency pairs require coupled parameters and are rejected explicitly.
- export_
debug_ obj - Export an input mesh and recognition result as Wavefront OBJ/MTL text.
- jacobi_
eigen_ symmetric3 - Dependency-free Jacobi eigensolver for real symmetric 3x3 matrices.
- kasa_
circle_ 2d - Unweighted least-squares (Kåsa) circle through 2D points: the weighted
fit below at unit weights, centred, with its pivoted-QR fallback for
narrow arcs whose normal equations erase the curvature direction.
Returns
(centre_x, centre_y, radius). - recognize_
surfaces - Discover and reconstruct analytic regions in an entire mesh.
- recognize_
surfaces_ with_ attempt_ budget recognize_surfaces_with_unresolvedwith a cap on the generic hypotheses drawn over the whole call, and optionally fewer primitive kinds to draw them for.- recognize_
surfaces_ with_ candidates recognize_surfaces_with_unresolved, except that a connected component whose own whole fit is refused is first validated on a supplied candidate carrier for exactly its triangles before generic extraction divides it.- recognize_
surfaces_ with_ unresolved - Discover analytic regions and retain triangles that no model accepted.
- reconstruct_
surface - Reconstruct one selected triangle region using an explicit metadata hint.
- reconstruct_
surface_ from_ vertices - Reconstruct one surface from an explicit subset of mesh vertices.
- refine_
cone - Gauss-Newton refinement of a cone over a point slice: apex, unit axis
into the nappe, and half angle, with the six parameters apex (3), two
axis tilts along an orthonormal frame of the axis, and the angle. The
residual of a point is
rho cos(a) - h sin(a)(h along the axis, rho from it). Each step solves the normal equations withsolve_linear.Nonewhen the axis cannot be normalised, a step is singular, or the result is not finite. - segment_
for_ hybrid - The partition the mixed builder starts from: the kernel segmentation with the fragmented cylinder/cone recovery applied, before any boundary is validated or any region demoted. Exposed so a census can read the carrier-accept stage the way the builder sees it.