Skip to content

Wrong holes order leads to Exception "No progression. The input must be wrong" #13

Description

@theshock

The EarClipping triangulation algorithm fails depending on the order of holes.

Expected Behavior:
Triangulation should succeed regardless of hole order since geometrically it's the same polygon.

Actual Behavior:
Only succeeds when holes are provided in order {hole2, hole1}. When provided as {hole1, hole2}, fails with "No progression" exception.

List<Vector3m> main  = new() { new(6, 6, 0), new(1, 6, 0), new(1, 1, 0), new(6, 1, 0) }; // green on image
List<Vector3m> hole1 = new() { new(2, 4, 0), new(3, 4, 0), new(3, 3, 0), new(2, 3, 0) }; // orange on image
List<Vector3m> hole2 = new() { new(4, 3, 0), new(5, 3, 0), new(5, 2, 0), new(4, 2, 0) }; // red on image
			
// this option works correctly
List<List<Vector3m>> holes = new () { hole2, hole1 };
// this option fails with "No progression" exception
List<List<Vector3m>> holes = new () { hole1, hole2 };

var earClipping = new EarClipping();
earClipping.SetPoints(main, holes);
earClipping.Triangulate();
List<Vector3m>? res = earClipping.Result;
Image Image Image

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions