Skip to content

Commit 9d6ce9d

Browse files
committed
Calculate volume and surface when resized
1 parent 62eed3d commit 9d6ce9d

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

  • src/main/java/eu/mihosoft/vrl/v3d

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.util.zip.ZipEntry;
5151
import java.util.zip.ZipOutputStream;
5252

53+
import eu.mihosoft.vrl.v3d.CSG.OptType;
5354
import eu.mihosoft.vrl.v3d.Slice.DefaultSliceImp;
5455
import eu.mihosoft.vrl.v3d.ext.org.poly2tri.PolygonUtil;
5556
import eu.mihosoft.vrl.v3d.ext.quickhull3d.HullUtil;
@@ -1039,6 +1040,8 @@ public CSG scale(Number scaleValue) {
10391040
public CSG clone() {
10401041
CSG csg = cloneShallow();
10411042
CSG historySync = csg.historySync(this);
1043+
historySync.volume = volume;
1044+
historySync.surfaceArea = surfaceArea;
10421045
return historySync;
10431046
}
10441047

@@ -2595,8 +2598,16 @@ public CSG transformed(Transform transform) {
25952598
if (getName().length() != 0) {
25962599
csg.setName(name);
25972600
}
2598-
2599-
return csg.historySync(this);
2601+
if (CSG.getDefaultOptionType() == OptType.Manifold3d) {
2602+
try {
2603+
csg = CSG.getManifold().calculateAreaAndSurfaceArea(csg);
2604+
} catch (Throwable e) {
2605+
// TODO Auto-generated catch block
2606+
e.printStackTrace();
2607+
}
2608+
}
2609+
CSG historySync = csg.historySync(this);
2610+
return historySync;
26002611
}
26012612

26022613
/**
@@ -3128,8 +3139,6 @@ public CSG historySync(CSG dyingCSG) {
31283139
setColor(dyingCSG.getColor());
31293140
// str.syncProperties(dyingCSG.str);
31303141
syncCadoodleCatagories(dyingCSG);
3131-
volume = dyingCSG.volume;
3132-
surfaceArea = dyingCSG.surfaceArea;
31333142
return this;
31343143
}
31353144

0 commit comments

Comments
 (0)