Rotation3f class
Пакет: com.hypixel.hytale.math.vector
Файл: com/hypixel/hytale/math/vector/Rotation3f.java
implements: Rotation3fc
Поля (23)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
break |
|
|
break |
|
int |
var1 |
|
float |
var11 |
|
double |
var12 |
|
Rotation3f |
var2 |
|
int |
var2 |
|
|
var2 |
|
|
var2 |
|
float |
var3 |
|
Quaterniond |
var3 |
|
Quaterniond |
var3 |
|
double |
var3 |
|
float |
var4 |
|
Vector3d |
var4 |
|
Quaterniond |
var4 |
|
float |
var5 |
|
Vector3d |
var5 |
|
double |
var5 |
|
float |
var6 |
|
double |
var7 |
|
float |
var7 |
|
double |
var9 |
Методы (22)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
void |
addPitchvoid addPitch(float var1) |
public |
void |
addRollvoid addRoll(float var1) |
public |
void |
addRotationOnAxisvoid addRotationOnAxis(@Nonnull Axis var1, int var2) |
public |
void |
addYawvoid addYaw(float var1) |
public |
float |
distanceSquaredTofloat distanceSquaredTo(float var1, float var2, float var3) |
public |
void |
flipRotationOnAxisvoid flipRotationOnAxis(@Nonnull Axis var1) |
|
|
if if(this == var1) |
|
|
if if(var12 > 0.0) |
public |
boolean |
isFiniteboolean isFinite() |
abstract |
return |
lookAtreturn lookAt(var3, var5, var7, var2) |
public |
Rotation3f |
mulRotation3f mul(Quaterniondc var1) |
static |
BuilderCodec<Rotation3f> |
newBuilderCodecBuilderCodec<Rotation3f> newBuilderCodec(@Nonnull Supplier<Rotation3f> var0) |
public |
Rotation3f |
premulRotation3f premul(Quaterniondc var1) |
public |
void |
sanitizeNonFinitevoid sanitizeNonFinite() |
public |
void |
setPitchvoid setPitch(float var1) |
public |
void |
setRollvoid setRoll(float var1) |
public |
void |
setXvoid setX(float var1) |
public |
void |
setYvoid setY(float var1) |
public |
void |
setYawvoid setYaw(float var1) |
public |
void |
setZvoid setZ(float var1) |
|
|
switch switch(var1) |
abstract |
|
this this(0.0F, 0.0F, 0.0F) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.math.vector;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIDisplayMode;
class="kw">import com.hypixel.hytale.math.Axis;
class="kw">import com.hypixel.hytale.math.util.MathUtil;
class="kw">import com.hypixel.hytale.math.util.TrigMathUtil;
class="kw">import java.util.function.Supplier;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Quaterniond;
class="kw">import org.joml.Quaterniondc;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector3dc;
class="kw">import org.joml.Vector3i;
class="kw">public class Rotation3f class="kw">implements Rotation3fc {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<Rotation3f> CODEC = newBuilderCodec(Rotation3f::new);
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<Rotation3f> PARTIAL_TELEPORT_CODEC = newBuilderCodec(() -> new Rotation3f(Float.NaN, Float.NaN, Float.NaN));
class="kw">public class="kw">static class="kw">final Rotation3fc ZERO = new Rotation3f(0.0F, 0.0F, 0.0F);
class="kw">public class="kw">static class="kw">final Rotation3fc IDENTITY = ZERO;
class="kw">public class="kw">static class="kw">final Rotation3fc NaN = new Rotation3f(Float.NaN, Float.NaN, Float.NaN);
class="kw">public float x;
class="kw">public float y;
class="kw">public float z;
class="kw">private class="kw">static BuilderCodec<Rotation3f> newBuilderCodec(@Nonnull Supplier<Rotation3f> var0) {
class="kw">return BuilderCodec.builder(Rotation3f.class, var0)
.metadata(UIDisplayMode.COMPACT)
.appendInherited(
new KeyedCodec<>("Pitch", Codec.FLOAT),
(var0x, var1) -> var0x.x = var1,
var0x -> Float.isNaN(var0x.x) ? null : var0x.x,
(var0x, var1) -> var0x.x = var1.x
)
.add()
.appendInherited(
new KeyedCodec<>("Yaw", Codec.FLOAT),
(var0x, var1) -> var0x.y = var1,
var0x -> Float.isNaN(var0x.y) ? null : var0x.y,
(var0x, var1) -> var0x.y = var1.y
)
.add()
.appendInherited(
new KeyedCodec<>("Roll", Codec.FLOAT),
(var0x, var1) -> var0x.z = var1,
var0x -> Float.isNaN(var0x.z) ? null : var0x.z,
(var0x, var1) -> var0x.z = var1.z
)
.add()
.build();
}
class="kw">public Rotation3f() {
this(0.0F, 0.0F, 0.0F);
}
class="kw">public Rotation3f(@Nonnull Rotation3fc var1) {
this(var1.x(), var1.y(), var1.z());
}
class="kw">public Rotation3f(float var1, float var2, float var3) {
this.x = var1;
this.y = var2;
this.z = var3;
}
@Override
class="kw">public float x() {
class="kw">return this.x;
}
@Override
class="kw">public float pitch() {
class="kw">return this.x;
}
class="kw">public void setX(float var1) {
this.x = var1;
}
class="kw">public void setPitch(float var1) {
this.x = var1;
}
@Override
class="kw">public float y() {
class="kw">return this.y;
}
@Override
class="kw">public float yaw() {
class="kw">return this.y;
}
class="kw">public void setY(float var1) {
this.y = var1;
}
class="kw">public void setYaw(float var1) {
this.y = var1;
}
@Override
class="kw">public float z() {
class="kw">return this.z;
}
@Override
class="kw">public float roll() {
class="kw">return this.z;
}
class="kw">public void setZ(float var1) {
this.z = var1;
}
class="kw">public void setRoll(float var1) {
this.z = var1;
}
@Nonnull
class="kw">public Rotation3f set(@Nonnull Rotation3fc var1) {
this.x = var1.x();
this.y = var1.y();
this.z = var1.z();
class="kw">return this;
}
@Nonnull
class="kw">public Rotation3f set(@Nonnull float[] var1) {
this.x = var1[0];
this.y = var1[1];
this.z = var1[2];
class="kw">return this;
}
@Nonnull
class="kw">public Rotation3f set(float var1, float var2, float var3) {
this.x = var1;
this.y = var2;
this.z = var3;
class="kw">return this;
}
@Nonnull
class="kw">public Rotation3f add(@Nonnull Rotation3f var1) {
this.x = this.x + var1.x;
this.y = this.y + var1.y;
this.z = this.z + var1.z;
class="kw">return this;
}
@Nonnull
class="kw">public Rotation3f add(float var1, float var2, float var3) {
this.x += var1;
this.y += var2;
this.z += var3;
class="kw">return this;
}
class="kw">public void addPitch(float var1) {
this.x += var1;
}
class="kw">public void addYaw(float var1) {
this.y += var1;
}
class="kw">public void addRoll(float var1) {
this.z += var1;
}
@Nonnull
class="kw">public Rotation3f sub(@Nonnull Rotation3f var1) {
this.x = this.x - var1.x;
this.y = this.y - var1.y;
this.z = this.z - var1.z;
class="kw">return this;
}
@Nonnull
class="kw">public Rotation3f sub(@Nonnull Vector3i var1) {
this.x = this.x - var1.x;
this.y = this.y - var1.y;
this.z = this.z - var1.z;
class="kw">return this;
}
@Nonnull
class="kw">public Rotation3f sub(float var1, float var2, float var3) {
this.x -= var1;
this.y -= var2;
this.z -= var3;
class="kw">return this;
}
class="kw">public void addRotationOnAxis(@Nonnull Axis var1, int var2) {
float var3 = (float) (Math.PI / 180.0) * var2;
class="kw">switch (var1) {
case X:
this.setPitch(this.pitch() + var3);
break;
case Y:
this.setYaw(this.yaw() + var3);
break;
case Z:
this.setRoll(this.roll() + var3);
}
}
class="kw">public void flipRotationOnAxis(@Nonnull Axis var1) {
this.addRotationOnAxis(var1, 180);
}
@Nonnull
class="kw">public Rotation3f negate() {
this.x = -this.x;
this.y = -this.y;
this.z = -this.z;
class="kw">return this;
}
@Nonnull
class="kw">public Rotation3f mul(float var1) {
this.x *= var1;
this.y *= var1;
this.z *= var1;
class="kw">return this;
}
@Nonnull
class="kw">public Rotation3f mul(@Nonnull Rotation3f var1) {
this.x = this.x * var1.x;
this.y = this.y * var1.y;
this.z = this.z * var1.z;
class="kw">return this;
}
class="kw">public float distanceSquaredTo(float var1, float var2, float var3) {
float var4 = var1 - this.x;
float var5 = var2 - this.y;
float var6 = var3 - this.z;
class="kw">return var4 * var4 + var5 * var5 + var6 * var6;
}
class="kw">public boolean isFinite() {
class="kw">return Float.isFinite(this.x) && Float.isFinite(this.y) && Float.isFinite(this.z);
}
class="kw">public void sanitizeNonFinite() {
if (!Float.isFinite(this.x)) {
this.x = 0.0F;
}
if (!Float.isFinite(this.y)) {
this.y = 0.0F;
}
if (!Float.isFinite(this.z)) {
this.z = 0.0F;
}
}
@Override
class="kw">public Quaterniond getQuaternion(Quaterniond var1) {
class="kw">return var1.rotationYXZ(this.y, this.x, this.z);
}
@Override
class="kw">public Rotation3f premul(Quaterniondc var1, Rotation3f var2) {
Quaterniond var3 = this.getQuaternion(new Quaterniond());
Vector3d var4 = var3.premul(var1).getEulerAnglesYXZ(new Vector3d());
class="kw">return var2.set((float)var4.x, (float)var4.y, (float)var4.z);
}
@Override
class="kw">public Rotation3f mul(Quaterniondc var1, Rotation3f var2) {
Quaterniond var3 = this.getQuaternion(new Quaterniond());
Quaterniond var4 = var3.mul(var1);
Vector3d var5 = var4.getEulerAnglesYXZ(new Vector3d());
class="kw">return var2.set((float)var5.x, (float)var5.y, (float)var5.z);
}
class="kw">public Rotation3f premul(Quaterniondc var1) {
class="kw">return this.premul(var1, this);
}
class="kw">public Rotation3f mul(Quaterniondc var1) {
class="kw">return this.mul(var1, this);
}
@Override
class="kw">public Vector3d transform(Vector3dc var1, Vector3d var2) {
class="kw">return var1.rotateZ(this.z, var2).rotateX(this.x).rotateY(this.y);
}
@Override
class="kw">public Vector3d transform(Vector3d var1) {
class="kw">return this.transform(var1, var1);
}
@Nonnull
class="kw">public Rotation3f clone() {
class="kw">return new Rotation3f(this.x, this.y, this.z);
}
@Override
class="kw">public boolean equals(Object var1) {
if (this == var1) {
class="kw">return true;
} else if (var1 == null) {
class="kw">return false;
} else if (this.getClass() != var1.getClass()) {
class="kw">return false;
} else {
Rotation3f var2 = (Rotation3f)var1;
if (Float.floatToIntBits(this.x) != Float.floatToIntBits(var2.x)) {
class="kw">return false;
} else {
class="kw">return Float.floatToIntBits(this.y) != Float.floatToIntBits(var2.y) ? false : Float.floatToIntBits(this.z) == Float.floatToIntBits(var2.z);
}
}
}
@Override
class="kw">public int hashCode() {
int var1 = 31;
int var2 = 1;
var2 = 31 * var2 + Float.floatToIntBits(this.x);
var2 = 31 * var2 + Float.floatToIntBits(this.y);
class="kw">return 31 * var2 + Float.floatToIntBits(this.z);
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "Rotation3f{x=" + this.x + ", y=" + this.y + ", z=" + this.z + "}";
}
@Nonnull
class="kw">public class="kw">static Rotation3f lerp(@Nonnull Rotation3f var0, @Nonnull Rotation3f var1, float var2) {
class="kw">return lerpUnclamped(var0, var1, MathUtil.clamp(var2, 0.0F, 1.0F));
}
@Nonnull
class="kw">public class="kw">static Rotation3f lerpUnclamped(@Nonnull Rotation3f var0, @Nonnull Rotation3f var1, float var2) {
class="kw">return new Rotation3f(var0.x + var2 * (var1.x - var0.x), var0.y + var2 * (var1.y - var0.y), var0.z + var2 * (var1.z - var0.z));
}
@Nonnull
class="kw">public class="kw">static Rotation3f lerpAngle(@Nonnull Rotation3fc var0, @Nonnull Rotation3fc var1, float var2) {
class="kw">return lerpAngle(var0, var1, var2, new Rotation3f());
}
@Nonnull
class="kw">public class="kw">static Rotation3f lerpAngle(@Nonnull Rotation3fc var0, @Nonnull Rotation3fc var1, float var2, @Nonnull Rotation3f var3) {
var3.set(MathUtil.lerpAngle(var0.x(), var1.x(), var2), MathUtil.lerpAngle(var0.y(), var1.y(), var2), MathUtil.lerpAngle(var0.z(), var1.z(), var2));
class="kw">return var3;
}
@Nonnull
class="kw">public class="kw">static Rotation3f lookAt(@Nonnull Vector3dc var0, @Nonnull Vector3dc var1) {
class="kw">return lookAt(var0, var1, new Rotation3f());
}
@Nonnull
class="kw">public class="kw">static Rotation3f lookAt(@Nonnull Vector3dc var0, @Nonnull Vector3dc var1, @Nonnull Rotation3f var2) {
double var3 = var1.x() - var0.x();
double var5 = var1.y() - var0.y();
double var7 = var1.z() - var0.z();
class="kw">return lookAt(var3, var5, var7, var2);
}
@Nonnull
class="kw">public class="kw">static Rotation3f lookAt(@Nonnull Vector3dc var0) {
class="kw">return lookAt(var0, new Rotation3f());
}
@Nonnull
class="kw">public class="kw">static Rotation3f lookAt(@Nonnull Vector3dc var0, @Nonnull Rotation3f var1) {
class="kw">return lookAt(var0.x(), var0.y(), var0.z(), var1);
}
@Nonnull
class="kw">public class="kw">static Rotation3f lookAt(double var0, double var2, double var4) {
class="kw">return lookAt(var0, var2, var4, new Rotation3f());
}
@Nonnull
class="kw">public class="kw">static Rotation3f lookAt(double var0, double var2, double var4, @Nonnull Rotation3f var6) {
if (!MathUtil.closeToZero(var0) || !MathUtil.closeToZero(var4)) {
float var7 = TrigMathUtil.atan2((float)(-var0), (float)(-var4));
var6.y = MathUtil.wrapAngle(var7);
}
double var12 = var0 * var0 + var2 * var2 + var4 * var4;
if (var12 > 0.0) {
double var9 = MathUtil.clamp(var2 / Math.sqrt(var12), -1.0, 1.0);
float var11 = (float) (Math.PI / 2) - (float)Math.acos(var9);
var6.x = MathUtil.clamp(var11, (float) (-Math.PI / 2) + MathUtil.PITCH_EDGE_PADDING, (float) (Math.PI / 2) - MathUtil.PITCH_EDGE_PADDING);
}
class="kw">return var6;
}
}