3 import java.awt.event.*;
5 import javax.media.opengl.*;
6 import javax.media.opengl.glu.*;
10 private HashMap<P,P> ps = new HashMap<P,P>();
12 public P newP(float x, float y, float z) {
15 if (p2 != null) return p2;
20 /** point in 3-space */
22 public final float x, y, z;
23 public P(float x, float y, float z) { this.x = x; this.y = y; this.z = z; }
24 public V minus(P p) { return null; }
25 public boolean equals(Object o) {
26 if (o==null || !(o instanceof P)) return false;
28 return p.x==x && p.y==y && p.z==z;
30 public int hashCode() {
32 Float.floatToIntBits(x) ^
33 Float.floatToIntBits(y) ^
34 Float.floatToIntBits(z);
38 /** vector in 3-space */
40 private final float x, y, z;
41 public V(float x, float y, float z) { this.x = x; this.y = y; this.z = z; }
42 public V norm() { return null; /* FIXME */ }
43 public boolean sameDirection(V v) { throw new Error(); }
44 public V cross(V v) { return null; }
49 public final P p1, p2;
51 public E(P p1, P p2) { this.p1 = p1; this.p2 = p2; }
52 public boolean equals(Object o) {
53 if (o==null || !(o instanceof E)) return false;
55 if (this.p1 == e.p1 && this.p2 == e.p2) return true;
56 if (this.p2 == e.p1 && this.p1 == e.p2) return true;
59 public P shared(E e) { return null; }
62 /** a triangle (face) */
64 public final E e1, e2, e3;
65 public T(E e1, E e2, E e3, V normal) {
69 V norm = p2.minus(p1).cross(p3.minus(p1));
70 if (norm.sameDirection(normal)) {
84 return p2.minus(p1).cross(p3.minus(p1)).norm();
86 public T(E e1, E e2, E e3) { this.e1 = e1; this.e2 = e2; this.e3 = e3; }