public class Plane
extends java.lang.Object
| Constructor and Description |
|---|
Plane()
Constructs a plane in the X-Y plane with its unit normal pointing along the Z axis.
|
Plane(double x,
double y,
double z,
double distance)
Constructs a plane with specified normal vector components and distance from the origin.
|
Plane(Plane plane)
Constructs a plane with the normal vector and distance from a specified plane.
|
| Modifier and Type | Method and Description |
|---|---|
Vec3[] |
clip(Vec3 pointA,
Vec3 pointB)
Clips a line segment to this plane, returning an two-point array indicating the clipped segment.
|
double |
distanceToPoint(Vec3 point)
Computes the distance between this plane and a point.
|
double |
dot(Vec3 vector)
Computes the dot product of this plane's components with a specified vector.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
intersectsSegment(Vec3 endPoint1,
Vec3 endPoint2)
Determines whether a specified line segment intersects this plane.
|
int |
onSameSide(Vec3 pointA,
Vec3 pointB)
Determines whether two points are on the same side of this plane.
|
Plane |
set(double x,
double y,
double z,
double distance)
Sets this plane's specified normal vector and distance to specified values.
|
Plane |
set(Plane plane)
Sets this plane's normal vector and distance to that of a specified plane.
|
java.lang.String |
toString() |
Plane |
transformByMatrix(Matrix4 matrix)
Transforms this plane by a specified matrix.
|
public Plane()
public Plane(double x,
double y,
double z,
double distance)
x - the X component of the plane's normal vectory - the Y component of the plane's normal vectorz - the Z component of the plane's normal vectordistance - the plane's distance from the originpublic Plane(Plane plane)
plane - the plane specifying the normal vector and distancejava.lang.IllegalArgumentException - If the plane is nullpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic double distanceToPoint(Vec3 point)
point - the point whose distance to computejava.lang.IllegalArgumentException - If the vector is nullpublic Plane set(double x, double y, double z, double distance)
x - the X component of the plane's normal vectory - the Y component of the plane's normal vectorz - the Z component of the plane's normal vectordistance - the plane's distance from the originpublic Plane set(Plane plane)
plane - the plane specifying the normal vector and distancejava.lang.IllegalArgumentException - If the plane is nullpublic Plane transformByMatrix(Matrix4 matrix)
matrix - the matrix to apply to this planejava.lang.IllegalArgumentException - If the matrix is nullpublic double dot(Vec3 vector)
vector - the vector to dot with this plane's componentsjava.lang.IllegalArgumentException - If the vector is nullpublic boolean intersectsSegment(Vec3 endPoint1, Vec3 endPoint2)
endPoint1 - the line segment's first end pointendPoint2 - the line segment's second end pointpublic int onSameSide(Vec3 pointA, Vec3 pointB)
pointA - the first pointpointB - the second pointjava.lang.IllegalArgumentException - If either point is nullpublic Vec3[] clip(Vec3 pointA, Vec3 pointB)
pointA - the first line segment endpointpointB - the second line segment endpointjava.lang.IllegalArgumentException - If either point is null