Enum Class AxisOrder

java.lang.Object
java.lang.Enum<AxisOrder>
net.apartium.cocoabeans.space.axis.AxisOrder
All Implemented Interfaces:
Serializable, Comparable<AxisOrder>, Constable, Comparator<Position>

@AvailableSince("0.0.46") public enum AxisOrder extends Enum<AxisOrder> implements Comparator<Position>
Represents the order of axes in 3D space and provides utilities for working with positions and dimensions according to the specified axis order. Implements Comparator for comparing Position objects based on the axis order.

Each enum constant defines a unique permutation of the axes (X, Y, Z).

  • XYZ: X, then Y, then Z
  • XZY: X, then Z, then Y
  • YXZ: Y, then X, then Z
  • YZX: Y, then Z, then X
  • ZXY: Z, then X, then Y
  • ZYX: Z, then Y, then X

Provides methods for retrieving axes, creating positions and dimensions, iterating over positions, and comparing positions according to the axis order.

Since:
0.0.46
  • Enum Constant Details

    • XYZ

      public static final AxisOrder XYZ
      X, then Y, then Z
    • XZY

      public static final AxisOrder XZY
      X, then Z, then Y
    • YXZ

      public static final AxisOrder YXZ
      Y, then X, then Z
    • YZX

      public static final AxisOrder YZX
      Y, then Z, then X
    • ZXY

      public static final AxisOrder ZXY
      Z, then X, then Y
    • ZYX

      public static final AxisOrder ZYX
      Z, then Y, then X
  • Method Details

    • values

      public static AxisOrder[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AxisOrder valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • byId

      public static AxisOrder byId(byte id)
      Returns the AxisOrder constant by its id.
      Parameters:
      id - the id of the AxisOrder
      Returns:
      the AxisOrder for the given id
      Throws:
      IndexOutOfBoundsException - if the id is out of bounds
    • getId

      public byte getId()
      Returns the id of this AxisOrder.
      Returns:
      the id
    • getAxes

      public List<Axis> getAxes()
      Returns the list of axes in this order.
      Returns:
      the axes
    • iterator

      public Iterator<Position> iterator(Position pos0, Position pos1, double step)
      Returns an iterator over positions between pos0 and pos1 with the given step, following this axis order.
      Parameters:
      pos0 - the starting position
      pos1 - the ending position
      step - the step size
      Returns:
      an iterator over positions
    • getFirst

      public Axis getFirst()
      Returns the first axis in this order.
      Returns:
      the first axis
    • getSecond

      public Axis getSecond()
      Returns the second axis in this order.
      Returns:
      the second axis
    • getThird

      public Axis getThird()
      Returns the third axis in this order.
      Returns:
      the third axis
    • position

      public Position position(int i0, int i1, int i2)
      Creates a Position object using the specified values for each axis according to this order.
      Parameters:
      i0 - value for the first axis
      i1 - value for the second axis
      i2 - value for the third axis
      Returns:
      a Position object
    • areaSize

      public AreaSize areaSize(int i0, int i1, int i2)
      Creates an AreaSize object using the specified values for each axis according to this order.
      Parameters:
      i0 - value for the first axis
      i1 - value for the second axis
      i2 - value for the third axis
      Returns:
      an AreaSize object
    • compare

      public int compare(Position position, Position other)
      Compares two positions according to this axis order.
      Specified by:
      compare in interface Comparator<Position>
      Parameters:
      position - the first position
      other - the second position
      Returns:
      a negative integer, zero, or a positive integer as the first position is less than, equal to, or greater than the second