1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package math.geom3d;
28
29 import java.io.Serializable;
30
31 import math.geom3d.transform.AffineTransform3D;
32
33
34
35
36 public interface Shape3D extends Serializable {
37
38 public final static double ACCURACY = 1e-12;
39
40 public final static Shape3D EMPTY_SET = new EmptySet3D();
41
42 public abstract boolean isEmpty();
43
44
45
46
47
48
49 public abstract boolean isBounded();
50
51 public abstract Box3D getBoundingBox();
52
53 public abstract Shape3D clip(Box3D box);
54
55 public abstract Shape3D transform(AffineTransform3D trans);
56
57
58
59
60
61 public abstract double getDistance(Point3D p);
62
63 public abstract boolean contains(Point3D point);
64
65
66
67
68 public class EmptySet3D implements Shape3D {
69
70 protected EmptySet3D() {
71 }
72
73
74
75
76 public double getDistance(Point3D p) {
77 return Double.POSITIVE_INFINITY;
78 }
79
80 public boolean isEmpty() {
81 return true;
82 }
83
84 public boolean isBounded() {
85 return false;
86 }
87
88 public boolean contains(Point3D point) {
89 return false;
90 }
91
92 public Box3D getBoundingBox() {
93 return new Box3D(Double.NaN, Double.NaN, Double.NaN, Double.NaN,
94 Double.NaN, Double.NaN);
95 }
96
97 public Shape3D clip(Box3D box) {
98 return this;
99 }
100
101 public Shape3D transform(AffineTransform3D trans) {
102 return this;
103 }
104
105 }
106 }