Skip to content

Commit f4918d2

Browse files
committed
make the bounds serializable
1 parent d4caf9a commit f4918d2

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
package eu.mihosoft.vrl.v3d;
77

8+
import java.io.Serializable;
9+
810
import com.google.gson.annotations.Expose;
911

1012
// Auto-generated Javadoc
@@ -13,9 +15,11 @@
1315
*
1416
* @author Michael Hoffer <info@michaelhoffer.de>
1517
*/
16-
public class Bounds {
18+
public class Bounds implements Serializable{
19+
20+
private static final long serialVersionUID = -5067189300959316667L;
1721

18-
/** The center. */
22+
/** The center. */
1923
@Expose (serialize = true, deserialize = true)
2024
private final Vector3d center;
2125

@@ -31,13 +35,13 @@ public class Bounds {
3135
@Expose (serialize = true, deserialize = true)
3236
private final Vector3d max;
3337

34-
/** The csg. */
35-
@Expose (serialize = false, deserialize = false)
36-
private CSG csg;
37-
38-
/** The cube. */
39-
@Expose (serialize = false, deserialize = false)
40-
private Cube cube;
38+
// /** The csg. */
39+
// @Expose (serialize = false, deserialize = false)
40+
// private CSG csg;
41+
//
42+
// /** The cube. */
43+
// @Expose (serialize = false, deserialize = false)
44+
// private Cube cube;
4145

4246
/**
4347
* Constructor.
@@ -92,6 +96,8 @@ public Vector3d getBounds() {
9296
* @return this bounding box as csg
9397
*/
9498
public CSG toCSG() {
99+
CSG csg=null;
100+
Cube cube=null;
95101
if (csg == null) {
96102
cube = new Cube(center, bounds);
97103
csg = cube.toCSG();
@@ -106,6 +112,8 @@ public CSG toCSG() {
106112
* @return this bounding box as cube
107113
*/
108114
public Cube toCube() {
115+
CSG csg=null;
116+
Cube cube=null;
109117
if (cube == null) {
110118
cube = new Cube(center, bounds);
111119
csg = cube.toCSG();

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,8 +972,7 @@ public static CSG unionAll(List<CSG> csgs) {
972972
back = CSGClient.getClient().union(csgs);
973973
return back.get(0);
974974
} catch (Exception e) {
975-
// TODO Auto-generated catch block
976-
e.printStackTrace();
975+
throw new RuntimeException(e);
977976
}
978977
}
979978
}

src/test/java/eu/mihosoft/vrl/v3d/ServerClientTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ public void test() throws Exception {
4141
System.out.println("Client info: " + CSGClient.getClient().getServerInfo());
4242

4343
CSG a = new Cube(20).toCSG();
44+
a.getBounds();
4445
CSG b = new Cube(20, 30, 5).toCSG();
46+
b.getBounds();
4547
CSG c = new Cube(10, 10, 10).toCSG();
48+
c.getBounds();
4649
CSG u = CSG.unionAll(a, b, c);
4750
CSG d = a.difference(b);
4851
CSG t = d.triangulate(true);

0 commit comments

Comments
 (0)