Interface Transformation


public interface Transformation
Performs spacial transformations on position and direction Vector3ds, for general use in block transformations.
  • Method Details

    • builder

      static Transformation.Builder builder()
      Gets a Transformation.Builder for creating transformations.
      Returns:
      A builder
    • transformPosition

      Vector3d transformPosition(Vector3d original)
      Transforms a Vector3d that represents a position based on the transformation this object represents.
      Parameters:
      original - The position vector to transform
      Returns:
      The transformed position vector
    • transformDirection

      Vector3d transformDirection(Vector3d originalDirection)
      Transforms a Vector3d that represents a direction based on the transformation this object represents.

      Specifically, this transformation will not apply any translational transformations.

      Parameters:
      originalDirection - The direction vector to transform
      Returns:
      The transformed direction vector
    • positionTransformationMatrix

      Matrix4d positionTransformationMatrix()
      Gets the matrix used to perform this transformation on position vectors.
      Returns:
      The Matrix4d
    • directionTransformationMatrix

      Matrix4d directionTransformationMatrix()
      Gets the matrix used to perform this transformation on direction vectors.
      Returns:
      The Matrix4d
    • origin

      Vector3d origin()
      Gets the origin of the position transformation matrix.
      Returns:
      The origin of the position transformations
    • rotation

      Rotation rotation()
      Gets the Rotation around the y-axis
      Returns:
      The Rotation
    • mirror

      boolean mirror(Axis axis)
      Returns whether this transformation results in mirroring in the direction of the provided axis.

      This represents any mirroring that would need to occur after any rotation has occurred. If you require knowing what the mirror state would be pre-rotation, use initialMirror(Axis) instead.

      Parameters:
      axis - The Axis
      Returns:
      true if so
    • initialMirror

      boolean initialMirror(Axis axis)
      Returns the direction of mirroring in this transformation, if mirroring was performed before rotation, at the point before the mirroring occurs. The axis is in the direction of the mirroring.

      Unlike mirror(Axis), which provides a view to the direction(s) of mirroring after all transformations have taken place, this method returns the direction of mirroring before any rotation has taken place, such that if the rotation() was set to Rotations.NONE, this would be the direction of mirroring.

      Parameters:
      axis - The Axis
      Returns:
      true if so
    • inverse

      Transformation inverse()
      Gets the Transformation that reverses this transformation.
      Returns:
      The inverse transformation
    • performsRounding

      boolean performsRounding()
      If this is true, then this transformation will attempt to round the result to reduce the effects of machine precision, which may be particularly useful for those who expect integer values.

      The rounding should be on the order of 15 decimal places, though other implementations may choose more sophisticated rounding.

      Returns:
      Whether the result will have minor rounding applied.
    • toBuilder

      Creates a Transformation.Builder that represents this transformation.
      Returns:
      The builder.
    • then

      Transformation then(Transformation transformation)
      Returns are new Transformation which represents the combination of this transformation, followed by the supplied transformation.

      You must not assume that the second transformation origin is relative to the first. Each transformation is assumed to operate in untransformed and each is assumed to operate around the origin specified in that transformation. For example, if the first transformation operates around (1, 1, 1), and the second operates around (2, 2, 2), this will still be the case, the second won't operate around (3, 3, 3). As a result, origin() will return Vector3d.ZERO unless the two origins are equal to each other.

      The resultant transformation will set performsRounding() to the value of this transformation.

      Parameters:
      transformation - The transformation to perform after this one
      Returns:
      A new, combined, transformation