Class Vector3D

java.lang.Object
org.openstreetmap.josm.gui.util.imagery.Vector3D

public final class Vector3D extends Object
A basic 3D vector class (immutable)
Since:
18246
  • Field Details

    • 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 Details

    • Vector3D

      public Vector3D(double x, double y, double z)
      Create a new Vector3D object using the XYZ coordinate system
      Parameters:
      x - The x coordinate
      y - The y coordinate
      z - The z coordinate
    • Vector3D

      public Vector3D(Vector3D.VectorType vectorType, double first, double second, double third)
      Create a new Vector3D object. See ordering in Vector3D.VectorType.
      Parameters:
      first - The first coordinate
      second - The second coordinate
      third - The third coordinate
      vectorType - The coordinate type (determines how the other variables are treated)
  • Method Details

    • 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
    • normalize

      public Vector3D normalize()
      Normalize the vector
      Returns:
      A normalized vector
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object