Geometric Clearance Inspector
An independent Python prototype for screening geometric relationships in a synthetic assembly and generating a structured inspection record.
- Inspected pair
- A · Base plate ↔ B · Bracket
- Signed separation
- +1.50 u
- Screening threshold
- 2.50 u
- Screening state
- CLOSE
The gap is within the screening threshold.
How can a repetitive geometric check be made explicit, repeatable and inspectable?
- 01Geometry4 components · uInvented rectangles with a position and a rotation.
- 02Relationships = +1.50 uSigned separation of the chosen pair.
- 03Screeningt = 2.50 u → CLOSECompare with a threshold and assign a state.
- 04ReportINS-515DE53DA structured record of the run.
Move the components. The check runs again.
You are operating a synthetic demonstration. The values are arbitrary and do not come from any real assembly.
The interactive inspector needs JavaScript. The figures on this page show the default state of the synthetic assembly. The Python source in the project folder runs the same logic from the command line.
Separation, proximity or intersection
The view is fitted to the inspected pair. You set the state with the controls above. It is not a finding.
geometry → relationship → threshold → screening state
The values below are computed from the current geometry. Nothing is pre-scripted.
- 01Separating-axis testProject both shapes on the 8 edge normals. Largest gap along a test axis: 1.50 u.Separating axis found: the shapes are separated.
- 02Signed separation sseparated: s = + nearest vertex-to-edge distance · intersecting: s = − smallest overlaps = +1.50 u (gap)
- 03Compare with threshold t = 2.50 us > tCLEARANCE0 ≤ s ≤ tCLOSEs < 0INTERACTION
- 04Screening stateCLOSE
Every run produces a structured record
The record changes when the geometry changes. Run identifier: a fingerprint of the inputs, so the same inputs give the same identifier.
| Inspection ID | INS-515DE53D |
|---|---|
| Component A | A · Base plate |
| Component B | B · Bracket |
| Geometric state | SEPARATED |
| Screening threshold | 2.500 u |
| Calculated relationship | +1.500 u (gap) |
| Screening result | CLOSE |
| Run identifier | 515DE53D |
Synthetic demonstration. Screening prototype on invented 2D geometry. Not CAD-kernel geometry.
Five small stages, one file each
The Python package is the reference implementation. This page runs a JavaScript port of the same algorithm so it works in a browser. The port is compared with the Python results on generated test cases (372 cases, same inputs, same outputs within 1e-9).
- 01Geometry input
scenario.py
Component, HOME - 02Transformation
geometry.py
polygon() - 03Geometric screening
screening.py
relationship() - 04Threshold logic
screening.py
classify() - 05Inspection record
report.py
build_record()
def _sat(a, b):
"""Return (separating_axis_found, smallest projection overlap over all axes)."""
smallest = np.inf
for n in np.vstack([_normals(a), _normals(b)]):
pa, pb = a @ n, b @ n
overlap = min(pa.max(), pb.max()) - max(pa.min(), pb.min())
smallest = min(smallest, overlap)
return smallest <= EPS, float(smallest)
def classify(signed_separation: float, threshold: float) -> str:
"""Threshold comparison. Boundary values: s == 0 and s == t are CLOSE."""
if signed_separation < 0:
return "INTERACTION"
if signed_separation <= threshold:
return "CLOSE"
return "CLEARANCE"
Run one inspection from the command line:
What this prototype does and does not do
- Takes four invented rectangles with a position and a rotation.
- Computes a signed separation for a chosen pair, using the separating-axis test and an exact vertex-to-edge distance.
- Compares it with a threshold you set and assigns CLEARANCE, CLOSE or INTERACTION.
- Writes a structured inspection record for every run.
- Gives the same result in Python and in the browser port.
- Simplified synthetic geometry: 2D rectangles only.
- Screening logic, not full CAD geometry.
- No tolerance-stack certification.
- No production release.
- No physical validation.
- No proprietary data.
- No replacement for a commercial CAD kernel.
- Overlap depth is a minimum translation distance, not an overlap volume.
- The units are arbitrary. No value on this page describes a real part.