Class MatrixVectorOperation

java.lang.Object
org.sgrewritten.stargate.api.vectorlogic.MatrixVectorOperation
All Implemented Interfaces:
VectorOperation

public class MatrixVectorOperation extends Object implements VectorOperation
A vector operation helps with various operations done on vectors

Vector operations keeps vectors immutable.

  • Constructor Summary

    Constructors
    Constructor
    Description
    MatrixVectorOperation(org.bukkit.block.BlockFace signFace)
    Instantiates a vector operation to rotate vectors in the direction of a sign face
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.block.BlockFace
    Gets the block face of a sign given upon instantiation
    org.bukkit.Axis
    Gets the normal axis orthogonal to the iris plane
    org.bukkit.util.Vector
    performToAbstractSpaceOperation(@NotNull org.bukkit.util.Vector vector)
    Performs this vector operation on the given vector
    org.bukkit.util.BlockVector
    performToRealSpaceOperation(@NotNull org.bukkit.util.BlockVector vector)
    Performs the reverse of this vector operation on the given vector
    org.bukkit.util.Vector
    performToRealSpaceOperation(@NotNull org.bukkit.util.Vector vector)
    Performs the reverse of this vector operation on the given vector
    void
    setFlipZAxis(boolean flipZAxis)
    Sets whether to flip the Z- axis

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MatrixVectorOperation

      public MatrixVectorOperation(org.bukkit.block.BlockFace signFace) throws InvalidStructureException
      Instantiates a vector operation to rotate vectors in the direction of a sign face

      Gate structures have their relative location represented by a vector where x = outwards, y = down and z = right. The vector operation rotates the given vectors so that "outwards" is going the same direction as the given sign face.

      Parameters:
      signFace -

      The sign face of a gate's sign

      Throws:
      InvalidStructureException -

      If given a sign face which is not one of EAST, SOUTH, WEST or NORTH

  • Method Details

    • getFacing

      public org.bukkit.block.BlockFace getFacing()
      Description copied from interface: VectorOperation
      Gets the block face of a sign given upon instantiation
      Specified by:
      getFacing in interface VectorOperation
      Returns:

      The block face of a sign given upon instantiation

    • getIrisNormal

      public org.bukkit.Axis getIrisNormal()
      Description copied from interface: VectorOperation
      Gets the normal axis orthogonal to the iris plane

      Said another way, get the axis going directly towards or away from a stargate's entrance.

      Specified by:
      getIrisNormal in interface VectorOperation
      Returns:

      The normal axis orthogonal to the iris plane

    • setFlipZAxis

      public void setFlipZAxis(boolean flipZAxis)
      Description copied from interface: VectorOperation
      Sets whether to flip the Z- axis
      Specified by:
      setFlipZAxis in interface VectorOperation
      Parameters:
      flipZAxis -

      Whether to flip the z-axis

    • performToAbstractSpaceOperation

      public org.bukkit.util.Vector performToAbstractSpaceOperation(@NotNull @NotNull org.bukkit.util.Vector vector)
      Description copied from interface: VectorOperation
      Performs this vector operation on the given vector

      Inverse operation of doInverse; A vector operation that rotates around the origin, and flips the z-axis. Does not permute input vector

      Specified by:
      performToAbstractSpaceOperation in interface VectorOperation
      Parameters:
      vector -

      The vector to perform the operation on

      Returns:
      vector

      A new vector with the operation applied

    • performToRealSpaceOperation

      public org.bukkit.util.Vector performToRealSpaceOperation(@NotNull @NotNull org.bukkit.util.Vector vector)
      Description copied from interface: VectorOperation
      Performs the reverse of this vector operation on the given vector

      Inverse operation of doOperation; A vector operation that rotates around the origin and flips the z-axis. Does not permute input vector

      Specified by:
      performToRealSpaceOperation in interface VectorOperation
      Parameters:
      vector -

      The vector to perform the inverse operation on

      Returns:
      vector

      A new vector with the inverse operation applied

    • performToRealSpaceOperation

      public org.bukkit.util.BlockVector performToRealSpaceOperation(@NotNull @NotNull org.bukkit.util.BlockVector vector)
      Description copied from interface: VectorOperation
      Performs the reverse of this vector operation on the given vector

      Inverse operation of doOperation; A vector operation that rotates around the origin and flips the z-axis. Does not permute input vector

      Specified by:
      performToRealSpaceOperation in interface VectorOperation
      Parameters:
      vector -

      The vector to perform the inverse operation on

      Returns:
      vector

      A new vector with the inverse operation applied