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 class
Vector3D.VectorType
This determines how arguments are used inVector3D(VectorType, double, double, double)
.
-
Field Summary
Fields Modifier and Type Field Description private double
azimuthalAngle
The azimuthal angle phiprivate double
azimuthalAngleCos
Cosine of azimuthal angle (angle from X axis)private double
azimuthalAngleSin
Sine of azimuthal angle (angle from X axis)static Vector3D
DEFAULT_VECTOR_3D
A non-null default vectorprivate double
polarAngle
The polar angle theta (inclination)private double
polarAngleCos
Cosine of polar angle (angle from Z axis, AKA straight up)private double
polarAngleSin
Sine of polar angle (angle from Z axis, AKA straight up)private double
radialDistance
The radius rprivate double
x
private double
y
private double
z
-
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 boolean
equals(java.lang.Object o)
double
getAzimuthalAngle()
Get the azimuthal angledouble
getAzimuthalAngleCos()
Get the azimuthal angle cosinedouble
getAzimuthalAngleSin()
Get the azimuthal angle sinedouble
getPolarAngle()
Get the polar angle (inclination)double
getPolarAngleCos()
Get the polar angle cosine (inclination)double
getPolarAngleSin()
Get the polar angle sine (inclination)double
getRadialDistance()
Get the radiusdouble
getX()
Get the x coordinatedouble
getY()
Get the y coordinatedouble
getZ()
Get the z coordinateint
hashCode()
Vector3D
normalize()
Normalize the vectorjava.lang.String
toString()
-
-
-
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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-