Class Vector3D
- java.lang.Object
-
- org.openstreetmap.josm.gui.util.imagery.Vector3D
-
public final class Vector3D extends java.lang.Object
A basic 3D vector class (immutable)- Since:
- 18246
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVector3D.VectorTypeThis determines how arguments are used inVector3D(VectorType, double, double, double).
-
Field Summary
Fields Modifier and Type Field Description private doubleazimuthalAngleThe azimuthal angle phiprivate doubleazimuthalAngleCosCosine of azimuthal angle (angle from X axis)private doubleazimuthalAngleSinSine of azimuthal angle (angle from X axis)static Vector3DDEFAULT_VECTOR_3DA non-null default vectorprivate doublepolarAngleThe polar angle theta (inclination)private doublepolarAngleCosCosine of polar angle (angle from Z axis, AKA straight up)private doublepolarAngleSinSine of polar angle (angle from Z axis, AKA straight up)private doubleradialDistanceThe radius rprivate doublexprivate doubleyprivate doublez
-
Constructor Summary
Constructors Constructor Description Vector3D(double x, double y, double z)Create a new Vector3D object using the XYZ coordinate systemVector3D(Vector3D.VectorType vectorType, double first, double second, double third)Create a new Vector3D object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)doublegetAzimuthalAngle()Get the azimuthal angledoublegetAzimuthalAngleCos()Get the azimuthal angle cosinedoublegetAzimuthalAngleSin()Get the azimuthal angle sinedoublegetPolarAngle()Get the polar angle (inclination)doublegetPolarAngleCos()Get the polar angle cosine (inclination)doublegetPolarAngleSin()Get the polar angle sine (inclination)doublegetRadialDistance()Get the radiusdoublegetX()Get the x coordinatedoublegetY()Get the y coordinatedoublegetZ()Get the z coordinateinthashCode()Vector3Dnormalize()Normalize the vectorjava.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_VECTOR_3D
public static final Vector3D DEFAULT_VECTOR_3D
A non-null default vector
-
x
private final double x
-
y
private final double y
-
z
private final double z
-
radialDistance
private volatile double radialDistance
The radius r
-
polarAngle
private volatile double polarAngle
The polar angle theta (inclination)
-
polarAngleCos
private volatile double polarAngleCos
Cosine of polar angle (angle from Z axis, AKA straight up)
-
polarAngleSin
private volatile double polarAngleSin
Sine of polar angle (angle from Z axis, AKA straight up)
-
azimuthalAngle
private volatile double azimuthalAngle
The azimuthal angle phi
-
azimuthalAngleCos
private volatile double azimuthalAngleCos
Cosine of azimuthal angle (angle from X axis)
-
azimuthalAngleSin
private volatile double azimuthalAngleSin
Sine of azimuthal angle (angle from X axis)
-
-
Constructor Detail
-
Vector3D
public Vector3D(double x, double y, double z)
Create a new Vector3D object using the XYZ coordinate system- Parameters:
x- The x coordinatey- The y coordinatez- The z coordinate
-
Vector3D
public Vector3D(Vector3D.VectorType vectorType, double first, double second, double third)
Create a new Vector3D object. See ordering inVector3D.VectorType.- Parameters:
first- The first coordinatesecond- The second coordinatethird- The third coordinatevectorType- The coordinate type (determines how the other variables are treated)
-
-
Method Detail
-
getX
public double getX()
Get the x coordinate- Returns:
- The x coordinate
-
getY
public double getY()
Get the y coordinate- Returns:
- The y coordinate
-
getZ
public double getZ()
Get the z coordinate- Returns:
- The z coordinate
-
getRadialDistance
public double getRadialDistance()
Get the radius- Returns:
- The radius
-
getPolarAngle
public double getPolarAngle()
Get the polar angle (inclination)- Returns:
- The polar angle
-
getPolarAngleCos
public double getPolarAngleCos()
Get the polar angle cosine (inclination)- Returns:
- The polar angle cosine
-
getPolarAngleSin
public double getPolarAngleSin()
Get the polar angle sine (inclination)- Returns:
- The polar angle sine
-
getAzimuthalAngle
public double getAzimuthalAngle()
Get the azimuthal angle- Returns:
- The azimuthal angle
-
getAzimuthalAngleCos
public double getAzimuthalAngleCos()
Get the azimuthal angle cosine- Returns:
- The azimuthal angle cosine
-
getAzimuthalAngleSin
public double getAzimuthalAngleSin()
Get the azimuthal angle sine- Returns:
- The azimuthal angle sine
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-