Q
- The Quantity (unit type, such as Length or Volume) of this vector.public final class Polar3D<Q extends Quantity> extends Coordinate3D<Q> implements javolution.xml.XMLSerializable
vector
of Parameter elements
representing a geometrical polar coordinate with elements magnitude, azimuth angle and
elevation angle where elevation is measured positive above the reference plane (similar
to latitude).
Modified by: Joseph A. Huwaldt
Modifier and Type | Field and Description |
---|---|
static int |
AZIMUTH
Constant used to identify the azimuth angle of the vector.
|
static int |
ELEVATION
Constant used to identify the elevation angle of the vector.
|
static int |
MAGNITUDE
Constant used to identify the magnitude of in the vector.
|
Modifier and Type | Method and Description |
---|---|
Polar3D<Q> |
anglesTo(Unit<Angle> unit)
Returns the equivalent to this vector but with the angles stated in the specified
unit.
|
<T extends Quantity> |
asType(java.lang.Class<T> type)
Casts this Polar3D 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. |
Polar3D<Q> |
copy()
Returns a copy of this vector
allocated
by the calling thread (possibly on the stack). |
Polar3D |
cross(Vector that)
Returns the cross product of two 3-dimensional vectors.
|
Polar3D<?> |
divide(Parameter<?> that)
Returns the result of this vector divided by the specified divisor.
|
boolean |
equals(java.lang.Object obj)
Compares this Polar3D against the specified object for strict equality (same values
and same units).
|
Polar3D<Q> |
fromVector3D(Vector3D<Q> vector)
Return the specified
Vector3D object as a Polar3D instance. |
Parameter |
get(int i)
Returns the value of a Parameter from this vector.
|
Unit<Angle> |
getAnglesUnit()
Returns the unit in which the angles in this vector are stated in.
|
Parameter<Angle> |
getAzimuth()
Returns the azimuth angle of this vector as a
Parameter . |
Parameter<Angle> |
getElevation()
Returns the elevation angle of this vector as a
Parameter . |
Parameter<Q> |
getMagnitude()
Returns the magnitude of this vector as a
Parameter . |
double |
getMagnitudeValue()
Returns the magnitude of this vector as a
double , stated in this
vector's unit . |
Unit<Q> |
getUnit()
Returns the unit in which the magnitude in this vector are stated in.
|
int |
hashCode()
Returns the hash code for this parameter.
|
static void |
main(java.lang.String[] args)
Tests the methods in this class.
|
Polar3D<Q> |
minus(Parameter<Q> that)
Subtracts the supplied Parameter from this vector's magnitude and returns the
result.
|
Polar3D<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 the
norm , magnitude, or length value of this vector. |
Polar3D<Q> |
opposite()
Returns the negation of this vector.
|
Polar3D<Q> |
plus(Parameter<Q> that)
Returns the sum of this vector with the parameter specified.
|
Polar3D<Q> |
plus(Vector<Parameter<Q>> that)
Returns the sum of this vector with the one specified.
|
Polar3D<Q> |
times(double k)
Returns the product of this vector with the specified coefficient.
|
Polar3D |
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 Quantity> |
to(Unit<R> unit)
Returns the equivalent to this vector but with the magnitude stated in the
specified unit.
|
Polar3D<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 Quantity> |
valueOf(Coordinate3D<Q> coordinate)
Returns a
Polar3D instance containing the polar coordinate representation
of the specified coordinate . |
static <Q extends Quantity> |
valueOf(Coordinate3D<Q> coord,
Unit<Angle> angleUnit)
Returns a
Polar3D instance containing the polar coordinate representation
of the specified coordinate . |
static <Q extends Quantity> |
valueOf(double magnitude,
double azimuth,
double elevation,
Unit<Q> magUnit,
Unit<Angle> angleUnit)
Returns a
Polar3D instance holding the specified double values
stated in the specified units. |
static <Q extends Quantity> |
valueOf(Parameter<Q> magnitude,
Parameter<Angle> azimuth,
Parameter<Angle> elevation)
Returns a
Polar3D instance holding the specified Parameter
values. |
getDimension, isApproxEqual, isApproxZero
public static final int MAGNITUDE
public static final int AZIMUTH
public static final int ELEVATION
public static <Q extends Quantity> Polar3D<Q> valueOf(double magnitude, double azimuth, double elevation, Unit<Q> magUnit, Unit<Angle> angleUnit)
Polar3D
instance holding the specified double
values
stated in the specified units.Q
- the Quantity (unit type, e.g. Length or Volume) of this vector.magnitude
- the magnitude (length) of the vector stated in the specified unit.azimuth
- the vector azimuth angle stated in the specified angle unit.elevation
- the vector elevation angle value stated in the specified angle
unit.magUnit
- the unit in which the magnitude is stated.angleUnit
- the unit in which the azimuth and elevation angles are stated.public static <Q extends Quantity> Polar3D<Q> valueOf(Parameter<Q> magnitude, Parameter<Angle> azimuth, Parameter<Angle> elevation)
Polar3D
instance holding the specified Parameter
values. All the values are converted to the same units as the x value.Q
- the Quantity (unit type, e.g. Length or Volume) of this vector.magnitude
- the vector magnitude (length) value.azimuth
- the vector azimuth angle value.elevation
- the vector elevation angle value.public static <Q extends Quantity> Polar3D<Q> valueOf(Coordinate3D<Q> coordinate)
Polar3D
instance containing the polar coordinate representation
of the specified coordinate
. The azimuth and elevation
components of the resulting vector have units of radians.
The polar representation of a Cartesian coordinate is given by:
magnitude = |V| azimuth = atan2(Y,X) elevation = 90° - acos(Z/|V|) = latitude
Q
- the Quantity (unit type, e.g. Length or Volume) of this vector.coordinate
- the input coordinate.public static <Q extends Quantity> Polar3D<Q> valueOf(Coordinate3D<Q> coord, Unit<Angle> angleUnit)
Polar3D
instance containing the polar coordinate representation
of the specified coordinate
.
The polar representation of a Cartesian coordinate is given by:
magnitude = |V| azimuth = atan2(Y,X) elevation = atan2(-Z,sqrt(X^2+Y^2))
Q
- the Quantity (unit type, e.g. Length or Volume) of this vector.coord
- the coordinate to convert.angleUnit
- the unit to use for the azimuth and elevation components.public Polar3D<Q> fromVector3D(Vector3D<Q> vector)
Vector3D
object as a Polar3D
instance.fromVector3D
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
vector
- The Vector3D object to be converted to a Polar3D.public Parameter get(int i)
public double getMagnitudeValue()
double
, stated in this
vector's unit
.public Parameter<Q> getMagnitude()
Parameter
.public Parameter<Angle> getAzimuth()
Parameter
.public Parameter<Angle> getElevation()
Parameter
.public Parameter<Q> norm()
norm
in interface VectorSpaceNormed<Vector<Parameter<Q extends Quantity>>,Parameter<Q extends Quantity>>
norm
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
sqrt(this · this)
.public double normValue()
norm
, magnitude, or length value of this vector.normValue
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
this.norm().getValue()
.public Polar3D<Q> plus(Vector<Parameter<Q>> that)
public Polar3D<Q> plus(Parameter<Q> that)
plus
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
that
- the parameter to be added to the magnitude of this vector.this + that
.public Polar3D<Q> minus(Vector<Parameter<Q>> that)
public Polar3D<Q> minus(Parameter<Q> that)
minus
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
that
- the Parameter to be subtracted from the magnitude of this vector.this - that
.public Polar3D times(Parameter k)
public Polar3D<Q> times(double k)
times
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
k
- the coefficient multiplier.this · k
public Parameter times(Vector that)
times
in class Vector<Parameter<Q extends Quantity>>
that
- the vector multiplier.this · that
DimensionException
- if this.dimension() != that.dimension()
public Polar3D<?> divide(Parameter<?> that)
that
- the divisor.this / that
.public Polar3D cross(Vector that)
cross
in class Vector<Parameter<Q extends Quantity>>
that
- the vector multiplier.this x that
DimensionException
- if (that.getDimension() != 3)
public Polar3D<Dimensionless> toUnitVector()
toUnitVector
in class Coordinate3D<Q extends Quantity>
public Polar3D<Q> copy()
allocated
by the calling thread (possibly on the stack).public Unit<Q> getUnit()
getUnit
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
public Unit<Angle> getAnglesUnit()
public <R extends Quantity> Polar3D<R> to(Unit<R> unit) throws ConversionException
to
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
R
- the Quantity (unit type, e.g. Length or Volume) of the returned vector.unit
- the unit of the magnitude of the vector to be returned.ConversionException
- if the current model does not allows for conversion to
the specified unit.public Polar3D<Q> anglesTo(Unit<Angle> unit)
unit
- the angle unit of the angles of the vector to be returned.ConversionException
- if the current model does not allows for conversion to
the specified unit.public <T extends Quantity> Polar3D<T> asType(java.lang.Class<T> type) throws java.lang.ClassCastException
ClassCastException
if the dimension of the specified quantity and this
parameter's unit dimension do not match.asType
in class Coordinate3D<Q extends Quantity>
T
- the Quantity (unit type, e.g. Length or Volume) of the returned vector.type
- the quantity class identifying the nature of the unit.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.public Vector3D<Q> toVector3D()
The polar to Cartesian transformation is defined by:
|x| | cos(elevation)*cos(azimuth) | |y| = magnitude*| cos(elevation)*sin(azimuth) | |z| | -sin(elevation) |
toVector3D
in class AbstractParamVector<Q extends Quantity,Coordinate3D<Q extends Quantity>>
public boolean equals(java.lang.Object obj)
public int hashCode()
public static void main(java.lang.String[] args)
args
- Command line arguments (ignored)