@@ -71,7 +71,6 @@ public CSG points(Vector3d dir, List<Vector3d> points) throws ColinearPointsExce
7171
7272 List <Vector3d > newList = new ArrayList <>(points );
7373 Polygon fromPoints = Polygon .fromPoints (toCCW (newList ));
74- PolygonUtil .triangulatePolygon (fromPoints );
7574 return extrude (dir , fromPoints );
7675 }
7776
@@ -96,18 +95,18 @@ public CSG extrude(Vector3d dir, Polygon polygon1) {
9695 private CSG monotoneExtrude (Vector3d dir , Polygon polygon1 ) throws ColinearPointsException {
9796 ArrayList <Polygon > newPolygons = new ArrayList <>();
9897 CSG extrude ;
99- Polygon top = polygon1 .flipped ();
100- ArrayList <Polygon > triangulatePolygon = PolygonUtil .triangulatePolygon (top );
101- newPolygons .addAll (triangulatePolygon );
98+ ArrayList <Polygon > triangulatePolygon = PolygonUtil .triangulatePolygon (polygon1 );
99+ for (Polygon p :triangulatePolygon ) {
100+ newPolygons .add (p .flipped ());
101+ newPolygons .add (p .transformed (new Transform ().move (dir )));
102+ }
102103 Polygon polygon2 = polygon1 .transformed (new Transform ().move (dir ));
103104 List <Polygon > parts = Extrude .monotoneExtrude (polygon2 , polygon1 );
104105 newPolygons .addAll (parts );
105106
106107 //ArrayList<Polygon> topPolygons = PolygonUtil.triangulatePolygon(polygon2);
107- for (Polygon p :triangulatePolygon )
108- newPolygons .add (p .flipped ().transformed (new Transform ().move (dir )));
108+
109109 extrude = CSG .fromPolygons (newPolygons );
110-
111110 return extrude ;
112111 }
113112
0 commit comments