gradientspace / geometry3Sharp

C# library for 2D/3D geometric computation, mesh algorithms, and so on. Boost license.
http://www.gradientspace.com
Boost Software License 1.0
1.71k stars 384 forks source link

Negative value for Triangle index #117

Open mmedinav18 opened 5 years ago

mmedinav18 commented 5 years ago

Hi,

I am running the following code in unity, and everytime I run it, it comes out with an error of the Index being out of range. My thinking is that everytime I try to get the centroid for "triangle2", the index of Triangle 2 is -1, thus creating the error. Could you please explain what's happening? I'd really appreaciate it.

Knit Systems - Microsoft Visual Studio  7_30_2019 10_05_47 PM_LI

Screenshot 7_30_2019 10_01_50 PM_LI

rarora7777 commented 4 years ago

You mesh has a boundary loop. When you query for the neighbouring triangles of a boundary edge, one of the results is InvalidID as expected, since there's only one neighbouring triangle.