Skip to content

Add comprehensive triangle splitting tests#248

Open
TheBeachLab wants to merge 4 commits into
gkjohnson:mainfrom
TheBeachLab:feature/triangle-splitting-tests
Open

Add comprehensive triangle splitting tests#248
TheBeachLab wants to merge 4 commits into
gkjohnson:mainfrom
TheBeachLab:feature/triangle-splitting-tests

Conversation

@TheBeachLab
Copy link
Copy Markdown

Summary

Addresses #73 — adds comprehensive tests for validating triangle splitting correctness.

  • Parameterized test suite runs 8 edge cases against both LegacyTriangleSplitter and CDTTriangleSplitter
  • Seeded fuzz test validates invariants on 100 random triangle pairs per splitter
  • Four invariants checked per split result: area conservation, no degenerate triangles, coplanarity, non-empty output

Test Cases

  • Non-intersecting (parallel offset)
  • Coplanar overlapping (partial overlap)
  • Coplanar identical
  • Vertex-on-edge
  • Vertex-on-vertex
  • Edge-on-edge overlap (shared collinear edge)
  • Clean bisection
  • Near-miss (very close, no intersection)

Test Plan

  • npx vitest run tests/TriangleSplitter.test.js — 18 tests pass
  • npx vitest run — full suite passes (48 tests)
  • npm run lint — 0 errors

TheBeachLab and others added 4 commits March 28, 2026 12:55
Replaces CDTTriangleSplitter with a polygon-aware approach that groups
split sub-triangles into regions for bulk classification, reducing
raycasts and enabling symmetric edge matching across CSG boundaries.
5-task TDD plan: create PolygonSplitter with flood-fill polygon
grouping, wire into Evaluator, update split triangle operations for
bulk classification, add canonical edge sharing, verify with benchmarks.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Parameterized test suite validates both LegacyTriangleSplitter and
CDTTriangleSplitter against 8 edge cases (coplanar, identical,
vertex-on-edge, clean bisection, etc.) plus a seeded fuzz test
with 100 random triangle pairs checking area conservation, coplanarity,
and degenerate triangle invariants.
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