Package geomss.geom
Class Plane
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<GeomPlane>
-
- geomss.geom.GeomPlane
-
- geomss.geom.Plane
-
- All Implemented Interfaces:
GeomElement<GeomPlane>
,Transformable<GeomPlane>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Immutable
,javolution.lang.Reusable
,javolution.lang.ValueType
,javolution.xml.XMLSerializable
public final class Plane extends GeomPlane implements javolution.lang.ValueType
A concrete, immutable, 2D plane in n-dimensional space.Modified by: Joseph A. Huwaldt
- Version:
- October 14, 2018
- Author:
- Joseph A. Huwaldt, Date: June 14, 2009
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Plane
copy()
Returns a copy of this Plane instanceallocated
by the calling thread (possibly on the stack).Plane
copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).boolean
equals(java.lang.Object obj)
Compares this Plane against the specified object for strict equality (same values and same units).static Plane
fitPoints(java.util.List<? extends GeomPoint> points)
Return aPlane
instance that is fit through the input list of points resulting in the least-squared orthogonal error between the points and the plane.Parameter<javax.measure.quantity.Length>
getConstant()
Return the constant term of the plane equation (e.g.: "D" for a 3D plane:A*x + B*y + C*z = D
).Vector<javax.measure.quantity.Dimensionless>
getNormal()
Return the normal vector for the plane.int
getPhyDimension()
Returns the number of physical dimensions of the geometry element.Point
getRefPoint()
Return the reference point for this plane.javax.measure.unit.Unit<javax.measure.quantity.Length>
getUnit()
Returns the unit in which the geometry in this element are stated.static Plane
getXY()
Return a 3D plane that represents the XY plane through the origin.static Plane
getXZ()
Return a 3D plane that represents the XZ plane through the origin.static Plane
getYZ()
Returns a 3D plane that represents the YZ plane through the origin.int
hashCode()
Returns the hash code for this parameter.Plane
immutable()
Return an immutable version of this plane.static void
recycle(Plane instance)
Recycles aPlane
instance immediately (on the stack when executing in aStackContext
).Plane
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this element but stated in the specified unit.Plane
toDimension(int newDim)
Return the equivalent of this plane converted to the specified number of physical dimensions.static Plane
valueOf(double A, double B, double C, Parameter<javax.measure.quantity.Length> D)
Returns aPlane
instance with the specified 3D plane equation values.static Plane
valueOf(GeomPoint p, GeomPoint q, GeomPoint r)
Returns aPlane
instance that contains the specified 3 independent points.static Plane
valueOf(GeomTriangle tri)
Returns aPlane
instance that contains the specified triangle.static Plane
valueOf(GeomVector<javax.measure.quantity.Dimensionless> normal, GeomPoint p)
Returns aPlane
instance with the specified normal vector and plane equation constant.static Plane
valueOf(GeomVector<javax.measure.quantity.Dimensionless> normal, Parameter<javax.measure.quantity.Length> constant)
Returns aPlane
instance with the specified normal vector and plane equation constant.-
Methods inherited from class geomss.geom.GeomPlane
changeRefPoint, getBoundsMax, getBoundsMin, getClosest, getLimitPoint, getParDimension, getTransformed, intersect, intersect, intersect, isValid, size, toText
-
Methods inherited from class geomss.geom.AbstractGeomElement
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, reset, setName, toString
-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
-
-
-
-
Method Detail
-
getYZ
public static Plane getYZ()
Returns a 3D plane that represents the YZ plane through the origin.- Returns:
- A 3D plane that represents the YZ plane through the origin.
-
getXZ
public static Plane getXZ()
Return a 3D plane that represents the XZ plane through the origin.- Returns:
- A 3D plane that represents the XZ plane through the origin.
-
getXY
public static Plane getXY()
Return a 3D plane that represents the XY plane through the origin.- Returns:
- A 3D plane that represents the XY plane through the origin.
-
valueOf
public static Plane valueOf(double A, double B, double C, Parameter<javax.measure.quantity.Length> D)
Returns aPlane
instance with the specified 3D plane equation values. The plane equation is:A*x + B*y + C*z = D
.- Parameters:
A
- The coefficient on the X axis term.B
- The coefficient on the Y axis term.C
- The coefficient on the Z axis term.D
- The constant term ((normal DOT p0) where p0 is a point in the plane). May not be null.- Returns:
- the plane having the specified values.
-
valueOf
public static Plane valueOf(GeomVector<javax.measure.quantity.Dimensionless> normal, Parameter<javax.measure.quantity.Length> constant)
Returns aPlane
instance with the specified normal vector and plane equation constant.- Parameters:
normal
- The unit normal of the plane. May not be null.constant
- The constant term of the plane equation ((normal DOT p0) where p0 is a point in the plane). May not be null.- Returns:
- the plane having the specified values.
- Throws:
DimensionException
- if the input normal vector is not at least 3 dimensional.
-
valueOf
public static Plane valueOf(GeomVector<javax.measure.quantity.Dimensionless> normal, GeomPoint p)
Returns aPlane
instance with the specified normal vector and plane equation constant.- Parameters:
normal
- The unit normal of the plane. May not be null.p
- A point in the plane (the reference point for the plane). May not be null.- Returns:
- the plane having the specified values.
- Throws:
DimensionException
- if the input normal vector is not at least 3 dimensional.
-
valueOf
public static Plane valueOf(GeomPoint p, GeomPoint q, GeomPoint r) throws DimensionException
Returns aPlane
instance that contains the specified 3 independent points.- Parameters:
p
- A point in the plane (not equal to one of the other two). May not be null.q
- A point in the plane (not equal to one of the other two). May not be null.r
- A point in the plane (not equal to one of the other two). May not be null.- Returns:
- The plane containing the specified points. The plane will match the dimensions of the highest dimension point passed to this method.
- Throws:
DimensionException
- if one of the input points does not have at least 3 physical dimensions.java.lang.IllegalArgumentException
- if any of the input points are equal to the others.
-
valueOf
public static Plane valueOf(GeomTriangle tri) throws DimensionException
Returns aPlane
instance that contains the specified triangle.- Parameters:
tri
- A triangle that defines the plane. May not be null.- Returns:
- The plane containing the specified triangle. The plane will match the dimensions of the triangle.
- Throws:
DimensionException
- if the input triangle does not have at least 3 physical dimensions.java.lang.IllegalArgumentException
- if the triangle is degenerate (has two vertices equal to each other).
-
fitPoints
public static Plane fitPoints(java.util.List<? extends GeomPoint> points)
Return aPlane
instance that is fit through the input list of points resulting in the least-squared orthogonal error between the points and the plane.- Parameters:
points
- The list of points to fit a plane to.- Returns:
- A plane that represents the least squared error fit to the input points.
-
recycle
public static void recycle(Plane instance)
Recycles aPlane
instance immediately (on the stack when executing in aStackContext
).- Parameters:
instance
- The instance to be recycled.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element.- Specified by:
getPhyDimension
in interfaceGeomElement<GeomPlane>
- Returns:
- The number of physical dimensions of the geometry element.
-
toDimension
public Plane toDimension(int newDim)
Return the equivalent of this plane converted to the specified number of physical dimensions. If the number of dimensions is greater than this element, then zeros are added to the additional dimensions. If the number of dimensions is less than this element, then the extra dimensions are simply dropped (truncated). If the new dimensions are the same as the dimension of this element, then this element is simply returned.- Specified by:
toDimension
in interfaceGeomElement<GeomPlane>
- Specified by:
toDimension
in classGeomPlane
- Parameters:
newDim
- The dimension of the plane to return.- Returns:
- A copy of this plane converted to the new dimensions.
-
getNormal
public Vector<javax.measure.quantity.Dimensionless> getNormal()
Return the normal vector for the plane. The normal vector is a unit vector that is perpendicular to the plane.
-
getConstant
public Parameter<javax.measure.quantity.Length> getConstant()
Return the constant term of the plane equation (e.g.: "D" for a 3D plane:A*x + B*y + C*z = D
).- Specified by:
getConstant
in classGeomPlane
- Returns:
- The constant term of the plane equation for this plane.
-
getRefPoint
public Point getRefPoint()
Return the reference point for this plane. The reference point is an arbitrary point that is contained in the plane and is used as a reference when drawing the plane.- Specified by:
getRefPoint
in classGeomPlane
- Returns:
- The reference point for this plane.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which the geometry in this element are stated.- Specified by:
getUnit
in interfaceGeomElement<GeomPlane>
- Returns:
- The unit in which the geometry in this element are stated.
-
to
public Plane to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this element but stated in the specified unit.- Specified by:
to
in interfaceGeomElement<GeomPlane>
- Parameters:
unit
- the length unit of the element to be returned. May not be null.- Returns:
- an equivalent to this element but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException
- if the the input unit is not a length unit.
-
copy
public Plane copy()
Returns a copy of this Plane instanceallocated
by the calling thread (possibly on the stack).- Specified by:
copy
in interfaceGeomElement<GeomPlane>
- Specified by:
copy
in interfacejavolution.lang.ValueType
- Specified by:
copy
in classGeomPlane
- Returns:
- an identical and independent copy of this point.
-
copyToReal
public Plane copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Specified by:
copyToReal
in interfaceGeomElement<GeomPlane>
- Returns:
- A copy of this object with any transformations or subranges removed.
-
equals
public boolean equals(java.lang.Object obj)
Compares this Plane against the specified object for strict equality (same values and same units).- Overrides:
equals
in classAbstractGeomElement<GeomPlane>
- Parameters:
obj
- the object to compare with.- Returns:
true
if this object is identical to that object;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCode
in classAbstractGeomElement<GeomPlane>
- Returns:
- the hash code value.
-
-