Skip to content

Commit 8e517cb

Browse files
committed
Repair the extrusion engine to use the correct polygon orentations
1 parent 186a0bf commit 8e517cb

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/main/java/eu/mihosoft/vrl/v3d/Extrude.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)