1 package edu.berkeley.qfat.geom;
2 import javax.media.opengl.*;
4 public class Plane implements AffineConstraint {
6 // FIXME: could be given by
10 public final float dvalue;
12 public Plane(Point p, Vec norm) {
13 this.norm = norm.norm();
14 this.dvalue = p.x*this.norm.x+p.y*this.norm.y+p.z*this.norm.z;
17 /** provided at least one of a,b,c is nonzero, return the Plane representing ax+by+cz=d */
18 public Plane(float a, float b, float c, float d) {
19 throw new RuntimeException("not implemented yet");
22 public Point intersect(Plane p1, Plane p2) {
24 float z = p1.norm.dot(p2.norm.cross(p3.norm));
25 if (Math.abs(z) < 0.0001) return null; // planes do not intersect at a point
26 Vec v1 = p2.norm.cross(p3.norm).times(-1 * p1.dvalue);
27 Vec v2 = p3.norm.cross(p1.norm).times(-1 * p2.dvalue);
28 Vec v3 = p1.norm.cross(p2.norm).times(-1 * p3.dvalue);
29 return Point.ZERO.plus(v1.plus(v2).plus(v3).times(1/z));
32 public Point getProjection(Point p) {
33 throw new RuntimeException("not implemented yet");
36 public AffineConstraint intersect(AffineConstraint c, float epsilon) {
37 throw new RuntimeException("not implemented yet");