checkpoint
[anneal.git] / src / edu / berkeley / qfat / geom / Segment.java
diff --git a/src/edu/berkeley/qfat/geom/Segment.java b/src/edu/berkeley/qfat/geom/Segment.java
new file mode 100644 (file)
index 0000000..8a1febd
--- /dev/null
@@ -0,0 +1,19 @@
+package edu.berkeley.qfat.geom;
+import javax.media.opengl.*;
+
+/** a line segment defined by two points in space */
+public class Segment implements HasBoundingBox {
+
+    public final Point p1;
+    public final Point p2;
+
+    public Segment(Point p1, Point p2) { this.p1 = p1; this.p2 = p2; }
+
+    public float getMaxX() { return Math.max(p1.x, p2.x); }
+    public float getMinX() { return Math.min(p1.x, p2.x); }
+    public float getMaxY() { return Math.max(p1.y, p2.y); }
+    public float getMinY() { return Math.min(p1.y, p2.y); }
+    public float getMaxZ() { return Math.max(p1.z, p2.z); }
+    public float getMinZ() { return Math.min(p1.z, p2.z); }
+
+}