Skip to content

fix(geometry): Triangle3D.Reverse reverses the stored vertex order (Q4) - #228

Merged
michaldengusiak merged 3 commits into
sow/2026-Q4from
fix/triangle3d-reverse-q4
Oct 27, 2026
Merged

michaldengusiak merged 3 commits into
sow/2026-Q4from
fix/triangle3d-reverse-q4

Conversation

@michaldengusiak

Copy link
Copy Markdown

Summary

Triangle3D.Reverse() called points.Reverse() on a Point3D[], which binds to LINQ Enumerable.Reverse and discards its result: a no-op. Query.Volume(Shell) and Create.Mesh3D(Shell) rely on it to correct triangle winding, so neither did. Fix: Array.Reverse(points) (one line). No signature, JSON schema, coordinate, tolerance, area-filter or shell-normal change.

Evidence (record: documentation/Triangle3D-Reverse-Q4.md)

  • Tested content d7a00b6c (fix + tests); the later commit is docs/evidence only. Base 9d8961ec (sow/2026-Q4).
  • New Triangle3DReverseTests (132 cases): red on unchanged source 76 fail / 56 pass; green 132/132. The Box and triangular-prism volume rows pass on old source (consistently wound triangulation) and stay as compatibility guards.
  • Callers: only Shell.Volume and Mesh3D(Shell); none in sibling repositories.
  • Full SAM.Tests 3975/3975; SAM.Core.Grasshopper.Tests 87/87 (local, not hosted CI). No existing expectation or golden changed.
  • Saved Softhouse R1 closeout models (read only, no solver/native): old build reproduces 31.23669 / 36.178925; fixed build gives 31.242936 / 36.17268, within 1e-5 m3 of the independent volume. Only those two cells change. This fully explains the saved ±0.006 m3 defect; no remaining mechanism found.

Limits and recommendations

  • Triangle2D.Reverse() has the same no-op, no callers, left alone. Transform3D.GetRotation(axis, angle) is non-orthonormal (existing, unrelated). 7 open-shell cells return NaN in every build (unchanged).
  • GH versions: recommend no bump in this PR (no component surface change); owner decides under GH-H2. Deployed GH needs a coherent SAM.Geometry.dll redeploy; SAM_OCCT#84 pins are a separate decision.
  • Not merged; PROJECT_PROGRESS.md untouched (post-merge closeout only).

Generated by Michal Dengusiak and CodeClaude

🤖 Generated with Claude Code

michaldengusiak and others added 3 commits October 27, 2026 21:02
Triangle3D.Reverse() called points.Reverse() on its Point3D[]. With System.Linq in scope that binds to
Enumerable.Reverse, whose result was discarded, so the method never changed anything. Its two callers,
Query.Volume(Shell) and Create.Mesh3D(Shell), rely on it to correct triangle winding against the parent face
normal, so both silently kept whatever winding the triangulation produced.

Use Array.Reverse(points) so the stored order is reversed in place. Signature, JSON schema, coordinates,
tolerances, area filters and shell-normal conventions are unchanged.

Adds Triangle3DReverseTests (132 cases): reversal contract (order, normal, signed volume, double reversal, area,
centroid, bounds, segments, clone, JSON, Triangle3DObject) and both callers on analytically known closed solids
with mixed face winding, translations and rotations.

Generated by Michal Dengusiak and CodeClaude

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ted content d7a00b6)

Generated by Michal Dengusiak and CodeClaude

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ix is unchanged (review)

Generated by Michal Dengusiak and CodeClaude

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@michaldengusiak
michaldengusiak marked this pull request as ready for review October 27, 2026 20:22
@michaldengusiak
michaldengusiak merged commit a983700 into sow/2026-Q4 Oct 27, 2026
3 checks passed
@michaldengusiak
michaldengusiak deleted the fix/triangle3d-reverse-q4 branch October 27, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant