Package geomss.geom
Class GeomPointTrans
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<GeomPoint>
-
- geomss.geom.GeomPoint
-
- geomss.geom.GeomPointTrans
-
- All Implemented Interfaces:
GeomElement<GeomPoint>,GeomTransform<GeomPoint>,PointGeometry<GeomPoint>,Transformable<GeomPoint>,XYPoint,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,javolution.lang.Reusable,javolution.xml.XMLSerializable
public final class GeomPointTrans extends GeomPoint implements GeomTransform<GeomPoint>
AGeomTransformelement that refers to aGeomPointobject and masquerades as a GeomPoint object itself.Modified by: Joseph A. Huwaldt
- Version:
- April 10, 2018
- Author:
- Joseph A. Huwaldt, Date: April 30, 2009
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GeomPointTranscopy()Returns a copy of this GeomPointTrans instanceallocatedby the calling thread (possibly on the stack).PointcopyToReal()Return a copy of the child object transformed by this transformation.booleanequals(java.lang.Object obj)Compares this GeomPointTrans against the specified object for strict equality (same values and same units).GeomPointgetChild()Returns the child object transformed by this transform element.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.javax.measure.unit.Unit<javax.measure.quantity.Length>getUnit()Returns the unit in which thevaluesin this point are stated in.doublegetValue(int i)Returns the value of the Parameter in this point as adouble, stated in this point'sunit.doublegetValue(int i, javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the value of a coordinate in this point as adouble, stated in the specified unit.inthashCode()Returns the hash code for this parameter.Pointimmutable()Return an immutable version of this point.booleanisValid()Returntrueif this point contains valid and finite numerical components.static voidmain(java.lang.String[] args)Tests the methods in this class.Pointminus(GeomPoint that)Returns the difference between this point and the one specified.Pointminus(Parameter<javax.measure.quantity.Length> that)Subtracts the specified parameter from each component of this point.static GeomPointTransnewInstance(GeomPoint child, GTransform transform)doublenormSqValue()Returns the square of the Euclidean norm, magnitude, or length value of the vector from the origin to this point (the dot product of the origin-to-this-point vector and itself).Pointopposite()Returns the negation of this point (all the values of each dimension negated).Pointplus(GeomPoint that)Returns the sum of this point with the one specified.Pointplus(Parameter<javax.measure.quantity.Length> that)Adds the specified parameter to each component of this point.static voidrecycle(GeomPointTrans instance)Recycles aGeomPointTransinstance immediately (on the stack when executing in aStackContext).voidsetTransform(GTransform transform)Sets the transformation represented by this transformation element.Pointtimes(double k)Returns the product of this point with the specified coefficient.GeomPointTransto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent of this GeomPointTrans object that has a child point in the specified units.GeomPointTranstoDimension(int newDim)Return the equivalent of this point converted to the specified number of physical dimensions.Float64VectortoFloat64Vector()Returns the values stored in this transformed point, stated in this point'sunit, as a Float64Vector.Vector3D<javax.measure.quantity.Length>toVector3D()Returns a Vector3D representation of this transformed point if possible.-
Methods inherited from class geomss.geom.GeomPoint
distance, distanceSq, distanceSqValue, distanceValue, divide, divide, get, getBoundsMax, getBoundsMin, getLimitPoint, getNumberOfPoints, getParDimension, getTransformed, getX, getY, getZ, isApproxEqual, isApproxEqual, max, min, norm, normSq, normValue, size, times, toArray, toArray, toGeomVector, toParameterVector, 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, getBoundsMax, getBoundsMin, getID, getLimitPoint, getName, getParDimension, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, size, toText
-
Methods inherited from interface geomss.geom.Transformable
getTransformed
-
-
-
-
Method Detail
-
newInstance
public static GeomPointTrans newInstance(GeomPoint child, GTransform transform)
- Parameters:
child- The point 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.
- Throws:
DimensionException- if the input element is not 3D.
-
getTransform
public GTransform getTransform()
Returns the transformation represented by this transformation element.- Specified by:
getTransformin interfaceGeomTransform<GeomPoint>- Returns:
- The transformation represented by this transformation element.
-
getTotalTransform
public GTransform getTotalTransform()
Returns the total transformation represented by an entire chain of GeomTransform objects below this one.- Specified by:
getTotalTransformin interfaceGeomTransform<GeomPoint>- Returns:
- The total transformation represented by an entire chain of GeomTransform objects below this one.
-
setTransform
public void setTransform(GTransform transform)
Sets the transformation represented by this transformation element.- Specified by:
setTransformin interfaceGeomTransform<GeomPoint>- Parameters:
transform- The transform to set this transform element to (may not benull).
-
getChild
public GeomPoint getChild()
Returns the child object transformed by this transform element.- Specified by:
getChildin interfaceGeomTransform<GeomPoint>- Returns:
- The child object transformed by this transform element.
-
copyToReal
public Point copyToReal()
Return a copy of the child object transformed by this transformation.- Specified by:
copyToRealin interfaceGeomElement<GeomPoint>- Specified by:
copyToRealin interfaceGeomTransform<GeomPoint>- Specified by:
copyToRealin classGeomPoint- Returns:
- A copy of the child object transformed by this transformation.
-
recycle
public static void recycle(GeomPointTrans instance)
Recycles aGeomPointTransinstance 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. This implementation always returns 3.- Specified by:
getPhyDimensionin interfaceGeomElement<GeomPoint>- Returns:
- The number of physical dimensions of this geometry element.
-
getValue
public double getValue(int i)
Returns the value of the Parameter in this point as adouble, stated in this point'sunit.
-
getValue
public double getValue(int i, javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the value of a coordinate in this point as adouble, stated in the specified unit.
-
normSqValue
public double normSqValue()
Returns the square of the Euclidean norm, magnitude, or length value of the vector from the origin to this point (the dot product of the origin-to-this-point vector and itself). This is slightly faster than callingnormValueif the squared value is all that is needed.- Specified by:
normSqValuein classGeomPoint- Returns:
this.normSq().getValue().- See Also:
GeomPoint.normValue()
-
plus
public Point plus(GeomPoint that)
Returns the sum of this point with the one specified. The unit of the output point will be the units of this point.- Specified by:
plusin classGeomPoint- Parameters:
that- the point to be added. May not be null.- Returns:
this + that.- Throws:
DimensionException- if point dimensions are different.
-
plus
public Point plus(Parameter<javax.measure.quantity.Length> that)
Adds the specified parameter to each component of this point. The unit of the output point will be the units of this point.
-
minus
public Point minus(GeomPoint that)
Returns the difference between this point and the one specified. The unit of the output point will be the units of this point.- Specified by:
minusin classGeomPoint- Parameters:
that- the point to be subtracted from this point. May not be null.- Returns:
this - that.- Throws:
DimensionException- if point dimensions are different.
-
minus
public Point minus(Parameter<javax.measure.quantity.Length> that)
Subtracts the specified parameter from each component of this point. The unit of the output point will be the units of this point.
-
opposite
public Point opposite()
Returns the negation of this point (all the values of each dimension negated).
-
times
public Point times(double k)
Returns the product of this point with the specified coefficient.
-
isValid
public boolean isValid()
Returntrueif this point contains valid and finite numerical components. A value offalsewill be returned if any of the coordinate values are NaN or Inf.- Specified by:
isValidin interfaceGeomElement<GeomPoint>- Overrides:
isValidin classGeomPoint- Returns:
- true if this geometry element contains valid and finite data.
-
copy
public GeomPointTrans copy()
Returns a copy of this GeomPointTrans instanceallocatedby the calling thread (possibly on the stack).- Specified by:
copyin interfaceGeomElement<GeomPoint>- Specified by:
copyin classGeomPoint- Returns:
- an identical and independent copy of this point.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which thevaluesin this point are stated in.- Specified by:
getUnitin interfaceGeomElement<GeomPoint>- Returns:
- The unit in which the geometry in this element are stated.
-
to
public GeomPointTrans to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent of this GeomPointTrans object that has a child point in the specified units.WARNING: If the unit changes, then the returned transform element DOES NOT refer back to the original point (the link with the original point is broken).
- Specified by:
toin interfaceGeomElement<GeomPoint>- Specified by:
toin interfacePointGeometry<GeomPoint>- Parameters:
unit- the length unit of the point to be returned. May not be null.- Returns:
- an equivalent to this point but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException- if the the input unit is not a length unit.
-
toVector3D
public Vector3D<javax.measure.quantity.Length> toVector3D()
Returns a Vector3D representation of this transformed point if possible.- Overrides:
toVector3Din classGeomPoint- Returns:
- A Vector3D that is equivalent to this transformed point
- Throws:
DimensionException- if this point has any number of dimensions other than 3.
-
toFloat64Vector
public Float64Vector toFloat64Vector()
Returns the values stored in this transformed point, stated in this point'sunit, as a Float64Vector.- Specified by:
toFloat64Vectorin classGeomPoint- Returns:
- A Float64Vector containing the values stored in this point in the current units.
-
toDimension
public GeomPointTrans toDimension(int newDim)
Return the equivalent of this point converted to the specified number of physical dimensions. This implementation will throw an exception if the specified dimension is anything other than 3.- Specified by:
toDimensionin interfaceGeomElement<GeomPoint>- Parameters:
newDim- The dimension of the point to return. MUST equal 3.- Returns:
- The equivalent of this point converted to the new dimensions.
- Throws:
java.lang.IllegalArgumentException- if the new dimension is anything other than 3.
-
equals
public boolean equals(java.lang.Object obj)
Compares this GeomPointTrans against the specified object for strict equality (same values and same units).- Overrides:
equalsin classAbstractGeomElement<GeomPoint>- Parameters:
obj- the object to compare with.- Returns:
trueif this point is identical to that point;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCodein classAbstractGeomElement<GeomPoint>- Returns:
- the hash code value.
-
main
public static void main(java.lang.String[] args)
Tests the methods in this class.- Parameters:
args- Command-line arguments (not used).
-
-