Skip to main content

Crate brep_reconstruction

Crate brep_reconstruction 

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

  • brep converts between kernel meshes/surfaces and recognition carriers and attaches face metadata;
  • stl reads ASCII and binary STL with deterministic vertex welding;
  • stl_conversion turns 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_session exposes the region analysis and per-region refits of an interactive mesh import;
  • step_validation checks STEP faces against exact analytic carriers.

See the README for an overview.

Modules§

brep
Optional interoperability with the public brep_kernel API.
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§

AnalyzedMesh
A validated mesh with cached geometry, topology, and sampling weights.
ComponentCandidate
A carrier another stage already fitted to exactly the triangles of one connected component, offered to recognize_surfaces_with_candidates.
ConeRefinePolicy
Iteration and acceptance policy of refine_cone.
ConeSurface
One nappe of a right circular cone.
ConstraintMask
Parameter-level constraints. Vector fields constrain all three components; axis origins/centers still use the conventional along-axis gauge freedom.
CylinderSurface
An infinite circular cylinder.
DebugObjExport
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.
GeometricError
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.
MeshAnalysisOptions
Controls mesh validation and feature-edge classification.
PhaseTimings
Optional wall-clock phase measurements. Timing is disabled by default so deterministic results remain bit-for-bit comparable.
PlaneSurface
A plane represented by a point and unit normal.
RecognitionOptions
Controls surface recognition, refinement, and region discovery.
RecognitionResult
All recognized regions and triangles left unresolved by discovery.
RecognitionWork
Work spent by recognize_surfaces_with_attempt_budget.
SourceMetadata
Versioned sidecar metadata. Stable source IDs are deliberately distinct from sequential tessellation face indices.
SphereSurface
A sphere represented by its center and radius.
SurfaceConstraints
Initial surface parameters and the subset held fixed during fitting.
SurfaceFitResult
The fitted carrier and quality information for one requested selection.
SurfaceParameterDelta
Gauge-aware change from an initial/supplied carrier to its final carrier. Fields that do not apply to a primitive remain None.
SurfaceRegion
A recognized surface and the mesh triangles assigned to it.
TorusSurface
A circular torus represented by its center, axis, and radii.
TriangleData
Geometry and topology derived for one input triangle.
UnresolvedRegionDiagnostic
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§

AnalyticSurface
Parameters for one supported analytic surface.
DesignIntentError
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.
JacobiZeroTurn
How jacobi_eigen_symmetric3 turns a pivot pair with equal diagonals (tau = ±0, where (1 + tau²) gives t = ±1).
MetadataTrust
Describes how strongly imported metadata should influence fitting.
RecognitionError
An error produced while validating geometry or recognizing a surface.
SamplingMode
Selects which geometric samples are used during fitting.
SurfaceHint
Optional source knowledge used to guide surface recognition.
SurfaceType
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_unresolved with 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 with solve_linear. None when 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.