Class Cylindrical3D<Q extends javax.measure.quantity.Quantity>

  • 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 element vector 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int AZIMUTH
      Constant used to identify the azimuth angle of the vector.
      static int HEIGHT
      Constant used to identify the height or altitude of the vector.
      static int RADIUS
      Constant used to identify the radius of in the vector.
    • 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 a Cylindrical3D instance holding the specified double 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 a Cylindrical3D instance holding the specified Parameter 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 a Cylindrical3D instance containing the cylindrical coordinate representation of the specified coordinate. 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 a Cylindrical3D instance containing the cylindrical coordinate representation of the specified coordinate.
        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<QfromVector3D​(Vector3D<Q> vector)
        Return the specified Vector3D object as a Cylindrical3D instance.
        Specified by:
        fromVector3D in class AbstractParamVector<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.
        Specified by:
        get in class Vector<Parameter<Q extends javax.measure.quantity.Quantity>>
        Parameters:
        i - the dimension index (0=radius, 1=azimuth, 2=height/altitude).
        Returns:
        the value of the parameter at i.
        Throws:
        java.lang.IndexOutOfBoundsException - (i < 0) || (i > dimension()-1)
      • getRadiusValue

        public double getRadiusValue()
        Returns the radius element of this vector as a double, stated in this vector's unit.
        Returns:
        the radius element of this vector in this vector's units.
      • getRadius

        public Parameter<QgetRadius()
        Returns the radius element of this vector as a Parameter.
        Returns:
        the radius element of this vector.
      • getAzimuth

        public Parameter<javax.measure.quantity.Angle> getAzimuth()
        Returns the azimuth angle of this vector as a Parameter.
        Returns:
        the azimuth angle of this vector.
      • getHeight

        public Parameter<QgetHeight()
        Returns the height or altitude element of this vector as a Parameter.
        Returns:
        the height element of this vector.
      • normValue

        public double normValue()
        Returns the norm, magnitude, or length value of this vector.
        Specified by:
        normValue in class AbstractParamVector<Q extends javax.measure.quantity.Quantity,​Coordinate3D<Q extends javax.measure.quantity.Quantity>>
        Returns:
        this.norm().getValue().
      • plus

        public Cylindrical3D<Qplus​(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 interface GroupAdditive<Q extends javax.measure.quantity.Quantity>
        Specified by:
        plus in class Vector<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<Qplus​(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 class AbstractParamVector<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<Qminus​(Vector<Parameter<Q>> that)
        Returns the difference between this vector and the one specified.
        Overrides:
        minus in class Vector<Parameter<Q extends javax.measure.quantity.Quantity>>
        Parameters:
        that - the vector to be subtracted.
        Returns:
        this - that.
      • minus

        public Cylindrical3D<Qminus​(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 class AbstractParamVector<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 interface VectorSpace<Vector<Parameter<Q extends javax.measure.quantity.Quantity>>,​Parameter<Q extends javax.measure.quantity.Quantity>>
        Specified by:
        times in class Vector<Parameter<Q extends javax.measure.quantity.Quantity>>
        Parameters:
        k - the coefficient multiplier.
        Returns:
        this · k
      • times

        public Cylindrical3D<Qtimes​(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 class AbstractParamVector<Q extends javax.measure.quantity.Quantity,​Coordinate3D<Q extends javax.measure.quantity.Quantity>>
        Parameters:
        k - the coefficient multiplier.
        Returns:
        this · k
      • 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.
      • 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 class Coordinate3D<Q extends javax.measure.quantity.Quantity>
        Returns:
        this vector converted to a unit vector
      • copy

        public Cylindrical3D<Qcopy()
        Returns a copy of this vector allocated by the calling thread (possibly on the stack).
        Specified by:
        copy in interface javolution.lang.ValueType
        Specified by:
        copy in class Vector<Parameter<Q extends javax.measure.quantity.Quantity>>
        Returns:
        an identical and independent copy of this vector.
      • getUnit

        public javax.measure.unit.Unit<QgetUnit()
        Returns the unit in which the radius and height in this vector are stated in.
        Specified by:
        getUnit in class AbstractParamVector<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 class AbstractParamVector<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<QangleTo​(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 a ClassCastException if the dimension of the specified quantity and this parameter's unit dimension do not match.
        Specified by:
        asType in class Coordinate3D<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<QtoVector3D()
        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 class AbstractParamVector<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).
        Overrides:
        equals in class Vector<Parameter<Q extends javax.measure.quantity.Quantity>>
        Parameters:
        obj - the object to compare with.
        Returns:
        true if this vector is identical to that vector; false otherwise.