Package geomss.geom
Class VectorTrans<Q extends javax.measure.quantity.Quantity>
- java.lang.Object
 - 
- geomss.geom.AbstractGeomElement<GeomVector>
 - 
- geomss.geom.GeomVector<Q>
 - 
- geomss.geom.VectorTrans<Q>
 
 
 
 
- 
- Type Parameters:
 Q- The Quantity (unit type) of the elements of this vector.
- All Implemented Interfaces:
 GeomElement<GeomVector>,GeomTransform<GeomVector>,Transformable<GeomVector>,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,javolution.lang.Reusable,javolution.xml.XMLSerializable
public final class VectorTrans<Q extends javax.measure.quantity.Quantity> extends GeomVector<Q> implements GeomTransform<GeomVector>
AGeomTransformelement that refers to aGeomVectorobject and masquerades as a GeomVector object itself.Modified by: Joseph A. Huwaldt
- Version:
 - April 10, 2018
 - Author:
 - Joseph A. Huwaldt, Date: June 13, 2009
 - See Also:
 - Serialized Form
 
 
- 
- 
Field Summary
- 
Fields inherited from class geomss.geom.GeomVector
X, Y, Z 
- 
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES 
 - 
 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VectorTrans<Q>copy()Returns a copy of this VectorTrans instanceallocatedby the calling thread (possibly on the stack).Vector<Q>copyToReal()Return a copy of the child object transformed by this transformation.Vector<? extends javax.measure.quantity.Quantity>cross(GeomVector<?> that)Returns the cross product of two vectors.Vector<Q>divide(double divisor)Returns this vector with each element divided by the specified divisor (dimensionless).Vector<? extends javax.measure.quantity.Quantity>divide(Parameter<?> that)Returns this vector with each element divided by the specified divisor.booleanequals(java.lang.Object obj)Compares this VectorTrans against the specified object for strict equality (same values and same units).GeomVector<Q>getChild()Returns the child object transformed by this transform element.PointgetOrigin()Return the origin point for this vector.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.VectorTrans<Q>getTransformed(GTransform transform)Returns transformed version of this element.javax.measure.unit.UnitgetUnit()Returns the unit in which thevaluesin this vector are stated in.doublegetValue(int i)Returns the value of the Parameter in this vector as adouble, stated in this vector'sunit.doublegetValue(int i, javax.measure.unit.Unit<Q> unit)Returns the value of the Parameter in this vector as adouble, stated in the specified units.inthashCode()Returns the hash code for this parameter.Vector<Q>immutable()Return an immutable version of this vector.Vector<Q>minus(GeomVector<Q> that)Returns the difference between this vector and the one specified.Vector<Q>minus(Parameter<Q> that)Subtracts the supplied Parameter from each element of this vector and returns the result.static <Q extends javax.measure.quantity.Quantity>
VectorTrans<Q>newInstance(GeomVector<Q> child, GTransform transform)doublenormValue()Returns theGeomVector.norm(), magnitude, or length value of the vector from the origin to this point (square root of the dot product of the origin-to-this-point vector and itself).Vector<Q>opposite()Returns the negation of this vector.Vector<Q>plus(GeomVector<Q> that)Returns the sum of this vector with the one specified.Vector<Q>plus(Parameter<Q> that)Returns the sum of this vector with the parameter specified.static voidrecycle(VectorTrans instance)Recycles aVectorTransinstance immediately (on the stack when executing in aStackContext).voidsetOrigin(Point origin)Set the origin point for this vector.voidsetTransform(GTransform transform)Sets the transformation represented by this transformation element.Vector<Q>times(double k)Returns the product of this vector with the specified coefficient (dimensionless).Parameter<? extends javax.measure.quantity.Quantity>times(GeomVector<?> that)Returns the dot product (scalar product) of this vector with the one specified.Vector<? extends javax.measure.quantity.Quantity>times(Parameter<?> k)Returns the product of this vector with the specified coefficient.Vector<? extends javax.measure.quantity.Quantity>timesEBE(GeomVector<?> that)Returns the element-by-element product of this vector with the one specified.GeomVectorto(javax.measure.unit.Unit unit)Returns the equivalent to this vector but stated in the specified unit.VectorTrans<Q>toDimension(int newDim)Return the equivalent of this vector converted to the specified number of physical dimensions.Float64VectortoFloat64Vector()Returns aFloat64Vectorcontaining the elements of this vector stated in the current units.ParameterVector<Q>toParameterVector()Returns aParameterVectorrepresentation of this vector.Vector<javax.measure.quantity.Dimensionless>toUnitVector()Returns this vector converted to a unit vector by dividing all the vector's elements by the length (GeomVector.norm()) of this vector.- 
Methods inherited from class geomss.geom.GeomVector
angle, dot, get, getBoundsMax, getBoundsMin, getLimitPoint, getParDimension, isApproxEqual, isApproxEqual, isValid, mag, magValue, norm, size, toArray, toArray, 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, isValid, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, size, toText 
 - 
 
 - 
 
