etomica.math.geometry

## Class Plane

• java.lang.Object
• etomica.math.geometry.Plane
• All Implemented Interfaces:
java.io.Serializable

```public class Plane
extends java.lang.Object
implements java.io.Serializable```
Class describing a plane occupying a 3-dimensional space.
Serialized Form
• ### Field Summary

Fields
Modifier and Type Field and Description
`double` `epsilon`
Tolerance used to judge if a given point is in the plane.
• ### Constructor Summary

Constructors
Constructor and Description
`Plane(ISpace space)`
Default constructor returns the y-z plane.
```Plane(ISpace space, double a, double b, double c, double d)```
Constructs a Plane satisfying the equation a x + b y + c z + d = 0
`Plane(Plane original)`
Constructs a new Plane as a copy of the given one.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double` `dihedralAngle(Plane p)`
Dihedral angle between this plane and the given plane.
`double` `distanceTo(IVector x0)`
Perpendicular distance from the plane to the given point.
`void` `E(Plane p)`
Sets the parameters of this plane to make it equivalent to the given one.
`double` `getA()`
`double` `getB()`
`double` `getC()`
`double` `getD()`
`double` `getDistanceToOrigin()`
Perpendicular distance from the plane to the origin.
`boolean` `inPlane(IVector p)`
Returns true if the given point is within a distance epsilon of this plane.
`void` `invert()`
Changes the direction of the normal vector so that it points toward the other side of the plane from its present orientation.
`boolean` `isPositiveSide(IVector p)`
Returns true if the given point is on the side of the plane or over the side of the plane by epsilon or less toward which the normal vector points.
`static void` `main(java.lang.String[] args)`
`void` `moveTo(IVector r)`
Shifts the plane at fixed orientation so that it contains the given point.
`void` `setDistanceToOrigin(double d)`
Sets perpendicular distance from the plane to the origin.
`void` ```setIntercepts(double u, double v, double w)```
Reorients and positions the plane so that its intercepts with the x-, y-, and z-axes are the given values, respectively.
`void` ```setNormalPoint(IVector normal, IVector point)```
Defines the plane via a normal vector (1st argument) and a point (2nd argument).
`void` `setNormalVector(IVector n)`
Sets the orientation of the plane to be normal to the given vector.
`void` ```setThreePoints(IVector p1, IVector p2, IVector p3)```
Defines the plane by specifying three points that lie in it.
`void` `setToCenter(IVectorMutable v)`
Sets the given vector to be the point in the plane closest to the origin.
`void` ```setToInPlaneSquare(double size, IVectorMutable[] s)```
inPlaneSquare with square centered on point in plane closest to origin.
`void` ```setToInPlaneSquare(IVector x0, double size, IVectorMutable[] s)```
Returns four points as the vertices of a square of size d centered on x0.
`void` `setToInPlaneVectors(IVectorMutable[] p)`
Computes and returns two unit vectors perpendicular to each other and in the plane.
`void` ```setToNearestPoint(IVector x0, IVectorMutable point)```
Determines the point in the plane closest to the point x0 (first argument).
`void` `setToNormalVector(IVectorMutable normal)`
Sets the given vector to be a unit normal vector to the plane and returns it.
`double` `xIntercept()`
Returns the intercept of the plane with the x-axis.
`double` `yIntercept()`
Returns the intercept of the plane with the y-axis.
`double` `zIntercept()`
Returns the intercept of the plane with the z-axis.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### epsilon

`public double epsilon`
Tolerance used to judge if a given point is in the plane. Method inPlane is true if the point given to is at a distance from the plane less than this value. Default is 1e-5.
• ### Constructor Detail

• #### Plane

`public Plane(ISpace space)`
Default constructor returns the y-z plane.
• #### Plane

`public Plane(Plane original)`
Constructs a new Plane as a copy of the given one.
• #### Plane

```public Plane(ISpace space,
double a,
double b,
double c,
double d)```
Constructs a Plane satisfying the equation a x + b y + c z + d = 0
• ### Method Detail

• #### getA

`public double getA()`
• #### getB

`public double getB()`
• #### getC

`public double getC()`
• #### getD

`public double getD()`
• #### setNormalPoint

```public void setNormalPoint(IVector normal,
IVector point)```
Defines the plane via a normal vector (1st argument) and a point (2nd argument).
• #### setThreePoints

```public void setThreePoints(IVector p1,
IVector p2,
IVector p3)```
Defines the plane by specifying three points that lie in it.
• #### setToNormalVector

`public void setToNormalVector(IVectorMutable normal)`
Sets the given vector to be a unit normal vector to the plane and returns it. If argument is null, creates a new 3D Vector to return.
• #### setToInPlaneVectors

`public void setToInPlaneVectors(IVectorMutable[] p)`
Computes and returns two unit vectors perpendicular to each other and in the plane. Sets vector in given array to the vectors if it is not null and is of length 2; otherwise creates new array of in-plane vectors and returns it. If plane is parallel to a coordinate-axes plane, returns coordinate vectors (e.g., if parallel to x-y plane, returns unit vectors in x and y, respectively). Otherwise, returns one vector that follows the intersection of this plane and the x-y plane; the second vector is (uniquely) defined as perpendicular to both the normal and the first in-plane vector.
• #### setNormalVector

`public void setNormalVector(IVector n)`
Sets the orientation of the plane to be normal to the given vector.
• #### getDistanceToOrigin

`public double getDistanceToOrigin()`
Perpendicular distance from the plane to the origin.
• #### setDistanceToOrigin

`public void setDistanceToOrigin(double d)`
Sets perpendicular distance from the plane to the origin.
• #### setIntercepts

```public void setIntercepts(double u,
double v,
double w)```
Reorients and positions the plane so that its intercepts with the x-, y-, and z-axes are the given values, respectively.
• #### xIntercept

`public double xIntercept()`
Returns the intercept of the plane with the x-axis.
• #### yIntercept

`public double yIntercept()`
Returns the intercept of the plane with the y-axis.
• #### zIntercept

`public double zIntercept()`
Returns the intercept of the plane with the z-axis.
• #### setToCenter

`public void setToCenter(IVectorMutable v)`
Sets the given vector to be the point in the plane closest to the origin. If vector is null, makes a new Vector and returns it.
• #### setToNearestPoint

```public void setToNearestPoint(IVector x0,
IVectorMutable point)```
Determines the point in the plane closest to the point x0 (first argument). Uses second vector to hold result that is returned; if second vector is null, creates a new Vector instance.
• #### distanceTo

`public double distanceTo(IVector x0)`
Perpendicular distance from the plane to the given point.
• #### moveTo

`public void moveTo(IVector r)`
Shifts the plane at fixed orientation so that it contains the given point.
• #### dihedralAngle

`public double dihedralAngle(Plane p)`
Dihedral angle between this plane and the given plane.
• #### E

`public void E(Plane p)`
Sets the parameters of this plane to make it equivalent to the given one.
• #### isPositiveSide

`public boolean isPositiveSide(IVector p)`
Returns true if the given point is on the side of the plane or over the side of the plane by epsilon or less toward which the normal vector points. The direction of the normal vector can be inverted using the invert method.
• #### inPlane

`public boolean inPlane(IVector p)`
Returns true if the given point is within a distance epsilon of this plane.
• #### invert

`public void invert()`
Changes the direction of the normal vector so that it points toward the other side of the plane from its present orientation. Does not affect the location or absolute orientation of the plane.
• #### setToInPlaneSquare

```public void setToInPlaneSquare(IVector x0,
double size,
IVectorMutable[] s)```
Returns four points as the vertices of a square of size d centered on x0. Uses the given array of vectors. Square is aligned so that its vertices fall on the lines defined by the inPlaneVectors result.
• #### setToInPlaneSquare

```public void setToInPlaneSquare(double size,
IVectorMutable[] s)```
inPlaneSquare with square centered on point in plane closest to origin.
• #### main

`public static void main(java.lang.String[] args)`