nofaceinbook / muxp

Mesh Updater X-Plane
GNU Lesser General Public License v3.0
18 stars 3 forks source link

Earclipping Issue for a specific polygon #41

Closed nofaceinbook closed 4 years ago

nofaceinbook commented 4 years ago

Following polygon is not correctly earclipped: Earclip does only return 1 trias for poly: [(-1.73886133, 52.4488598), [-1.738770753631393, 52.44901081401589], [-1.73869306763205, 52.44914214323331], [-1.738756538837332, 52.4492933870178], [-1.739204480611145, 52.44967006867019], [-1.739479300504617, 52.44956487694346], [-1.739119048685761, 52.44919916315138], (-1.73912982, 52.4491283), [-1.7400015259021897, 52.45], [-1.7383344777599756, 52.45], [-1.7383344777599756, 52.448332951857786]] And further example: Earclip does only return 2 trias for poly: [(-1.74233089, 52.45399527), [-1.742220674276553, 52.4541040682722], [-1.742394268094164, 52.45430741201233], [-1.742448033537831, 52.45441045569811], [-1.742575615285088, 52.45444448937599], [-1.742644442654332, 52.45436410763814], [-1.74247872712922, 52.45419289752289], (-1.74249135, 52.45415591), [-1.7433337148088808, 52.4549992370489], [-1.742659737338951, 52.45495856800114], [-1.7416685740444038, 52.45333218890669]]

nofaceinbook commented 4 years ago

Issue seems to be the function InTriangle(a,b,c,x) of Earclip. Setting Epsilon smaller helps. Then 4 is a ear (not conflicting with 5) after 3 was already cut off. However function is assuming that point 3 is within triangle of points (9, 10, 0). This would be an other ear that should be found. Picture refers to the first not working example above. issueEarclippInTrriangleFunction

nofaceinbook commented 4 years ago

Solved with new In-Triangle-Test.