wo80 / Triangle.NET

C# / .NET version of Jonathan Shewchuk's Triangle mesh generator.
442 stars 81 forks source link

Getting Topological inconsistency after splitting a segment on simple data #1

Closed jmaeding closed 6 years ago

jmaeding commented 6 years ago

I was very happy to find triangle.net, and am working through an issue. I hope this project is still alive, last activity was a while ago.

Here is the data, it is three segments x,y,z vals: Seg 1 from = 3470.24446228851,2026.74647195611,0.081678324900508 to = 3470.23824070941,2025.38518075843,0 Seg 2 from = 3470.23824070941,2025.38518075843,0 to = 3470.23554561524,2024.79548995642,-0.040289679343289 Seg 3 from = 3470.23824070941,2025.3851807584,0 to = 3469.65964599373,2025.84786418632,0

These are rounded to 15 sig figs I noticed if I move the data closer to 0,0 the problem stops. Hopefully this small set of data will be simple enough to reveal the problem. thanks

Geri-Borbas commented 6 years ago

Hi, I don't support the library, as I'm not the author (which is stated in both the description, and the README by the way), I just mirrored it to GitHub.

I recommend to open this issue at the original repository at triangle.codeplex.com. I did found Christian Woltering (the author) there numerous times, so he may support your issue as well.

jmaeding commented 6 years ago

wow, thanks for the fast reply. I knew you were not the author, just looking for a live body that could direct me to other live bodies so thanks!

Geri-Borbas commented 6 years ago

I can see some similar issues there with some feedback: https://triangle.codeplex.com/discussions/663461

Some said "I added a contour twice to the polygon".

jmaeding commented 6 years ago

Right, that is not my issue though. I am adding 3 segments that connect to a center like 3 spokes. Its something to do with the decimal places and I can get my 3 segment dataset to work if I round down numbers, but that fix does not work when I run on my larger dataset. I posted on codeplex so we'll see. I likely should make the .node...files to try on the c++ version too.

jmaeding commented 6 years ago

Now that I said that, I wonder if adding that center point 3 times is a no-no. It is shared by the three segments so maybe I need to detect dupe verticies and re-use just one for three segs. hmmmm.

Geri-Borbas commented 6 years ago

I recommend to look up the original documentation at http://www.cs.cmu.edu/~quake/triangle.html. If there are any limitations, you may find it there.

jmaeding commented 6 years ago

I figured it out, soooooooooo stoked. As I was doing test cases, I noticed triangles were being split where I did not have points. I thought I had set minimum angle to 0, and I had, so why was this happening? I looked at the ConstraintOptions class and noticed the SegmentSplitting param. Sounds about exactly what I did not want on, so I set to 2. It worked. I tried on my "large dataset" way away from 0,0 and it worked perfect. I think my idea of no duplicate verts might be needed when segmentsplitting is on, but never tried it. Hopefully others benefit from my 8 hours playing around with this.

Geri-Borbas commented 6 years ago

Happy to hear! Thanks for sharing.