Interface Transform

Nested Class Summary

Method Summary
Modifier and TypeMethodDescription"Adds" another transform to this one.static Transform
static Transform
static Transform
double
pitch()
Gets the pitch component of this transform rotation.position()
Gets the coordinates of this transform.double
roll()
Gets the roll component of this transform rotation.rotate
(Quaterniond rotation) Adds a rotation to this transform.Adds a rotation to this transform.rotation()
Gets the rotation of this transform, as aVector3d
.Returns the rotation as a quaternion.scale()
Gets the scale of the transform for each axis."Adds" a scale to this transform.toMatrix()
Returns a matrix representation of this transform.Adds a translation to this transform.withPosition
(Vector3d position) Creates a copy of this transform while setting the position of the new one.withRotation
(Quaterniond rotation) Creates a copy of this transform and sets the rotation.withRotation
(Vector3d rotation) Creates a copy of this transform and sets the rotation as a quaternion.Creates a copy of this transform and sets the scale for each axis.double
yaw()
Gets the yaw component of this transform rotation.

Method Details

of

of

of

position
Vector3d position()Gets the coordinates of this transform. Returns:
 The coordinates

withPosition
Creates a copy of this transform while setting the position of the new one. Parameters:
position
 The position Returns:
 A new transform

rotation
Vector3d rotation()Gets the rotation of this transform, as aVector3d
.The format of the rotation is represented by:
x > pitch
y > yaw
z > roll
 Returns:
 The rotation vector

withRotation
Creates a copy of this transform and sets the rotation as a quaternion.Quaternions are objectively better than the Euler angles preferred by Minecraft. This is for compatibility with the flowmath library.
 Parameters:
rotation
 The new rotation Returns:
 A new transform

withRotation
Creates a copy of this transform and sets the rotation.The format of the rotation is represented by:
x > pitch
y > yaw
z > roll
 Parameters:
rotation
 The new rotation Returns:
 A new transform

rotationAsQuaternion
Quaterniond rotationAsQuaternion()Returns the rotation as a quaternion.Quaternions are objectively better than the Euler angles preferred by Minecraft. This is for compatibility with the flowmath library.
 Returns:
 The rotation

pitch
double pitch()Gets the pitch component of this transform rotation. Returns:
 The pitch

yaw
double yaw()Gets the yaw component of this transform rotation. Returns:
 The yaw

roll
double roll()Gets the roll component of this transform rotation. Returns:
 The roll

scale
Vector3d scale()Gets the scale of the transform for each axis. Returns:
 The scale

withScale
Creates a copy of this transform and sets the scale for each axis. Parameters:
scale
 The scale Returns:
 A new transform

add
"Adds" another transform to this one. This is equivalent to adding the translation, rotation and scale individually.Returns the results as a new copy.
 Parameters:
other
 The transform to add Returns:
 A new transform

translate
Adds a translation to this transform.Returns the results as a new copy.
 Parameters:
translation
 The translation to add Returns:
 A new transform

rotate
Adds a rotation to this transform. Returns the results as a new copy. Parameters:
rotation
 The rotation to add Returns:
 A new transform

rotate
Adds a rotation to this transform.Quaternions are objectively better than the Euler angles preferred by Minecraft. This is the preferred method when dealing with rotation additions. This is for compatibility with the flowmath library.
Returns the results as a new copy.
 Parameters:
rotation
 The rotation to add Returns:
 A new transform

scale
"Adds" a scale to this transform. Scales are multiplicative, so this actually multiplies the current scale.Returns the results as a new copy.
 Parameters:
scale
 The scale to add Returns:
 A new transform

toMatrix
Matrix4d toMatrix()Returns a matrix representation of this transform.This includes the position, rotation and scale. To apply the transform to a vector, use the following:
Vector3d original = ...;<br /> Transform transform = ...;<br /><br /> Vector3d transformed = transform.toMatrix().transform(original.toVector4(1)).toVector3();<br />
}This converts the original 3D vector to 4D by appending 1 as the w coordinate, applies the transformation, then converts it back to 3D by dropping the w coordinate.
Using a 4D matrix and a w coordinate with value 1 is what allows for the position to be included in the transformation applied by the matrix.
 Returns:
 The transform as a matrix
