mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 10:06:47 +00:00
173ab2a311
fillet_loop() (the active FilletRadius path, called from IfcSweptDiskSolid)
was unfinished ("@todo untested from here") and crashed with GEO027
"BRepAdaptor_Curve::No geometry" on every IfcSweptDiskSolidPolygonal that
carries a FilletRadius, emitting no geometry. Four defects:
1. polygon_from_points() shares one point instance between adjacent edges;
filleting insets it twice so the arc edge collapses to start == end.
2. (b - 1) % size with unsigned size mis-indexes the previous edge at b = 0.
3. Every vertex was filleted, including the two open-polyline endpoints; at
an endpoint the corner is degenerate (ba.cross(bc) == 0), giving a
zero-geometry circle, which is the GEO027 crash.
4. The arc centre was offset along the plane normal (out of plane) instead
of the interior bisector, and the axis sign selected the major arc.
fillet_loop now deduplicates the shared corner points, uses (b + n - 1) % n,
detects an open directrix geometrically and skips its endpoints, places the
arc centre on the bisector at radius / sin(angle / 2), derives the axis from
the two tangent points so the minor (fillet) arc is swept, and clamps the
acos argument. A polyhedral guard logs GEO328 and skips a genuinely curved
directrix instead of mangling it.
Verified on OCC 7.9.2: the reported 3D-poly file goes from a GEO027 crash
to a rounded solid; a well-fitting radius (0.1) is a closed manifold (520
verts, 0 boundary / 0 non-manifold edges); the 2D indexed-polycurve case is
fixed identically; a curved line+arc directrix no longer crashes or mangles
(closed manifold); and the no-fillet path is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>