Repository navigation
Conversation
A cyclic order of 0, 1 or 2 elements is unique, so no geometric computation is needed. Previously the segment direction was always computed, so a zero-length segment threw in Segment::direction, e.g. in surface_radial_sort on a degenerated Line edge between two colocated unique vertices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In coplanar segment/triangle detection, best_projection_axis indexed the triangle vertices with longest_edge_index(), which is NO_LID when all the triangle vertices are colocated. This out-of-bounds read made BRepInspector segfault on models with such triangles. The projection axis now only depends on the segment in that case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cpp-Linter Report
|
Two crashes found while converting and inspecting models produced by the in-dev stitching (Geode-Conversion PR on the same branch).
fix(RadialSort): return identity order for fewer than 3 pointsradial_sortalways built its plane fromsegment.direction(), which throws on a zero-length segment.surface_radial_sorthits this on a Line edge between two colocated unique vertices. With 0, 1 or 2 points every cyclic order is the same, so no geometry is needed. With 3+ points around a zero-length segment the sort is still undefined and keeps throwing.fix(IntersectionDetection): handle triangles collapsed to a pointIn the coplanar branch of
segment_triangle_intersection_detection,best_projection_axisindexed the triangle vertices withlongest_edge_index(), which isNO_LIDwhen all three vertices are colocated. The out-of-bounds read madeBRepInspectorsegfault on such models (intersections inspection). The projection axis now only depends on the segment in that case.Tests
test-radial-sort: zero-length segment with 2 points.test-intersection-detection: segment vs triangle collapsed to a point (segfaulted before the fix).🤖 Generated with Claude Code