Package geomss.geom
Class TriangleTrans
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<GeomTriangle>
-
- geomss.geom.GeomTriangle
-
- geomss.geom.TriangleTrans
-
- All Implemented Interfaces:
GeomElement<GeomTriangle>,GeomTransform<GeomTriangle>,PointGeometry<GeomTriangle>,Transformable<GeomTriangle>,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,javolution.lang.Reusable,javolution.xml.XMLSerializable
public final class TriangleTrans extends GeomTriangle implements GeomTransform<GeomTriangle>
AGeomTransformobject that refers to aTriangleobject and masquerades as a Triangle object itself.Modified by: Joseph A. Huwaldt
- Version:
- April 10, 2018
- Author:
- Joseph A. Huwaldt, Date: August 26, 2015
- 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 TriangleTranscopy()Returns a copy of this TriangleTrans instance allocated by the calling thread (possibly on the stack).TrianglecopyToReal()Return a copy of the child object transformed by this transformation.booleanequals(java.lang.Object obj)Compares this TriangleTrans against the specified object for strict equality.Parameter<javax.measure.quantity.Area>getArea()Return the surface area of one side of this triangle.PointgetBoundsMax()Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).PointgetBoundsMin()Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).GeomTrianglegetChild()Returns the child object transformed by this transform element.VectorTrans<javax.measure.quantity.Dimensionless>getNormal()Return the surface unit normal vector for this triangle.GeomPointgetP1()Return the first vertex in this triangle.GeomPointgetP2()Return the second vertex in this triangle.GeomPointgetP3()Return the third and last vertex in this triangle.intgetPhyDimension()Returns the number of physical dimensions of the geometry element.GTransformgetTotalTransform()Returns the total transformation represented by an entire chain of GeomTransform objects below this one.GTransformgetTransform()Returns the transformation represented by this transformation element.TriangleTransgetTransformed(GTransform transform)Returns transformed version of this element.javax.measure.unit.Unit<javax.measure.quantity.Length>getUnit()Returns the unit in which this triangle is stated.inthashCode()Returns the hash code for this parameter.static TriangleTransnewInstance(GeomTriangle child, GTransform transform)static voidrecycle(TriangleTrans instance)Recycles aTriangleTransinstance immediately (on the stack when executing in a StackContext).TriangleTransreverse()Return a new triangle that is identical to this one, but with the order of the points (and the surface normal direction) reversed.voidsetTransform(GTransform transform)Sets the transformation represented by this transformation element.TriangleTransto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent to this element but stated in the specified unit.TriangleTranstoDimension(int newDim)Return a copy of this Triangle converted to the specified number of physical dimensions.-
Methods inherited from class geomss.geom.GeomTriangle
getAll, getLimitPoint, getNumberOfPoints, getParDimension, getPoints, getPoints, isDegenerate, isValid, reset, size, toText
-
Methods inherited from class geomss.geom.AbstractGeomElement
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, toString
-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, getAllUserData, getID, getLimitPoint, getName, getParDimension, getUserData, isValid, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, size, toText
-
-
-
-
Method Detail
-
newInstance
public static TriangleTrans newInstance(GeomTriangle child, GTransform transform)
- Parameters:
child- The GeomTriangle that is the child of this transform element (may not benull).transform- The transform held by this transform element (may not benull).- Returns:
- the transform element having the specified values.
-
getTransform
public GTransform getTransform()
Returns the transformation represented by this transformation element.- Specified by:
getTransformin interfaceGeomTransform<GeomTriangle>- Returns:
- The transformation from the child object represented by this element.
-
getTotalTransform
public GTransform getTotalTransform()
Returns the total transformation represented by an entire chain of GeomTransform objects below this one.- Specified by:
getTotalTransformin interfaceGeomTransform<GeomTriangle>- Returns:
- The total transformation represented by the entire chain of objects below this one.
-
setTransform
public void setTransform(GTransform transform)
Sets the transformation represented by this transformation element.- Specified by:
setTransformin interfaceGeomTransform<GeomTriangle>- Parameters:
transform- The transform to set this transform element to (may not benull).
-
getChild
public GeomTriangle getChild()
Returns the child object transformed by this transform element.- Specified by:
getChildin interfaceGeomTransform<GeomTriangle>- Returns:
- The child object transformed by this transform element.
-
copyToReal
public Triangle copyToReal()
Return a copy of the child object transformed by this transformation.- Specified by:
copyToRealin interfaceGeomElement<GeomTriangle>- Specified by:
copyToRealin interfaceGeomTransform<GeomTriangle>- Returns:
- A copy of the child object transformed by this transformation.
-
getP1
public GeomPoint getP1()
Return the first vertex in this triangle.- Specified by:
getP1in classGeomTriangle- Returns:
- The first vertex in this triangle.
-
getP2
public GeomPoint getP2()
Return the second vertex in this triangle.- Specified by:
getP2in classGeomTriangle- Returns:
- The second vertex in this triangle.
-
getP3
public GeomPoint getP3()
Return the third and last vertex in this triangle.- Specified by:
getP3in classGeomTriangle- Returns:
- The third and last vertex in this triangle.
-
getNormal
public VectorTrans<javax.measure.quantity.Dimensionless> getNormal()
Return the surface unit normal vector for this triangle. If the triangle is degenerate (zero area), then the normal vector will have zero length.- Specified by:
getNormalin classGeomTriangle- Returns:
- The surface normal vector for this triangle.
-
getArea
public Parameter<javax.measure.quantity.Area> getArea()
Return the surface area of one side of this triangle. The returned area is always positive, but can be zero.- Specified by:
getAreain classGeomTriangle- Returns:
- The surface area of one side of this triangle.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element.- Specified by:
getPhyDimensionin interfaceGeomElement<GeomTriangle>- Overrides:
getPhyDimensionin classGeomTriangle- Returns:
- The number of physical dimensions of this geometry element.
-
reverse
public TriangleTrans reverse()
Return a new triangle that is identical to this one, but with the order of the points (and the surface normal direction) reversed.- Specified by:
reversein classGeomTriangle- Returns:
- A new Triangle that is identical to this one, but with the order of the points reversed.
-
getBoundsMin
public Point getBoundsMin()
Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).- Specified by:
getBoundsMinin interfaceGeomElement<GeomTriangle>- Returns:
- The minimum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException- if this list contains no elements.
-
getBoundsMax
public Point getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).- Specified by:
getBoundsMaxin interfaceGeomElement<GeomTriangle>- Returns:
- The maximum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException- if this list contains no elements.
-
getTransformed
public TriangleTrans getTransformed(GTransform transform)
Returns transformed version of this element. The returned object implementsGeomTransformand contains this element as a child.- Specified by:
getTransformedin interfaceTransformable<GeomTriangle>- Parameters:
transform- The transformation to apply to this geometry. May not be null.- Returns:
- A new line segment that is identical to this one with the specified transformation applied.
- Throws:
DimensionException- if this point is not 3D.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which this triangle is stated.- Specified by:
getUnitin interfaceGeomElement<GeomTriangle>- Overrides:
getUnitin classGeomTriangle- Returns:
- The unit in which this GeomTriangle is stated.
-
to
public TriangleTrans to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this element but stated in the specified unit.- Specified by:
toin interfaceGeomElement<GeomTriangle>- Specified by:
toin interfacePointGeometry<GeomTriangle>- 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.
-
toDimension
public TriangleTrans toDimension(int newDim)
Return a copy of this Triangle 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<GeomTriangle>- Parameters:
newDim- The dimension of the Triangle to return.- Returns:
- This Triangle converted to the new dimensions.
- Throws:
java.lang.IllegalArgumentException- if the new dimension is anything other than 3.
-
copy
public TriangleTrans copy()
Returns a copy of this TriangleTrans instance allocated by the calling thread (possibly on the stack).- Specified by:
copyin interfaceGeomElement<GeomTriangle>- Returns:
- an identical and independent copy of this point.
-
equals
public boolean equals(java.lang.Object obj)
Compares this TriangleTrans against the specified object for strict equality.- Overrides:
equalsin classAbstractGeomElement<GeomTriangle>- Parameters:
obj- the object to compare with.- Returns:
trueif this transform is identical to that transform;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCodein classAbstractGeomElement<GeomTriangle>- Returns:
- the hash code value.
-
recycle
public static void recycle(TriangleTrans instance)
Recycles aTriangleTransinstance immediately (on the stack when executing in a StackContext).- Parameters:
instance- The instance to recycle immediately.
-
-