VolumeJ
Class VJPlane

java.lang.Object
  |
  +--VolumeJ.VJPlane

public class VJPlane
extends java.lang.Object

VJPlane. Defines a 3D plane equation and methods to create and operate on it. Copyright (c) 1999-2002, Michael Abramoff. All rights reserved.


Constructor Summary
VJPlane(float[] p, float[] q, float[] r)
          Create a new plane through 3 points p, q, r.
VJPlane(float[] p, float[] q, float[] r, VJMatrix m)
          Create a new plane through 3 homogenuous coordinates p, q, r defined in a coordinate system, but define the plane in a transformation of that coordinate system defined by m.
VJPlane(VJPlane p)
          Create a new plane from another plane.
VJPlane(VJPlane p, float[] q)
          Create a new plane parallel to a plane p through a point q.
 
Method Summary
static float check(float x, float y, float z, float a, float b, float c, float d)
          Return the result of a plane equation with a,b,c,d with a point x,y,z filled in.
 float getA()
          Get the A for the plane equation Ax+By+C+D=0 of this plane
 float getB()
          Get the B for the plane equation Ax+By+C+D=0 of this plane
 float getC()
          Get the D for the plane equation Ax+By+C+D=0 of this plane
 float getD()
          Get the D for the plane equation Ax+By+C+D=0 of this plane
 VJGradient getGradient()
          Return the gradient of a plane (the normal vector) as a VJGradient.
 float intersectRay(float x0, float y0)
          Optimization for finding intersection of this plane with a ray running through x0, y0, 0 with derivative 0,0,1.
 void setD(float d)
          Set the D for the plane equation Ax+By+C+D=0 of this plane
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VJPlane

public VJPlane(float[] p,
               float[] q,
               float[] r)
Create a new plane through 3 points p, q, r.
Parameters:
p, - q, r three double[3] points.

VJPlane

public VJPlane(VJPlane p)
Create a new plane from another plane.
Parameters:
p - a VJPlane.

VJPlane

public VJPlane(VJPlane p,
               float[] q)
Create a new plane parallel to a plane p through a point q. Only D in the plane equation is different for parallel planes.
Parameters:
p - a VJPlane to which this plane is to be parallel.
q - a point through which this new plane should also go.

VJPlane

public VJPlane(float[] p,
               float[] q,
               float[] r,
               VJMatrix m)
Create a new plane through 3 homogenuous coordinates p, q, r defined in a coordinate system, but define the plane in a transformation of that coordinate system defined by m.
Parameters:
p, - q, r three double[4] points.
Method Detail

intersectRay

public float intersectRay(float x0,
                          float y0)
Optimization for finding intersection of this plane with a ray running through x0, y0, 0 with derivative 0,0,1. For this line, dx and dy = 0, z0 = 0, dz = 1. Return the intersection in homogoneous coordinates.
Parameters:
x0, - y0 defines the origin of the ray.
Returns:
the z coordinate of the intersection (others are x0, y0).

check

public static float check(float x,
                          float y,
                          float z,
                          float a,
                          float b,
                          float c,
                          float d)
Return the result of a plane equation with a,b,c,d with a point x,y,z filled in. Should be 0.0 if x,y,z, is within the plane.
Parameters:
x,y,z - the point you want to check.
a,b,c,d - the A,B,C,D of a plane equation.

getGradient

public VJGradient getGradient()
Return the gradient of a plane (the normal vector) as a VJGradient.
Returns:
a VJGradient that contains the normal vector of the plane.

getA

public float getA()
Get the A for the plane equation Ax+By+C+D=0 of this plane
Returns:
double the value of A

getB

public float getB()
Get the B for the plane equation Ax+By+C+D=0 of this plane
Returns:
double the value of B

getC

public float getC()
Get the D for the plane equation Ax+By+C+D=0 of this plane
Returns:
double the value of D

getD

public float getD()
Get the D for the plane equation Ax+By+C+D=0 of this plane
Returns:
double the value of D

setD

public void setD(float d)
Set the D for the plane equation Ax+By+C+D=0 of this plane
Parameters:
d - double the value of D

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object