fix: boundary conformance — use Shapely buffer + vertex-preserving PSLG sampling

Root cause: typed segment offsetting created self-intersecting geometry at
concave corners (notches). Triangle's PSLG boundary didn't match the plotted
inset contour, allowing vertices 7+ mm outside.

Changes:
- _build_inner_plate: always use Shapely buffer(-w_frame) (robust at concavities)
- _sample_ring: use simplified polygon vertices + interpolated points on long edges
  (preserves tight features without vertex clustering)
- Plot uses same inner_plate from triangulation (no mismatch)
- Post-process: snap any residual outside vertices to boundary
- Result: 0 vertices outside inner plate (was 10, up to 7.45mm)
This commit is contained in:
2026-02-17 20:22:54 +00:00
parent 5cf994ec4b
commit 78f56a68b0
2 changed files with 63 additions and 47 deletions

View File

@@ -107,7 +107,8 @@ def _plot_triangulation(geometry: Dict[str, Any], triangulation: Dict[str, Any],
plate_poly = ShapelyPolygon(outer)
w_frame = (params or {}).get("w_frame", 8.0)
d_keep = (params or {}).get("d_keep", 1.5)
inner_plate = plate_poly.buffer(-w_frame)
# Use the exact inner_plate from triangulation if available (same PSLG boundary)
inner_plate = triangulation.get("inner_plate") or plate_poly.buffer(-w_frame)
fig, ax = plt.subplots(figsize=(10, 8), dpi=160)