Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- x()
- pitch()
- setX(float)
- setPitch(float)
- y()
- yaw()
- setY(float)
- setYaw(float)
- z()
- roll()
- setZ(float)
- setRoll(float)
- set(Rotation3fc)
- set(float[])
- set(float, float, float)
- add(Rotation3f)
- add(float, float, float)
- addPitch(float)
- addYaw(float)
- addRoll(float)
- sub(Rotation3f)
- sub(Vector3i)
- sub(float, float, float)
- addRotationOnAxis(Axis, int)
- flipRotationOnAxis(Axis)
- negate()
- mul(float)
- mul(Rotation3f)
- distanceSquaredTo(float, float, float)
- isFinite()
- sanitizeNonFinite()
- getQuaternion(Quaterniond)
- premul(Quaterniondc, Rotation3f)
- mul(Quaterniondc, Rotation3f)
- premul(Quaterniondc)
- mul(Quaterniondc)
- transform(Vector3dc, Vector3d)
- transform(Vector3d)
- clone()
- equals(Object)
- hashCode()
- toString()
- lerp(Rotation3f, Rotation3f, float)
- lerpUnclamped(Rotation3f, Rotation3f, float)
- lerpAngle(Rotation3fc, Rotation3fc, float)
- lerpAngle(Rotation3fc, Rotation3fc, float, Rotation3f)
- lookAt(Vector3dc, Vector3dc)
- lookAt(Vector3dc, Vector3dc, Rotation3f)
- lookAt(Vector3dc)
- lookAt(Vector3dc, Rotation3f)
- lookAt(double, double, double)
- lookAt(double, double, double, Rotation3f)
Class Rotation3f
java.lang.Object
com.hypixel.hytale.math.vector.Rotation3f
- All Implemented Interfaces:
Rotation3fc
A 3-dimensional Euler rotation with single-precision floating point components.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<Rotation3f> The codec used to parse aRotation3finstance as rotation.static final Rotation3fcstatic final Rotation3fcstatic final BuilderCodec<Rotation3f> The codec used to parse aRotation3finstance as rotation with default values ofFloat.NaN.floatThe X component of the rotation.floatThe Y component of the rotation.floatThe Z component of the rotation.static final Rotation3fc -
Constructor Summary
ConstructorsConstructorDescriptionEmpty Constructor for aRotation3finstance.Rotation3f(float pitch, float yaw, float roll) Constructor for aRotation3finstance.Default Copy Constructor for aRotation3finstance. -
Method Summary
Modifier and TypeMethodDescriptionadd(float x, float y, float z) Called to add values to this rotation.add(Rotation3f v) Called to add another rotation to this one.voidaddPitch(float pitch) Called to add pitch value to this rotation.voidaddRoll(float roll) Called to add roll value to this rotation.voidaddRotationOnAxis(Axis axis, int degrees) Called to add rotation to this rotation based on the axis.voidaddYaw(float yaw) Called to add yaw value to this rotation.clone()floatdistanceSquaredTo(float x, float y, float z) Called to compute the squared distance from this rotation to the given components.booleanvoidflipRotationOnAxis(Axis axis) Called to flip the rotation on the given axis.org.joml.QuaterniondgetQuaternion(org.joml.Quaterniond dest) Get the rotation represented bythisrotation and stores it into the givenQuaterniond.inthashCode()booleanisFinite()static Rotation3flerp(Rotation3f a, Rotation3f b, float t) Called to linearly interpolate between two rotations.static Rotation3flerpAngle(Rotation3fc a, Rotation3fc b, float t) Called to linearly interpolate between two angles.static Rotation3flerpAngle(Rotation3fc a, Rotation3fc b, float t, Rotation3f target) Called to linearly interpolate between two angles and store it in a target rotation.static Rotation3flerpUnclamped(Rotation3f a, Rotation3f b, float t) Called to linearly interpolate between two rotations without clamping.static Rotation3flookAt(double dx, double dy, double dz) Called to compute the look at rotation for a relative direction.static Rotation3flookAt(double dx, double dy, double dz, Rotation3f result) Called to compute the look at rotation for a relative direction and store it in a result rotation.static Rotation3flookAt(org.joml.Vector3dc relative) Called to compute the look at rotation for a relative rotation.static Rotation3flookAt(org.joml.Vector3dc relative, Rotation3f result) Called to compute the look at rotation for a relative rotation and store it in a result rotation.static Rotation3flookAt(org.joml.Vector3dc eye, org.joml.Vector3dc target) Called to compute the look at rotation from an eye position to a target position.static Rotation3flookAt(org.joml.Vector3dc eye, org.joml.Vector3dc target, Rotation3f result) Called to compute the look at rotation from an eye position to a target position and store it in a result rotation.mul(float s) Called to scale this rotation.mul(Rotation3f p) Called to scale this rotation by another rotation.mul(org.joml.Quaterniondc q) mul(org.joml.Quaterniondc q, Rotation3f dest) Rotate these Euler angles byqand store the result indest.negate()Called to negate this rotation.floatpitch()premul(org.joml.Quaterniondc q) premul(org.joml.Quaterniondc q, Rotation3f dest) Pre-rotate these Euler angles byqand store the result indest.floatroll()voidReplaces any non-finite component (NaN or infinity) with0, in place.set(float[] v) Called to assign the values from an array to this rotation.set(float x, float y, float z) Called to assign the values to this rotation.set(Rotation3fc v) Called to assign the values of another rotation to this one.voidsetPitch(float pitch) Called to set the pitch component of the rotation.voidsetRoll(float roll) Called to set the roll component of the rotation.voidsetX(float x) Called to set the X component of the rotation.voidsetY(float y) Called to set the Y component of the rotation.voidsetYaw(float yaw) Called to set the yaw component of the rotation.voidsetZ(float z) Called to set the Z component of the rotation.sub(float x, float y, float z) Called to subtract values from this rotation.sub(Rotation3f v) Called to subtract another rotation from this one.sub(org.joml.Vector3i v) Called to subtract an integer rotation from this one.toString()org.joml.Vector3dtransform(org.joml.Vector3d vec) Transform the given vector by this rotation.org.joml.Vector3dtransform(org.joml.Vector3dc vec, org.joml.Vector3d dest) Transform the given vector by this rotation and store the result indest.floatx()floaty()floatyaw()floatz()
-
Field Details
-
CODEC
The codec used to parse aRotation3finstance as rotation. -
PARTIAL_TELEPORT_CODEC
The codec used to parse aRotation3finstance as rotation with default values ofFloat.NaN. This allows player teleports to have axis values ofFloat.NaNand be ignored by the client - enabling relative teleports.CODECshould always be used when default values of zero are supported. -
ZERO
-
IDENTITY
-
NaN
-
x
public float xThe X component of the rotation. -
y
public float yThe Y component of the rotation. -
z
public float zThe Z component of the rotation.
-
-
Constructor Details
-
Rotation3f
public Rotation3f()Empty Constructor for aRotation3finstance. -
Rotation3f
Default Copy Constructor for aRotation3finstance.- Parameters:
v- The rotation to copy.
-
Rotation3f
public Rotation3f(float pitch, float yaw, float roll) Constructor for aRotation3finstance.- Parameters:
pitch- The X component of the rotation.yaw- The Y component of the rotation.roll- The Z component of the rotation.
-
-
Method Details
-
x
public float x()- Specified by:
xin interfaceRotation3fc- Returns:
- the X, or pitch component of the rotation.
-
pitch
public float pitch()- Specified by:
pitchin interfaceRotation3fc- Returns:
- the pitch component of the rotation.
-
setX
public void setX(float x) Called to set the X component of the rotation.- Parameters:
x- The new X component.
-
setPitch
public void setPitch(float pitch) Called to set the pitch component of the rotation.- Parameters:
pitch- The new pitch component.
-
y
public float y()- Specified by:
yin interfaceRotation3fc- Returns:
- the Y, or yaw component of the rotation.
-
yaw
public float yaw()- Specified by:
yawin interfaceRotation3fc- Returns:
- the yaw component of the rotation.
-
setY
public void setY(float y) Called to set the Y component of the rotation.- Parameters:
y- The new Y component.
-
setYaw
public void setYaw(float yaw) Called to set the yaw component of the rotation.- Parameters:
yaw- The new yaw component.
-
z
public float z()- Specified by:
zin interfaceRotation3fc- Returns:
- the Z, or roll component of the rotation.
-
roll
public float roll()- Specified by:
rollin interfaceRotation3fc- Returns:
- the roll component of the rotation.
-
setZ
public void setZ(float z) Called to set the Z component of the rotation.- Parameters:
z- The new Z component.
-
setRoll
public void setRoll(float roll) Called to set the roll component of the rotation.- Parameters:
roll- The new roll component.
-
set
Called to assign the values of another rotation to this one.- Parameters:
v- The rotation to copy.- Returns:
- this rotation.
-
set
Called to assign the values from an array to this rotation.- Parameters:
v- The array to copy from.- Returns:
- this rotation.
-
set
Called to assign the values to this rotation.- Parameters:
x- The X component to assign.y- The Y component to assign.z- The Z component to assign.- Returns:
- this rotation.
-
add
Called to add another rotation to this one.- Parameters:
v- The rotation to add.- Returns:
- this rotation.
-
add
Called to add values to this rotation.- Parameters:
x- The X component to add.y- The Y component to add.z- The Z component to add.- Returns:
- this rotation.
-
addPitch
public void addPitch(float pitch) Called to add pitch value to this rotation.- Parameters:
pitch- The pitch value to add.
-
addYaw
public void addYaw(float yaw) Called to add yaw value to this rotation.- Parameters:
yaw- The yaw value to add.
-
addRoll
public void addRoll(float roll) Called to add roll value to this rotation.- Parameters:
roll- The roll value to add.
-
sub
Called to subtract another rotation from this one.- Parameters:
v- The rotation to subtract.- Returns:
- this rotation.
-
sub
Called to subtract an integer rotation from this one.- Parameters:
v- The rotation to subtract.- Returns:
- this rotation.
-
sub
Called to subtract values from this rotation.- Parameters:
x- The X component to subtract.y- The Y component to subtract.z- The Z component to subtract.- Returns:
- this rotation.
-
addRotationOnAxis
Called to add rotation to this rotation based on the axis.- Parameters:
axis- The axis.degrees- The angle in degrees.
-
flipRotationOnAxis
Called to flip the rotation on the given axis.- Parameters:
axis- The axis.
-
negate
-
mul
Called to scale this rotation.- Parameters:
s- The scale factor to apply.- Returns:
- this rotation.
-
mul
Called to scale this rotation by another rotation.- Parameters:
p- The rotation to scale by.- Returns:
- this rotation.
-
distanceSquaredTo
public float distanceSquaredTo(float x, float y, float z) Called to compute the squared distance from this rotation to the given components.- Parameters:
x- The X component of the other component.y- The Y component of the other component.z- The Z component of the other component.- Returns:
- the squared distance.
-
isFinite
public boolean isFinite()- Returns:
trueif all components are finite,falseotherwise.
-
sanitizeNonFinite
public void sanitizeNonFinite()Replaces any non-finite component (NaN or infinity) with0, in place. -
getQuaternion
public org.joml.Quaterniond getQuaternion(org.joml.Quaterniond dest) Description copied from interface:Rotation3fcGet the rotation represented bythisrotation and stores it into the givenQuaterniond.- Specified by:
getQuaternionin interfaceRotation3fc- Parameters:
dest- the destinationQuaterniond- Returns:
- the passed in destination
-
premul
Description copied from interface:Rotation3fcPre-rotate these Euler angles byqand store the result indest.If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = Q * T- Specified by:
premulin interfaceRotation3fc- Parameters:
q- the quaternion to pre-multiplythisbydest- will hold the result- Returns:
- dest
-
mul
Description copied from interface:Rotation3fcRotate these Euler angles byqand store the result indest.If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = T * Q- Specified by:
mulin interfaceRotation3fc- Parameters:
q- the quaternion to multiplythisbydest- will hold the result- Returns:
- dest
-
premul
-
mul
-
transform
public org.joml.Vector3d transform(org.joml.Vector3dc vec, org.joml.Vector3d dest) Description copied from interface:Rotation3fcTransform the given vector by this rotation and store the result indest.This will apply the rotation described by this to the given vector.
- Specified by:
transformin interfaceRotation3fc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transform
public org.joml.Vector3d transform(org.joml.Vector3d vec) Description copied from interface:Rotation3fcTransform the given vector by this rotation.This will apply the rotation described by this to the given vector.
- Specified by:
transformin interfaceRotation3fc- Parameters:
vec- the vector to transform- Returns:
- vec
-
clone
-
equals
-
hashCode
-
toString
-
lerp
Called to linearly interpolate between two rotations.- Parameters:
a- The start rotation.b- The end rotation.t- The interpolation factor (0.0 - 1.0).- Returns:
- the interpolated rotation.
-
lerpUnclamped
@Nonnull public static Rotation3f lerpUnclamped(@Nonnull Rotation3f a, @Nonnull Rotation3f b, float t) Called to linearly interpolate between two rotations without clamping.- Parameters:
a- The start rotation.b- The end rotation.t- The interpolation factor.- Returns:
- the interpolated rotation.
-
lerpAngle
@Nonnull public static Rotation3f lerpAngle(@Nonnull Rotation3fc a, @Nonnull Rotation3fc b, float t) Called to linearly interpolate between two angles.- Parameters:
a- The start rotation.b- The end rotation.t- The interpolation factor.- Returns:
- the interpolated rotation.
-
lerpAngle
@Nonnull public static Rotation3f lerpAngle(@Nonnull Rotation3fc a, @Nonnull Rotation3fc b, float t, @Nonnull Rotation3f target) Called to linearly interpolate between two angles and store it in a target rotation.- Parameters:
a- The start rotation.b- The end rotation.t- The interpolation factor.target- The target rotation.- Returns:
- the interpolated rotation.
-
lookAt
@Nonnull public static Rotation3f lookAt(@Nonnull org.joml.Vector3dc eye, @Nonnull org.joml.Vector3dc target) Called to compute the look at rotation from an eye position to a target position.- Parameters:
eye- The position looking.target- The position being looked at.- Returns:
- the look at rotation.
-
lookAt
@Nonnull public static Rotation3f lookAt(@Nonnull org.joml.Vector3dc eye, @Nonnull org.joml.Vector3dc target, @Nonnull Rotation3f result) Called to compute the look at rotation from an eye position to a target position and store it in a result rotation.- Parameters:
eye- The position looking.target- The position being looked at.result- The result rotation.- Returns:
- the look at rotation.
-
lookAt
Called to compute the look at rotation for a relative rotation.- Parameters:
relative- The relative rotation.- Returns:
- the look at rotation.
-
lookAt
@Nonnull public static Rotation3f lookAt(@Nonnull org.joml.Vector3dc relative, @Nonnull Rotation3f result) Called to compute the look at rotation for a relative rotation and store it in a result rotation.- Parameters:
relative- The relative rotation.result- The result rotation.- Returns:
- the look at rotation.
-
lookAt
Called to compute the look at rotation for a relative direction.- Parameters:
dx- The relative x component.dy- The relative y component.dz- The relative z component.- Returns:
- the look at rotation.
-
lookAt
@Nonnull public static Rotation3f lookAt(double dx, double dy, double dz, @Nonnull Rotation3f result) Called to compute the look at rotation for a relative direction and store it in a result rotation.- Parameters:
dx- The relative x component.dy- The relative y component.dz- The relative z component.result- The result rotation.- Returns:
- the look at rotation
-