public class Plane extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Plane.PlaneSide
Enum specifying on which side a point lies respective to the plane and it's normal.
|
Constructor and Description |
---|
Plane(Vector3 normal,
float d)
Constructs a new plane based on the normal and distance to the origin.
|
Plane(Vector3 normal,
Vector3 point)
Constructs a new plane based on the normal and a point on the plane.
|
Plane(Vector3 point1,
Vector3 point2,
Vector3 point3)
Constructs a new plane out of the three given points that are considered to be on the plane.
|
Modifier and Type | Method and Description |
---|---|
float |
distance(Vector3 point)
Calculates the shortest signed distance between the plane and the given point.
|
float |
getD() |
Vector3 |
getNormal() |
boolean |
isFrontFacing(Vector3 direction)
Returns whether the plane is facing the direction vector.
|
void |
set(float nx,
float ny,
float nz,
float d)
Sets the plane normal and distance
|
void |
set(float pointX,
float pointY,
float pointZ,
float norX,
float norY,
float norZ) |
void |
set(Plane plane)
Sets this plane from the given plane
|
void |
set(Vector3 point,
Vector3 normal)
Sets the plane to the given point and normal.
|
void |
set(Vector3 point1,
Vector3 point2,
Vector3 point3)
Sets the plane normal and distance to the origin based on the three given points which are considered to be on the plane.
|
Plane.PlaneSide |
testPoint(float x,
float y,
float z)
Returns on which side the given point lies relative to the plane and its normal.
|
Plane.PlaneSide |
testPoint(Vector3 point)
Returns on which side the given point lies relative to the plane and its normal.
|
String |
toString() |
public final Vector3 normal
public float d
public Plane(Vector3 normal, float d)
normal
- The plane normald
- The distance to the originpublic Plane(Vector3 normal, Vector3 point)
normal
- The normalpoint
- The point on the planepublic Plane(Vector3 point1, Vector3 point2, Vector3 point3)
point1
- The first pointpoint2
- The second pointpoint3
- The third pointpublic void set(Vector3 point1, Vector3 point2, Vector3 point3)
point1
- point2
- point3
- public void set(float nx, float ny, float nz, float d)
nx
- normal x-componentny
- normal y-componentnz
- normal z-componentd
- distance to originpublic float distance(Vector3 point)
point
- The pointpublic Plane.PlaneSide testPoint(Vector3 point)
point
- The pointpublic Plane.PlaneSide testPoint(float x, float y, float z)
x
- y
- z
- public boolean isFrontFacing(Vector3 direction)
direction
- the directionpublic Vector3 getNormal()
public float getD()
public void set(Vector3 point, Vector3 normal)
point
- the point on the planenormal
- the normal of the planepublic void set(float pointX, float pointY, float pointZ, float norX, float norY, float norZ)
public void set(Plane plane)
plane
- the planeCopyright © 2015. All rights reserved.