File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
src/main/java/eu/mihosoft/vrl/v3d Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -1520,10 +1520,15 @@ public CSG triangulate(boolean fix) {
15201520
15211521 private void performTriangulation () {
15221522 ArrayList <Polygon > toAdd = new ArrayList <Polygon >();
1523-
1524- Stream <Polygon > polygonStream ;
1525- polygonStream = polygons .stream ();
1526- polygonStream .forEach (p -> updatePolygons (toAdd , p ));
1523+ int failedPolys = 0 ;
1524+ for (int i =0 ;i <polygons .size ();i ++) {
1525+ Polygon p = polygons .get (i );
1526+ CSG ret = updatePolygons (toAdd , p );
1527+ if (ret ==null )
1528+ failedPolys ++;
1529+ }
1530+ if (failedPolys >0 )
1531+ System .out .println ("Pruned " +failedPolys +" polygons from CSG " +getName ());
15271532 if (toAdd .size () > 0 ) {
15281533 setPolygons (toAdd );
15291534 }
@@ -1695,11 +1700,13 @@ private CSG updatePolygons(ArrayList<Polygon> toAdd, Polygon p) {
16951700 }
16961701 }else {
16971702 System .err .println ("Polygon is colinear, removing " +p );
1703+ return null ;
16981704 }
16991705 } catch (Throwable ex ) {
1700- System .err .println ("Failed to triangulate " +p );
1701- ex .printStackTrace ();
1706+ // System.err.println("Failed to triangulate "+p);
1707+ // ex.printStackTrace();
17021708 progressMoniter .progressUpdate (1 , 1 , "Pruning bad polygon CSG::updatePolygons " + p , null );
1709+ return null ;
17031710 }
17041711
17051712 }
You can’t perform that action at this time.
0 commit comments