Enum Axis

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Axis>, Cycleable<Axis>

    public enum Axis
    extends java.lang.Enum<Axis>
    implements Cycleable<Axis>
    Represents a three dimensional cartesian axis.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      X  
      Y  
      Z  
    • Enum Constant Detail

      • X

        public static final Axis X
      • Y

        public static final Axis Y
      • Z

        public static final Axis Z
    • Method Detail

      • values

        public static Axis[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Axis c : Axis.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Axis valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • closest

        public static Axis closest​(Vector3d vector)
        Gets the closest horizontal direction from the given vector. If the vector is the 0-Vector, this method returns X. If the vector has the same length in a horizontal and vertical direction, a horizontal axis will be returned. If the vector has the same length in x and in z direction X will be returned.
        Parameters:
        vector - The vector to convert to a axis
        Returns:
        The closest axis.
      • isVectorAlongAxis

        public boolean isVectorAlongAxis​(Vector3d vector)
        Returns whether the given vector is along this axis.
        Parameters:
        vector - The vector to test
        Returns:
        True if it is along this axis
      • component

        public double component​(Vector3d vector3d)
        Gets the component of the vector denoted by this axis.
        Parameters:
        vector3d - The vector
        Returns:
        The value of the component
      • direction

        public AxisDirection direction​(Vector3d vector3d)
        Gets the direction of the vector's component denoted by this axis.
        Parameters:
        vector3d - The vector
        Returns:
        The direction of the component
      • toVector3d

        public Vector3d toVector3d()
        Gets the Vector3d backing this axis.
        Returns:
        the Vector3d
      • toVector3dWithDirection

        public Vector3d toVector3dWithDirection​(AxisDirection axisDirection)
        Gets the Vector3d with the given AxisDirection.
        Parameters:
        axisDirection - The direction along the axis.
        Returns:
        the Vector3d
      • cycleNext

        public Axis cycleNext()
        Description copied from interface: Cycleable
        Gets the "next" Cycleable instance to be considered for cycling.
        Specified by:
        cycleNext in interface Cycleable<Axis>
        Returns:
        The next value