- 
- 
Method Detail
- 
newInstance
public static <Q extends javax.measure.quantity.Quantity> VectorTrans<Q> newInstance(GeomVector<Q> child, GTransform transform)
- Type Parameters:
 Q- The Quantity (unit type) of this vector.- Parameters:
 child- The vector 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<Q extends javax.measure.quantity.Quantity>- 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<Q extends javax.measure.quantity.Quantity>- 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<Q extends javax.measure.quantity.Quantity>- Parameters:
 transform- The transform to set this transform element to (may not benull).
 
- 
getChild
public GeomVector<Q> getChild()
Returns the child object transformed by this transform element.- Specified by:
 getChildin interfaceGeomTransform<Q extends javax.measure.quantity.Quantity>- Returns:
 - The child object transformed by this transform element.
 
 
- 
copyToReal
public Vector<Q> copyToReal()
Return a copy of the child object transformed by this transformation.- Specified by:
 copyToRealin interfaceGeomElement<Q extends javax.measure.quantity.Quantity>- Specified by:
 copyToRealin interfaceGeomTransform<Q extends javax.measure.quantity.Quantity>- Returns:
 - A copy of the child object transformed by this transformation.
 
 
- 
recycle
public static void recycle(VectorTrans instance)
Recycles aVectorTransinstance 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<Q extends javax.measure.quantity.Quantity>- Returns:
 - The number of physical dimensions of this geometry element.
 
 
- 
getValue
public double getValue(int i)
Returns the value of the Parameter in this vector as adouble, stated in this vector'sunit.- Specified by:
 getValuein classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 i- the dimension index.- Returns:
 - the value of the Parameter at 
i. - Throws:
 java.lang.IndexOutOfBoundsException-(i < 0) || (i ≥ getPhyDimension())
 
- 
getValue
public double getValue(int i, javax.measure.unit.Unit<Q> unit)
Returns the value of the Parameter in this vector as adouble, stated in the specified units.- Specified by:
 getValuein classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 i- the dimension index.unit- the unit to return the value in. May not be null.- Returns:
 - the value of the Parameter at 
iin the specified unit. - Throws:
 java.lang.IndexOutOfBoundsException-(i < 0) || (i ≥ getPhyDimension())
 
- 
setOrigin
public void setOrigin(Point origin)
Set the origin point for this vector. The origin is used as a reference for drawing the vector and is not a part of the state of this vector and is not used in any calculations with this vector.- Specified by:
 setOriginin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 origin- The new origin point for the vector. May not be null.
 
- 
getOrigin
public Point getOrigin()
Return the origin point for this vector. If no origin has been explicitly set, then the coordinate system origin is returned.- Specified by:
 getOriginin classGeomVector<Q extends javax.measure.quantity.Quantity>- Returns:
 - The origin point for this vector.
 
 
- 
normValue
public double normValue()
Returns theGeomVector.norm(), magnitude, or length value of the vector from the origin to this point (square root of the dot product of the origin-to-this-point vector and itself).- Specified by:
 normValuein classGeomVector<Q extends javax.measure.quantity.Quantity>- Returns:
 this.norm().doubleValue().
 
- 
opposite
public Vector<Q> opposite()
Returns the negation of this vector.- Specified by:
 oppositein classGeomVector<Q extends javax.measure.quantity.Quantity>- Returns:
 -this.
 
- 
plus
public Vector<Q> plus(GeomVector<Q> that)
Returns the sum of this vector with the one specified. The unit of the output vector will be the units of this vector.- Specified by:
 plusin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 that- the vector to be added. May not be null.- Returns:
 this + that.- Throws:
 DimensionException- if vector dimensions are different.
 
- 
plus
public Vector<Q> plus(Parameter<Q> that)
Returns the sum of this vector with the parameter specified. The input parameter is added to each component of this vector. The unit of the output vector will be the units of this vector.- Specified by:
 plusin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 that- the parameter to be added to each element of this vector. May not be null.- Returns:
 this + that.
 
- 
minus
public Vector<Q> minus(GeomVector<Q> that)
Returns the difference between this vector and the one specified. The unit of the output vector will be the units of this vector.- Specified by:
 minusin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 that- the vector to be subtracted from this vector. May not be null.- Returns:
 this - that.- Throws:
 DimensionException- if vector dimensions are different.
 
- 
minus
public Vector<Q> minus(Parameter<Q> that)
Subtracts the supplied Parameter from each element of this vector and returns the result. The unit of the output vector will be the units of this vector.- Specified by:
 minusin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 that- the Parameter to be subtracted from each element of this vector. May not be null.- Returns:
 this - that.
 
- 
times
public Vector<Q> times(double k)
Returns the product of this vector with the specified coefficient (dimensionless).- Specified by:
 timesin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 k- the coefficient multiplier.- Returns:
 this · k
 
- 
times
public Vector<? extends javax.measure.quantity.Quantity> times(Parameter<?> k)
Returns the product of this vector with the specified coefficient.- Specified by:
 timesin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 k- the coefficient multiplier. May not be null.- Returns:
 this · k
 
