Package com.jme3.math

# Class Plane

java.lang.Object
com.jme3.math.Plane
All Implemented Interfaces:
`Savable`, `Serializable`, `Cloneable`

public class Plane extends Object implements Savable, Cloneable, Serializable
`Plane` defines a plane where Normal dot (x,y,z) = Constant. This provides methods for calculating a "distance" of a point from this plane. The distance is pseudo due to the fact that it can be negative if the point is on the non-normal side of the plane.
• ## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum `
`Plane.Side`
Describe the relationship between a point and a plane.
• ## Field Summary

Fields
Modifier and Type
Field
Description
`protected float`
`constant`
Constant of the plane.
`protected Vector3f`
`normal`
Vector normal to the plane.
• ## Constructor Summary

Constructors
Constructor
Description
`Plane()`
Constructor instantiates a new `Plane` object.
```Plane(Vector3f normal, float constant)```
Constructor instantiates a new `Plane` object.
```Plane(Vector3f normal, Vector3f displacement)```
Constructor instantiates a new `Plane` object.
• ## Method Summary

Modifier and Type
Method
Description
`Plane`
`clone()`
Create a copy of this plane.
`Vector3f`
`getClosestPoint(Vector3f point)`
Find the point in this plane that's nearest to the specified point.
`Vector3f`
```getClosestPoint(Vector3f point, Vector3f store)```
Find the point in this plane that's nearest to the specified point.
`float`
`getConstant()`
`getConstant` returns the constant of the plane.
`Vector3f`
`getNormal()`
`getNormal` retrieves the normal of the plane.
`boolean`
`isOnPlane(Vector3f point)`

`float`
`pseudoDistance(Vector3f point)`
`pseudoDistance` calculates the distance from this plane to a provided point.
`void`
`read(JmeImporter importer)`
De-serialize this plane from the specified importer, for example when loading from a J3O file.
`Vector3f`
```reflect(Vector3f point, Vector3f store)```
Reflect the specified point in this plane.
`void`
`setConstant(float constant)`
`setConstant` sets the constant value that helps define the plane.
`void`
```setNormal(float x, float y, float z)```
`setNormal` sets the normal of the plane.
`void`
`setNormal(Vector3f normal)`
`setNormal` sets the normal of the plane.
`void`
```setOriginNormal(Vector3f origin, Vector3f normal)```
Initialize this plane using a point of origin and a normal.
`void`
`setPlanePoints(AbstractTriangle t)`
Initialize this plane using the three points of the given triangle.
`void`
```setPlanePoints(Vector3f v1, Vector3f v2, Vector3f v3)```
Initialize the Plane using the given 3 points as coplanar.
`String`
`toString()`
`toString` returns a string representation of this plane.
`Plane.Side`
`whichSide(Vector3f point)`
`whichSide` returns the side at which a point lies on the plane.
`void`
`write(JmeExporter e)`
Serialize this plane to the specified exporter, for example when saving to a J3O file.

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ## Field Details

• ### normal

protected Vector3f normal
Vector normal to the plane.
• ### constant

protected float constant
Constant of the plane. See formula in class definition.
• ## Constructor Details

• ### Plane

public Plane()
Constructor instantiates a new `Plane` object. This is the default object and contains a normal of (0,0,0) and a constant of 0.
• ### Plane

public Plane(Vector3f normal, float constant)
Constructor instantiates a new `Plane` object. The normal and constant values are set at creation.
Parameters:
`normal` - the normal of the plane.
`constant` - the constant of the plane.
• ### Plane

public Plane(Vector3f normal, Vector3f displacement)
Constructor instantiates a new `Plane` object.
Parameters:
`normal` - The normal of the plane.
`displacement` - A vector representing a point on the plane.
• ## Method Details

• ### setNormal

public void setNormal(Vector3f normal)
`setNormal` sets the normal of the plane.
Parameters:
`normal` - the new normal of the plane.
• ### setNormal

public void setNormal(float x, float y, float z)
`setNormal` sets the normal of the plane.
Parameters:
`x` - the desired X component for the normal vector
`y` - the desired Y component for the normal vector
`z` - the desired Z component for the normal vector
• ### getNormal

public Vector3f getNormal()
`getNormal` retrieves the normal of the plane.
Returns:
the normal of the plane.
• ### setConstant

public void setConstant(float constant)
`setConstant` sets the constant value that helps define the plane.
Parameters:
`constant` - the new constant value.
• ### getConstant

public float getConstant()
`getConstant` returns the constant of the plane.
Returns:
the constant of the plane.
• ### getClosestPoint

public Vector3f getClosestPoint(Vector3f point, Vector3f store)
Find the point in this plane that's nearest to the specified point.
Parameters:
`point` - the location of the input point (not null, unaffected)
`store` - storage for the result (not null, modified)
Returns:
the location of the nearest point (store)
• ### getClosestPoint

public Vector3f getClosestPoint(Vector3f point)
Find the point in this plane that's nearest to the specified point.
Parameters:
`point` - location vector of the input point (not null, unaffected)
Returns:
a new location vector in this plane
• ### reflect

public Vector3f reflect(Vector3f point, Vector3f store)
Reflect the specified point in this plane.
Parameters:
`point` - location vector of the input point (not null, unaffected)
`store` - storage for the result (modified if not null)
Returns:
a location vector for the reflected point (either store or a new vector)
• ### pseudoDistance

public float pseudoDistance(Vector3f point)
`pseudoDistance` calculates the distance from this plane to a provided point. If the point is on the negative side of the plane the distance returned is negative, otherwise it is positive. If the point is on the plane, it is zero.
Parameters:
`point` - the point to check.
Returns:
the signed distance from the plane to a point.
• ### whichSide

public Plane.Side whichSide(Vector3f point)
`whichSide` returns the side at which a point lies on the plane. The positive values returned are: NEGATIVE_SIDE, POSITIVE_SIDE and NO_SIDE.
Parameters:
`point` - the point to check.
Returns:
the side at which the point lies.
• ### isOnPlane

public boolean isOnPlane(Vector3f point)
• ### setPlanePoints

public void setPlanePoints
Initialize this plane using the three points of the given triangle.
Parameters:
`t` - the triangle
• ### setOriginNormal

public void setOriginNormal(Vector3f origin, Vector3f normal)
Initialize this plane using a point of origin and a normal.
Parameters:
`origin` - the desired origin location (not null, unaffected)
`normal` - the desired normal vector (not null, unaffected)
• ### setPlanePoints

public void setPlanePoints(Vector3f v1, Vector3f v2, Vector3f v3)
Initialize the Plane using the given 3 points as coplanar.
Parameters:
`v1` - the first point
`v2` - the second point
`v3` - the third point
• ### toString

public String toString()
`toString` returns a string representation of this plane. It represents the normal as a `Vector3f`, so the format is: Plane [Normal: (X.XXXX, Y.YYYY, Z.ZZZZ) - Constant: C.CCCC]
Overrides:
`toString` in class `Object`
Returns:
the string representation of this plane.
• ### write

public void write(JmeExporter e) throws IOException
Serialize this plane to the specified exporter, for example when saving to a J3O file.
Specified by:
`write` in interface `Savable`
Parameters:
`e` - (not null)
Throws:
`IOException` - from the exporter

public void read(JmeImporter importer) throws IOException
De-serialize this plane from the specified importer, for example when loading from a J3O file.
Specified by:
`read` in interface `Savable`
Parameters:
`importer` - (not null)
Throws:
`IOException` - from the importer
• ### clone

public Plane clone()
Create a copy of this plane.
Overrides:
`clone` in class `Object`
Returns:
a new instance, equivalent to this one