public class Plane
extends java.lang.Object
Constructor and Description |
---|
Plane(double a,
double b,
double c,
double d)
Constructs a plane with specified coefficients.
|
Plane(Plane p)
Constructs a copy of the specified plane.
|
Plane(Point3 p,
Vector3 n)
Constructs a plane.
|
Modifier and Type | Method and Description |
---|---|
double |
distanceTo(double x,
double y,
double z)
Returns the signed distance from this plane to a specified point.
|
double |
distanceTo(Point3 p)
Returns the signed distance from this plane to a specified point.
|
double |
getA()
Gets the plane coefficient a.
|
double |
getB()
Gets the plane coefficient b.
|
double |
getC()
Gets the plane coefficient c.
|
double |
getD()
Gets the plane coefficient d.
|
Vector3 |
getNormal()
Gets the unit-vector normal to this plane.
|
void |
set(double a,
double b,
double c,
double d)
Sets the coefficients of this plane.
|
java.lang.String |
toString() |
void |
transform(Matrix44 m)
Transforms this plane, given the specified transform matrix.
|
void |
transformWithInverse(Matrix44 mi)
Transforms this plane, given the inverse of the transform matrix.
|
public Plane(double a, double b, double c, double d)
a
- the coefficient a.b
- the coefficient b.c
- the coefficient c.d
- the coefficient d.public Plane(Point3 p, Vector3 n)
p
- the point in the plane.n
- the normal vector.public Plane(Plane p)
p
- the plane.public void set(double a, double b, double c, double d)
a
- the coefficient a.b
- the coefficient b.c
- the coefficient c.d
- the coefficient d.public double getA()
public double getB()
public double getC()
public double getD()
public Vector3 getNormal()
public double distanceTo(double x, double y, double z)
x
- the x coordinate of the point.y
- the y coordinate of the point.z
- the z coordinate of the point.public double distanceTo(Point3 p)
p
- the point.public void transform(Matrix44 m)
transformWithInverse(Matrix44)
is more efficient.
Let M denote the matrix that transforms points p from old to new coordinates; i.e., p' = M*p, where p' denotes a transformed point. In old coordinates, the plane P = (a,b,c,d) satisfies the equation a*x + b*y + c*z + d = 0, for all points p = (x,y,z) within the plane. This method returns a new transformed plane P' = (a',b',c',d') that satisfies the equation a'*x' + b'*y' + c'*z' + d' = 0 for all transformed points p' = (x',y',z') within the transformed plane.
m
- the transform matrix.public void transformWithInverse(Matrix44 mi)
transform(Matrix44)
.mi
- the inverse of the transform matrix.public java.lang.String toString()
toString
in class java.lang.Object