- 
times
public Parameter<? extends javax.measure.quantity.Quantity> times(GeomVector<?> that)
Returns the dot product (scalar product) of this vector with the one specified.- Specified by:
 timesin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 that- the vector multiplier. May not be null.- Returns:
 this · that- Throws:
 DimensionException- ifthis.dimension() != that.dimension()- See Also:
 - Wikipedia: Dot Product
 
 
- 
timesEBE
public Vector<? extends javax.measure.quantity.Quantity> timesEBE(GeomVector<?> that)
Returns the element-by-element product of this vector with the one specified.- Specified by:
 timesEBEin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 that- the vector multiplier. May not be null.- Returns:
 this .* that- Throws:
 DimensionException- ifthis.dimension() != that.dimension()
 
- 
cross
public Vector<? extends javax.measure.quantity.Quantity> cross(GeomVector<?> that)
Returns the cross product of two vectors.- Specified by:
 crossin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 that- the vector multiplier. May not be null.- Returns:
 this x that- Throws:
 DimensionException- if(that.getDimension() != this.getDimension())- See Also:
 - Wikipedia: Cross Product
 
 
- 
divide
public Vector<Q> divide(double divisor)
Returns this vector with each element divided by the specified divisor (dimensionless).- Specified by:
 dividein classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 divisor- the divisor.- Returns:
 this / divisor.
 
- 
divide
public Vector<? extends javax.measure.quantity.Quantity> divide(Parameter<?> that)
Returns this vector with each element divided by the specified divisor.- Specified by:
 dividein classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 that- the divisor. May not be null.- Returns:
 this / that.
 
- 
immutable
public Vector<Q> immutable()
Return an immutable version of this vector.- Specified by:
 immutablein classGeomVector<Q extends javax.measure.quantity.Quantity>- Returns:
 - An immutable version of this vector.
 
 
- 
toUnitVector
public Vector<javax.measure.quantity.Dimensionless> toUnitVector()
Returns this vector converted to a unit vector by dividing all the vector's elements by the length (GeomVector.norm()) of this vector.- Specified by:
 toUnitVectorin classGeomVector<Q extends javax.measure.quantity.Quantity>- Returns:
 - This vector converted to a unit vector.
 
 
- 
getUnit
public javax.measure.unit.Unit getUnit()
Returns the unit in which thevaluesin this vector are stated in.- Specified by:
 getUnitin interfaceGeomElement<Q extends javax.measure.quantity.Quantity>- Returns:
 - The unit in which the geometry in this element are stated.
 
 
- 
to
public GeomVector to(javax.measure.unit.Unit unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this vector but stated in the specified unit.- Specified by:
 toin interfaceGeomElement<Q extends javax.measure.quantity.Quantity>- Parameters:
 unit- the unit of the vector to be returned. May not be null.- Returns:
 - an equivalent to this vector but stated in the specified unit.
 - Throws:
 javax.measure.converter.ConversionException- if the the input unit is not compatible with this unit.
 
- 
toParameterVector
public ParameterVector<Q> toParameterVector()
Returns aParameterVectorrepresentation of this vector.- Specified by:
 toParameterVectorin classGeomVector<Q extends javax.measure.quantity.Quantity>- Returns:
 - A ParameterVector that is equivalent to this vector.
 
 
- 
toFloat64Vector
public Float64Vector toFloat64Vector()
Returns aFloat64Vectorcontaining the elements of this vector stated in the current units.- Specified by:
 toFloat64Vectorin classGeomVector<Q extends javax.measure.quantity.Quantity>- Returns:
 - A Float64Vector that contains the elements of this vector in the current units.
 
 
- 
getTransformed
public VectorTrans<Q> getTransformed(GTransform transform)
Returns transformed version of this element. The returned object implementsGeomTransformand contains this element as a child.- Specified by:
 getTransformedin interfaceTransformable<Q extends javax.measure.quantity.Quantity>- Overrides:
 getTransformedin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 transform- The transform to apply to this vector. May not be null.- Returns:
 - A new triangle that is identical to this one with the specified transformation applied.
 
 
- 
toDimension
public VectorTrans<Q> toDimension(int newDim)
Return the equivalent of this vector 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<Q extends javax.measure.quantity.Quantity>- Specified by:
 toDimensionin classGeomVector<Q extends javax.measure.quantity.Quantity>- Parameters:
 newDim- The dimension of the vector to return. MUST equal 3.- Returns:
 - The equivalent of this vector 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 VectorTrans against the specified object for strict equality (same values and same units).- Overrides:
 equalsin classAbstractGeomElement<GeomVector>- 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<GeomVector>- Returns:
 - the hash code value.
 
 
- 
copy
public VectorTrans<Q> copy()
Returns a copy of this VectorTrans instanceallocatedby the calling thread (possibly on the stack).- Specified by:
 copyin interfaceGeomElement<Q extends javax.measure.quantity.Quantity>- Specified by:
 copyin classGeomVector<Q extends javax.measure.quantity.Quantity>- Returns:
 - an identical and independent copy of this vector.
 
 
 - 
 
 -