checkpoint
[anneal.git] / src / edu / berkeley / qfat / geom / Plane.java
index fe23b83..966eebf 100644 (file)
@@ -79,10 +79,17 @@ public class Plane implements AffineConstraint {
 
         } else if (c instanceof Line) {
             Line l = (Line)c;
-            if ( Math.abs(a + b*l.m + this.c*l.n) <= epsilon &&
-                 Math.abs(b * l.c + this.c * l.d + d) <= epsilon)
+            if (Math.abs(a + b*l.m + this.c*l.n)     <= epsilon &&
+                Math.abs(b * l.c   + this.c*l.d + d) <= epsilon)
                 return l;
-            throw new RuntimeException("not yet implemented");
+
+            // FIXME: parallel case
+
+            float x = (d - b*l.c - this.c*l.d) / (a + b*l.m + this.c*l.n);
+            float y = l.m*x+l.c;
+            float z = l.n*x+l.d;
+            return new Point(x,y,z);
+            //throw new RuntimeException("not yet implemented");
 
         } else
             return c.intersect(this, epsilon);