Skip to content

Commit afceaf4

Browse files
committed
fix bug where the triangulate method returns the incorectly orented
polygon. It should fast return
1 parent 1a8aad3 commit afceaf4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/java/eu/mihosoft/vrl/v3d/ext/org/poly2tri/PolygonUtil.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@ public static ArrayList<Polygon> triangulatePolygon(Polygon incoming) throws Col
594594
return result;
595595
if (incoming.getVertices().size() < 3)
596596
return result;
597+
if (incoming.getVertices().size() == 3) {
598+
result.add(incoming);
599+
return result;
600+
}
597601
Polygon tmp = incoming;
598602
Vector3d normalOfPlane = incoming.getPlane().getNormal().clone();
599603
normalOfPlane.normalize();
@@ -624,10 +628,7 @@ public static ArrayList<Polygon> triangulatePolygon(Polygon incoming) throws Col
624628
// }
625629
// }
626630
try {
627-
if (concave.size() == 3) {
628-
result.add(concave);
629-
} else
630-
makeTriangles(concave, cw, result, zplane, normalOfPlane, debug, orientationInv, reorient,
631+
makeTriangles(concave, cw, result, zplane, normalOfPlane, debug, orientationInv, reorient,
631632
incoming.getColor());
632633
} catch (java.lang.IllegalStateException ex) {
633634

0 commit comments

Comments
 (0)