Interface Transformation


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

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