Package jahuwaldt.js.param
Class Cylindrical3D<Q extends javax.measure.quantity.Quantity>
- java.lang.Object
-
- org.jscience.mathematics.vector.Vector<Parameter<Q>>
-
- jahuwaldt.js.param.AbstractParamVector<Q,Coordinate3D<Q>>
-
- jahuwaldt.js.param.Coordinate3D<Q>
-
- jahuwaldt.js.param.Cylindrical3D<Q>
-
- Type Parameters:
Q
- The Quantity (unit type, such as Length or Volume) of this vector.
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<javax.measure.Measurable<Q>>
,javax.measure.Measurable<Q>
,javolution.lang.Immutable
,javolution.lang.Realtime
,javolution.lang.ValueType
,javolution.xml.XMLSerializable
,GroupAdditive<Vector<Parameter<Q>>>
,Structure<Vector<Parameter<Q>>>
,VectorSpace<Vector<Parameter<Q>>,Parameter<Q>>
,VectorSpaceNormed<Vector<Parameter<Q>>,Parameter<Q>>
public final class Cylindrical3D<Q extends javax.measure.quantity.Quantity> extends Coordinate3D<Q> implements javolution.xml.XMLSerializable
This class represents a 3 elementvector
of Parameter elements representing a geometrical cylindrical coordinate with elements radius, azimuth angle and height.Modified by: Joseph A. Huwaldt
- Version:
- November 3, 2015
- Author:
- Joseph A. Huwaldt, Date: October 29, 2015
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Cylindrical3D<Q>
angleTo(javax.measure.unit.Unit<javax.measure.quantity.Angle> unit)
Returns the equivalent to this vector but with the azimuth angle stated in the specified unit.<T extends javax.measure.quantity.Quantity>
Cylindrical3D<T>asType(java.lang.Class<T> type)
Casts this Cylindrical3D to a parameterized unit of specified nature or throw aClassCastException
if the dimension of the specified quantity and this parameter's unit dimension do not match.Cylindrical3D<Q>
copy()
Returns a copy of this vectorallocated
by the calling thread (possibly on the stack).Cylindrical3D
cross(Vector that)
Returns the cross product of two 3-dimensional vectors.Cylindrical3D<?>
divide(Parameter<?> that)
Returns the result of this vector divided by the specified divisor.boolean
equals(java.lang.Object obj)
Compares this Cylindrical3D against the specified object for strict equality (same values and same units).Cylindrical3D<Q>
fromVector3D(Vector3D<Q> vector)
Return the specifiedVector3D
object as aCylindrical3D
instance.Parameter
get(int i)
Returns the value of a Parameter from this vector.javax.measure.unit.Unit<javax.measure.quantity.Angle>
getAngleUnit()
Returns the unit in which the azimuth angle in this vector is stated in.Parameter<javax.measure.quantity.Angle>
getAzimuth()
Returns the azimuth angle of this vector as aParameter
.Parameter<Q>
getHeight()
Returns the height or altitude element of this vector as aParameter
.Parameter<Q>
getRadius()
Returns the radius element of this vector as aParameter
.double
getRadiusValue()
Returns the radius element of this vector as adouble
, stated in this vector'sunit
.javax.measure.unit.Unit<Q>
getUnit()
Returns the unit in which the radius and height in this vector are stated in.int
hashCode()
Returns the hash code for this parameter.Cylindrical3D<Q>
minus(Parameter<Q> that)
Subtracts the supplied Parameter from this vector's and returns the result.Cylindrical3D<Q>
minus(Vector<Parameter<Q>> that)
Returns the difference between this vector and the one specified.Parameter<Q>
norm()
Returns the Euclidian norm, magnitude, or length of this vector (square root of the dot product of this vector and itself).double
normValue()
Returns thenorm
, magnitude, or length value of this vector.Cylindrical3D<Q>
opposite()
Returns the negation of this vector.Cylindrical3D<Q>
plus(Parameter<Q> that)
Returns the sum of this vector with the parameter specified.Cylindrical3D<Q>
plus(Vector<Parameter<Q>> that)
Returns the sum of this vector with the one specified.Cylindrical3D<Q>
times(double k)
Returns the product of this vector with the specified coefficient.Cylindrical3D
times(Parameter k)
Returns the product of this vector with the specified coefficient.Parameter
times(Vector that)
Returns the dot product of this vector with the one specified.<R extends javax.measure.quantity.Quantity>
Cylindrical3D<R>to(javax.measure.unit.Unit<R> unit)
Returns the equivalent to this vector but with the radius and height stated in the specified unit.Cylindrical3D<javax.measure.quantity.Dimensionless>
toUnitVector()
Returns this vector converted to a unit vector with a vector magnitude of 1.0.Vector3D<Q>
toVector3D()
Returns a Cartesian Vector3D representation of this vector.static <Q extends javax.measure.quantity.Quantity>
Cylindrical3D<Q>valueOf(double radius, double azimuth, double height, javax.measure.unit.Unit<Q> radiusUnit, javax.measure.unit.Unit<javax.measure.quantity.Angle> angleUnit)
Returns aCylindrical3D
instance holding the specifieddouble
values stated in the specified units.static <Q extends javax.measure.quantity.Quantity>
Cylindrical3D<Q>valueOf(Coordinate3D<Q> coordinate)
Returns aCylindrical3D
instance containing the cylindrical coordinate representation of the specifiedcoordinate
.static <Q extends javax.measure.quantity.Quantity>
Cylindrical3D<Q>valueOf(Coordinate3D<Q> coord, javax.measure.unit.Unit<javax.measure.quantity.Angle> angleUnit)
Returns aCylindrical3D
instance containing the cylindrical coordinate representation of the specifiedcoordinate
.static <Q extends javax.measure.quantity.Quantity>
Cylindrical3D<Q>valueOf(Parameter<Q> radius, Parameter<javax.measure.quantity.Angle> azimuth, Parameter<Q> height)
Returns aCylindrical3D
instance holding the specifiedParameter
values.-
Methods inherited from class jahuwaldt.js.param.Coordinate3D
getDimension, isApproxEqual, isApproxZero
-
-
-
-
Field Detail
-
RADIUS
public static final int RADIUS
Constant used to identify the radius of in the vector.- See Also:
- Constant Field Values
-
AZIMUTH
public static final int AZIMUTH
Constant used to identify the azimuth angle of the vector.- See Also:
- Constant Field Values
-
HEIGHT
public static final int HEIGHT
Constant used to identify the height or altitude of the vector.- See Also:
- Constant Field Values
-
-
Method Detail
-
valueOf
public static <Q extends javax.measure.quantity.Quantity> Cylindrical3D<Q> valueOf(double radius, double azimuth, double height, javax.measure.unit.Unit<Q> radiusUnit, javax.measure.unit.Unit<javax.measure.quantity.Angle> angleUnit)
Returns aCylindrical3D
instance holding the specifieddouble
values stated in the specified units.- Type Parameters:
Q
- the Quantity (unit type, e.g. Length or Volume) of this vector.- Parameters:
radius
- the radius of the vector stated in the specified radius unit.azimuth
- the vector azimuth angle stated in the specified angle unit.height
- the vector height/altitude value stated in the specified radius unit.radiusUnit
- the unit in which the radius and height is stated.angleUnit
- the unit in which the azimuth angle is stated.- Returns:
- the vector having the specified values.
-
valueOf
public static <Q extends javax.measure.quantity.Quantity> Cylindrical3D<Q> valueOf(Parameter<Q> radius, Parameter<javax.measure.quantity.Angle> azimuth, Parameter<Q> height)
Returns aCylindrical3D
instance holding the specifiedParameter
values.- Type Parameters:
Q
- the Quantity (unit type, e.g. Length or Volume) of this vector.- Parameters:
radius
- the vector radius value.azimuth
- the vector azimuth angle value.height
- the vector height/altitude value.- Returns:
- the vector having the specified values in the units of magnitude.
-
valueOf
public static <Q extends javax.measure.quantity.Quantity> Cylindrical3D<Q> valueOf(Coordinate3D<Q> coordinate)
Returns aCylindrical3D
instance containing the cylindrical coordinate representation of the specifiedcoordinate
. The azimuth component of the resulting vector will have units of radians.- Type Parameters:
Q
- the Quantity (unit type, e.g. Length or Volume) of this vector.- Parameters:
coordinate
- the input coordinate.- Returns:
- the cylindrical coordinate having the specified values.
-
valueOf
public static <Q extends javax.measure.quantity.Quantity> Cylindrical3D<Q> valueOf(Coordinate3D<Q> coord, javax.measure.unit.Unit<javax.measure.quantity.Angle> angleUnit)
Returns aCylindrical3D
instance containing the cylindrical coordinate representation of the specifiedcoordinate
.- Type Parameters:
Q
- the Quantity (unit type, e.g. Length or Volume) of this vector.- Parameters:
coord
- the coordinate to convert.angleUnit
- the unit to use for the azimuth component.- Returns:
- the cylindrical coordinate vector having the specified values.
-
fromVector3D
public Cylindrical3D<Q> fromVector3D(Vector3D<Q> vector)
Return the specifiedVector3D
object as aCylindrical3D
instance.- Specified by:
fromVector3D
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Parameters:
vector
- The Vector3D object to be converted to a Cylindrical3D.- Returns:
- A Cylindrical3D instance that is equivalent to the supplied Vector3D object.
-
get
public Parameter get(int i)
Returns the value of a Parameter from this vector. The dimensions are defined as: radius, azimuth angle, and height or altitude in that order.
-
getRadiusValue
public double getRadiusValue()
Returns the radius element of this vector as adouble
, stated in this vector'sunit
.- Returns:
- the radius element of this vector in this vector's units.
-
getRadius
public Parameter<Q> getRadius()
Returns the radius element of this vector as aParameter
.- Returns:
- the radius element of this vector.
-
getAzimuth
public Parameter<javax.measure.quantity.Angle> getAzimuth()
Returns the azimuth angle of this vector as aParameter
.- Returns:
- the azimuth angle of this vector.
-
getHeight
public Parameter<Q> getHeight()
Returns the height or altitude element of this vector as aParameter
.- Returns:
- the height element of this vector.
-
norm
public Parameter<Q> norm()
Returns the Euclidian norm, magnitude, or length of this vector (square root of the dot product of this vector and itself).- Specified by:
norm
in interfaceVectorSpaceNormed<Vector<Parameter<Q extends javax.measure.quantity.Quantity>>,Parameter<Q extends javax.measure.quantity.Quantity>>
- Overrides:
norm
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Returns:
sqrt(this · this)
.- See Also:
- Wikipedia: Vector Norm
-
normValue
public double normValue()
Returns thenorm
, magnitude, or length value of this vector.- Specified by:
normValue
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Returns:
this.norm().getValue()
.
-
opposite
public Cylindrical3D<Q> opposite()
Returns the negation of this vector.
-
plus
public Cylindrical3D<Q> plus(Vector<Parameter<Q>> that)
Returns the sum of this vector with the one specified. The units of the output vector will be the units of this vector.- Specified by:
plus
in interfaceGroupAdditive<Q extends javax.measure.quantity.Quantity>
- Specified by:
plus
in classVector<Parameter<Q extends javax.measure.quantity.Quantity>>
- Parameters:
that
- the vector to be added.- Returns:
this + that
.- Throws:
DimensionException
- if vector dimensions are different.
-
plus
public Cylindrical3D<Q> plus(Parameter<Q> that)
Returns the sum of this vector with the parameter specified. The unit of the output vector will be the units of this vector.- Specified by:
plus
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Parameters:
that
- the parameter to be added to this vector.- Returns:
this + that
.
-
minus
public Cylindrical3D<Q> minus(Vector<Parameter<Q>> that)
Returns the difference between this vector and the one specified.
-
minus
public Cylindrical3D<Q> minus(Parameter<Q> that)
Subtracts the supplied Parameter from this vector's and returns the result. The unit of the output vector will be the units of this vector.- Specified by:
minus
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Parameters:
that
- the Parameter to be subtracted from this vector.- Returns:
this - that
.
-
times
public Cylindrical3D times(Parameter k)
Returns the product of this vector with the specified coefficient. The magnitude of this vector is scaled by the input coefficient and the direction is left unchanged.- Specified by:
times
in interfaceVectorSpace<Vector<Parameter<Q extends javax.measure.quantity.Quantity>>,Parameter<Q extends javax.measure.quantity.Quantity>>
- Specified by:
times
in classVector<Parameter<Q extends javax.measure.quantity.Quantity>>
- Parameters:
k
- the coefficient multiplier.- Returns:
this · k
-
times
public Cylindrical3D<Q> times(double k)
Returns the product of this vector with the specified coefficient. The magnitude of this vector is scaled by the input coefficient and the direction is left unchanged.- Specified by:
times
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Parameters:
k
- the coefficient multiplier.- Returns:
this · k
-
times
public Parameter times(Vector that)
Returns the dot product of this vector with the one specified.- Specified by:
times
in classVector<Parameter<Q extends javax.measure.quantity.Quantity>>
- Parameters:
that
- the vector multiplier.- Returns:
this · that
- Throws:
DimensionException
- ifthis.dimension() != that.dimension()
- See Also:
- Wikipedia: Dot Product
-
divide
public Cylindrical3D<?> divide(Parameter<?> that)
Returns the result of this vector divided by the specified divisor. The magnitude of this vector is divided by the input coefficient and the direction is left unchanged.- Parameters:
that
- the divisor.- Returns:
this / that
.
-
cross
public Cylindrical3D cross(Vector that)
Returns the cross product of two 3-dimensional vectors.- Overrides:
cross
in classVector<Parameter<Q extends javax.measure.quantity.Quantity>>
- Parameters:
that
- the vector multiplier.- Returns:
this x that
- Throws:
DimensionException
- if(that.getDimension() != 3)
- See Also:
- Wikipedia: Cross Product
-
toUnitVector
public Cylindrical3D<javax.measure.quantity.Dimensionless> toUnitVector()
Returns this vector converted to a unit vector with a vector magnitude of 1.0.- Specified by:
toUnitVector
in classCoordinate3D<Q extends javax.measure.quantity.Quantity>
- Returns:
- this vector converted to a unit vector
-
copy
public Cylindrical3D<Q> copy()
Returns a copy of this vectorallocated
by the calling thread (possibly on the stack).
-
getUnit
public javax.measure.unit.Unit<Q> getUnit()
Returns the unit in which the radius and height in this vector are stated in.- Specified by:
getUnit
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Returns:
- the unit in which the radius and height in this vector are stated in
-
getAngleUnit
public javax.measure.unit.Unit<javax.measure.quantity.Angle> getAngleUnit()
Returns the unit in which the azimuth angle in this vector is stated in.- Returns:
- the unit in which the azimuth angle in this vector is stated in
-
to
public <R extends javax.measure.quantity.Quantity> Cylindrical3D<R> to(javax.measure.unit.Unit<R> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this vector but with the radius and height stated in the specified unit.- Specified by:
to
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Type Parameters:
R
- the Quantity (physical unit) type of the returned vector.- Parameters:
unit
- the unit of the radius and height of the vector to be returned.- Returns:
- a vector equivalent to this vector but with the radius and height stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException
- if the current model does not allows for conversion to the specified unit.
-
angleTo
public Cylindrical3D<Q> angleTo(javax.measure.unit.Unit<javax.measure.quantity.Angle> unit)
Returns the equivalent to this vector but with the azimuth angle stated in the specified unit.- Parameters:
unit
- the angle unit of the azimuth of the vector to be returned.- Returns:
- a coordinate equivalent to this vector but with the azimuth stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException
- if the current model does not allows for conversion to the specified unit.
-
asType
public <T extends javax.measure.quantity.Quantity> Cylindrical3D<T> asType(java.lang.Class<T> type) throws java.lang.ClassCastException
Casts this Cylindrical3D to a parameterized unit of specified nature or throw aClassCastException
if the dimension of the specified quantity and this parameter's unit dimension do not match.- Specified by:
asType
in classCoordinate3D<Q extends javax.measure.quantity.Quantity>
- Type Parameters:
T
- the Quantity (physical unit) type of the returned vector.- Parameters:
type
- the quantity class identifying the nature of the unit.- Returns:
- this Cylindrical3D parameterized with the specified type.
- Throws:
java.lang.ClassCastException
- if the dimension of this parameter's unit is different from the specified quantity dimension.java.lang.UnsupportedOperationException
- if the specified quantity class does not have a public static field named "UNIT" holding the standard unit for the quantity.
-
toVector3D
public Vector3D<Q> toVector3D()
Returns a Cartesian Vector3D representation of this vector.The polar to Cartesian transformation is defined by:
|x| | radius*cos(azimuth) | |y| = | radius*sin(azimuth) | |z| | height |
- Specified by:
toVector3D
in classAbstractParamVector<Q extends javax.measure.quantity.Quantity,Coordinate3D<Q extends javax.measure.quantity.Quantity>>
- Returns:
- a Cartesian Vector3D representation of this vector
-
equals
public boolean equals(java.lang.Object obj)
Compares this Cylindrical3D against the specified object for strict equality (same values and same units).
-
-