import javax.media.opengl.glu.*;
/** point in 3-space; immutable */
-public final class Point extends HasPoint implements HasBoundingBox {
+public final class Point implements HasBoundingBox, AffineConstraint, HasPoint {
+
+ public static final Point ZERO = new Point(0,0,0);
+
public final float x, y, z;
+
public Point(double x, double y, double z) { this((float)x, (float)y, (float)z); }
public Point(float x, float y, float z) { this.x = x; this.y = y; this.z = z; }
- public static final Point ORIGIN = new Point(0,0,0);
-
public float distance(Point p) { return (float)Math.sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)+(z-p.z)*(z-p.z)); }
public Vec minus(Point p) { return new Vec(x-p.x, y-p.y, z-p.z); }
public float getMinY() { return y; }
public float getMaxZ() { return z; }
public float getMinZ() { return z; }
+
+ public Point getProjection(Point p) { return this; }
+ public AffineConstraint intersect(AffineConstraint c, float epsilon) {
+ if (c.getProjection(this).distance(this) <= epsilon) return this;
+ return AffineConstraint.NONE;
+ }
+ public AffineConstraint multiply(Matrix m) { return m.times(this); }
+
}