Skip to content
This repository was archived by the owner on Oct 28, 2026. It is now read-only.

Triangulation tests - #1120

Open
Otcavo wants to merge 3 commits into
AngusJohnson:mainfrom
Otcavo:triangulation-tests
Open

Otcavo wants to merge 3 commits into
AngusJohnson:mainfrom
Otcavo:triangulation-tests

Conversation

@Otcavo

@Otcavo Otcavo commented Oct 24, 2026 •

Copy link
Copy Markdown

Adds C++ unit tests for Triangulate for issue #1076.

Tests run with useDelaunay both on and off where applicable.
Every successful triangulation is checked for triangle count, 3 points per triangle, exact coverage of the input (XOR area 0) and total area.

Cases covered:

  1. Empty input,
  2. A single triangle
  3. A square
  4. An L
  5. Square with a hole
  6. Square with a hole with extra collinear points
  7. Square with a hole and duplicate points
  8. A square with decimal point coordinates
  9. A bowtie (paths_intersect)
  10. Collinear paths (expects no_polygons)
  11. Delaunay: a rhombus split on its short diagonal
  12. And a polygon whose triangulation matches one computed independently in Ipe

All 120 tests passed.

Let me know if we want more!

Edit: Scope: this only adds tests for the current behavior. It doesn’t change Triangulate or address the open triangulate issues (such as #1069) I just wanted a baseline we pass first. Then we can look into the hard cases.

Here's a rough image of the shapes tested

Screenshot 2026-10-24 at 10 39 16 AM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant