poly2tri-cs icon indicating copy to clipboard operation
poly2tri-cs copied to clipboard

Getting Error "EdgeEvent - Point on constrained edge not supported yet" in c#

Open Supriya05 opened this issue 9 years ago • 6 comments

Hello, When i am trying to convert some polygon points to triangle i am getting following error please help me out. " EdgeEvent - Point on constrained edge not supported yet "

my data point is as follow.

0,0 26.1011,0 26.3587,16.8932 22.9269,14.909 22.5945,1.7841 3.3232,1.7841 3.3232,15.0749 22.9269,14.909 26.3587,16.8932 -0.219999999999999,17.0728

Supriya05 avatar Feb 26 '16 11:02 Supriya05

In your case this is because you have points within the polygon that are duplicates. The c# version of poly2tri does not appear to support multiple points in a path that exist at the same point in space. It also does not appear to support self-intersecting polygons.

I posted this response mainly for anyone else having the same issue, as i doubt the OP is still waiting for an answer over a year later.

64bit-Paperclip avatar Apr 22 '17 06:04 64bit-Paperclip

So, if I understood I can't have points with the same X or Y? https://pastebin.com/k1swSSfq

And, why is this not implemented?

// TODO: Split edge in two
////            splitEdge( ep, eq, p1 );
//            edgeEvent( tcx, p1, eq, triangle, point );
//            edgeEvent( tcx, ep, p1, triangle, p1 );
//            return;

If I comment the Exception part and I put a return; on this lines a StackOverflowException happens in: https://github.com/MaulingMonkey/poly2tri-cs/blob/master/Utility/FixedArray3.cs#L59

z3nth10n avatar Dec 04 '18 04:12 z3nth10n

The can not have the same X AND Y, you can have duplicate X's or Duplicate Y's, but you can not have multiple entries that have the same X AND Y.

Also the path may not intersect itself. So something like a figure 8 is self intersecting and would fail.

From your post, it sounds like your path is self intersecting.

64bit-Paperclip avatar Dec 04 '18 18:12 64bit-Paperclip

I have erased any duplicated point (calling Linq Distinct with a own class that inherits from IEqualityComparer), try to paste (the Pastebin I provided) it on Sublime Text and do the following:

...

You will notice that any point is duplicated...

z3nth10n avatar Dec 09 '18 20:12 z3nth10n

Distinct points is only one thing that must be adhered to.

The second part is the geometry can not be self intersecting. Which means two line segments can not cross or overlap in any way.

I can not tell from looking at the points, but from your previous posts, it seems that its more then likely your geometry is self intersecting.

64bit-Paperclip avatar Dec 11 '18 01:12 64bit-Paperclip

I solved this using LibTessDotNet. Sorry.

https://www.youtube.com/watch?v=7yY3MIyRtPw

https://www.youtube.com/watch?v=7dFpMTP9NFc

In the first video, the points I provided was cyan and magenta pixels, you can see they aren't self-intersecting.

z3nth10n avatar Dec 12 '18 20:12 z3nth10n