pythagoras.d

Class Plane

• All Implemented Interfaces:
Serializable, IPlane

```public class Plane
extends Object
implements IPlane, Serializable```
A plane consisting of a unit normal and a constant. All points on the plane satisfy the equation `Ax + By + Cz + D = 0`, where (A, B, C) is the plane normal and D is the constant.
Serialized Form
• Field Summary

Fields
Modifier and Type Field and Description
`double` `constant`
The plane constant.
`static Plane` `XY_PLANE`
The X/Y plane.
`static Plane` `XZ_PLANE`
The X/Z plane.
`static Plane` `YZ_PLANE`
The Y/Z plane.
• Constructor Summary

Constructors
Constructor and Description
`Plane()`
Creates an empty (invalid) plane.
`Plane(double[] values)`
Creates a plane with the specified parameters.
```Plane(double a, double b, double c, double d)```
Creates a plane with the specified parameters.
```Plane(IVector3 normal, double constant)```
Creates a plane from the specified normal and constant.
`Plane(Plane other)`
Copy constructor.
• Method Summary

All Methods
Modifier and Type Method and Description
`double` `constant()`
Returns the plane constant.
`double` `distance(IRay3 ray)`
Computes the signed distance to this plane along the specified ray.
`double` `distance(IVector3 pt)`
Computes and returns the signed distance from the plane to the specified point.
`boolean` `equals(Object other)`
`Plane` ```fromPointNormal(IVector3 pt, IVector3 normal)```
Sets this plane based on a point on the plane and the plane normal.
`Plane` ```fromPoints(IVector3 p1, IVector3 p2, IVector3 p3)```
Sets this plane based on the three points provided.
`DoubleBuffer` `get(DoubleBuffer buf)`
Stores the contents of this plane into the specified buffer.
`int` `hashCode()`
`boolean` ```intersection(IRay3 ray, Vector3 result)```
Computes the intersection of the supplied ray with this plane, placing the result in the given vector (if the ray intersects).
`Plane` `negate()`
Negates this plane.
`Plane` `negate(Plane result)`
Negates this plane, placing the result in the object provided.
`Plane` `negateLocal()`
Negates this plane in-place.
`IVector3` `normal()`
Returns the plane normal.
`Plane` `set(double[] values)`
Sets the parameters of the plane.
`Plane` ```set(double a, double b, double c, double d)```
Sets the parameters of the plane.
`Plane` ```set(IVector3 normal, double constant)```
Sets the parameters of the plane.
`Plane` `set(Plane other)`
Copies the parameters of another plane.
• Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, toString, wait, wait, wait`
• Field Detail

• XY_PLANE

`public static final Plane XY_PLANE`
The X/Y plane.
• XZ_PLANE

`public static final Plane XZ_PLANE`
The X/Z plane.
• YZ_PLANE

`public static final Plane YZ_PLANE`
The Y/Z plane.
• constant

`public double constant`
The plane constant.
• Constructor Detail

• Plane

```public Plane(IVector3 normal,
double constant)```
Creates a plane from the specified normal and constant.
• Plane

`public Plane(double[] values)`
Creates a plane with the specified parameters.
• Plane

```public Plane(double a,
double b,
double c,
double d)```
Creates a plane with the specified parameters.
• Plane

`public Plane(Plane other)`
Copy constructor.
• Plane

`public Plane()`
Creates an empty (invalid) plane.
• Method Detail

• set

`public Plane set(Plane other)`
Copies the parameters of another plane.
Returns:
a reference to this plane (for chaining).
• set

```public Plane set(IVector3 normal,
double constant)```
Sets the parameters of the plane.
Returns:
a reference to this plane (for chaining).
• set

`public Plane set(double[] values)`
Sets the parameters of the plane.
Returns:
a reference to this plane (for chaining).
• set

```public Plane set(double a,
double b,
double c,
double d)```
Sets the parameters of the plane.
Returns:
a reference to this plane (for chaining).
• fromPoints

```public Plane fromPoints(IVector3 p1,
IVector3 p2,
IVector3 p3)```
Sets this plane based on the three points provided.
Returns:
a reference to the plane (for chaining).
• fromPointNormal

```public Plane fromPointNormal(IVector3 pt,
IVector3 normal)```
Sets this plane based on a point on the plane and the plane normal.
Returns:
a reference to the plane (for chaining).
• negateLocal

`public Plane negateLocal()`
Negates this plane in-place.
Returns:
a reference to this plane, for chaining.
• constant

`public double constant()`
Description copied from interface: `IPlane`
Returns the plane constant.
Specified by:
`constant` in interface `IPlane`
• normal

`public IVector3 normal()`
Description copied from interface: `IPlane`
Returns the plane normal.
Specified by:
`normal` in interface `IPlane`
• get

`public DoubleBuffer get(DoubleBuffer buf)`
Description copied from interface: `IPlane`
Stores the contents of this plane into the specified buffer.
Specified by:
`get` in interface `IPlane`
• distance

`public double distance(IVector3 pt)`
Description copied from interface: `IPlane`
Computes and returns the signed distance from the plane to the specified point.
Specified by:
`distance` in interface `IPlane`
• negate

`public Plane negate()`
Description copied from interface: `IPlane`
Negates this plane.
Specified by:
`negate` in interface `IPlane`
Returns:
a new plane containing the result.
• negate

`public Plane negate(Plane result)`
Description copied from interface: `IPlane`
Negates this plane, placing the result in the object provided.
Specified by:
`negate` in interface `IPlane`
Returns:
a reference to the result, for chaining.
• intersection

```public boolean intersection(IRay3 ray,
Vector3 result)```
Description copied from interface: `IPlane`
Computes the intersection of the supplied ray with this plane, placing the result in the given vector (if the ray intersects).
Specified by:
`intersection` in interface `IPlane`
Returns:
true if the ray intersects the plane (in which case the result will contain the point of intersection), false if not.
• distance

`public double distance(IRay3 ray)`
Description copied from interface: `IPlane`
Computes the signed distance to this plane along the specified ray.
Specified by:
`distance` in interface `IPlane`
Returns:
the signed distance, or `Float.NaN` if the ray runs parallel to the plane.
• hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`
• equals

`public boolean equals(Object other)`
Overrides:
`equals` in class `Object`