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 Planecopy()Returns a copy of this Plane instanceallocatedby the calling thread (possibly on the stack).PlanecopyToReal()Return a copy of this object with any transformations or subranges removed (applied).booleanequals(java.lang.Object obj)Compares this Plane against the specified object for strict equality (same values and same units).static PlanefitPoints(java.util.List<? extends GeomPoint> points)Return aPlaneinstance 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.intgetPhyDimension()Returns the number of physical dimensions of the geometry element.PointgetRefPoint()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 PlanegetXY()Return a 3D plane that represents the XY plane through the origin.static PlanegetXZ()Return a 3D plane that represents the XZ plane through the origin.static PlanegetYZ()Returns a 3D plane that represents the YZ plane through the origin.inthashCode()Returns the hash code for this parameter.Planeimmutable()Return an immutable version of this plane.static voidrecycle(Plane instance)Recycles aPlaneinstance immediately (on the stack when executing in aStackContext).Planeto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent to this element but stated in the specified unit.PlanetoDimension(int newDim)Return the equivalent of this plane converted to the specified number of physical dimensions.static PlanevalueOf(double A, double B, double C, Parameter<javax.measure.quantity.Length> D)Returns aPlaneinstance with the specified 3D plane equation values.static PlanevalueOf(GeomPoint p, GeomPoint q, GeomPoint r)Returns aPlaneinstance that contains the specified 3 independent points.static PlanevalueOf(GeomTriangle tri)Returns aPlaneinstance that contains the specified triangle.static PlanevalueOf(GeomVector<javax.measure.quantity.Dimensionless> normal, GeomPoint p)Returns aPlaneinstance with the specified normal vector and plane equation constant.static PlanevalueOf(GeomVector<javax.measure.quantity.Dimensionless> normal, Parameter<javax.measure.quantity.Length> constant)Returns aPlaneinstance 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 aPlaneinstance 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 aPlaneinstance 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 aPlaneinstance 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 aPlaneinstance 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 aPlaneinstance 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 aPlaneinstance 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 aPlaneinstance 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:
getPhyDimensionin 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:
toDimensionin interfaceGeomElement<GeomPlane>- Specified by:
toDimensionin 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:
getConstantin 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:
getRefPointin 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:
getUnitin 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:
toin 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 instanceallocatedby the calling thread (possibly on the stack).- Specified by:
copyin interfaceGeomElement<GeomPlane>- Specified by:
copyin interfacejavolution.lang.ValueType- Specified by:
copyin 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:
copyToRealin 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:
equalsin classAbstractGeomElement<GeomPlane>- Parameters:
obj- the object to compare with.- Returns:
trueif this object is identical to that object;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCodein classAbstractGeomElement<GeomPlane>- Returns:
- the hash code value.
-
-