GivensParameters.java

com.mojang.math.GivensParameters

信息

  • 全限定名:com.mojang.math.GivensParameters
  • 类型:public record
  • 包:com.mojang.math
  • 源码路径:src/main/java/com/mojang/math/GivensParameters.java
  • 起始行号:L7
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public static GivensParameters fromUnnormalized(float sinHalf, float cosHalf) @ L8

  • 方法名:fromUnnormalized
  • 源码定位:L8
  • 返回类型:GivensParameters
  • 修饰符:public static

参数:

  • sinHalf: float
  • cosHalf: float

说明:

TODO

public static GivensParameters fromPositiveAngle(float angle) @ L13

  • 方法名:fromPositiveAngle
  • 源码定位:L13
  • 返回类型:GivensParameters
  • 修饰符:public static

参数:

  • angle: float

说明:

TODO

public GivensParameters inverse() @ L19

  • 方法名:inverse
  • 源码定位:L19
  • 返回类型:GivensParameters
  • 修饰符:public

参数:

说明:

TODO

public Quaternionf aroundX(Quaternionf input) @ L23

  • 方法名:aroundX
  • 源码定位:L23
  • 返回类型:Quaternionf
  • 修饰符:public

参数:

  • input: Quaternionf

说明:

TODO

public Quaternionf aroundY(Quaternionf input) @ L27

  • 方法名:aroundY
  • 源码定位:L27
  • 返回类型:Quaternionf
  • 修饰符:public

参数:

  • input: Quaternionf

说明:

TODO

public Quaternionf aroundZ(Quaternionf input) @ L31

  • 方法名:aroundZ
  • 源码定位:L31
  • 返回类型:Quaternionf
  • 修饰符:public

参数:

  • input: Quaternionf

说明:

TODO

public float cos() @ L35

  • 方法名:cos
  • 源码定位:L35
  • 返回类型:float
  • 修饰符:public

参数:

说明:

TODO

public float sin() @ L39

  • 方法名:sin
  • 源码定位:L39
  • 返回类型:float
  • 修饰符:public

参数:

说明:

TODO

public Matrix3f aroundX(Matrix3f input) @ L43

  • 方法名:aroundX
  • 源码定位:L43
  • 返回类型:Matrix3f
  • 修饰符:public

参数:

  • input: Matrix3f

说明:

TODO

public Matrix3f aroundY(Matrix3f input) @ L58

  • 方法名:aroundY
  • 源码定位:L58
  • 返回类型:Matrix3f
  • 修饰符:public

参数:

  • input: Matrix3f

说明:

TODO

public Matrix3f aroundZ(Matrix3f input) @ L73

  • 方法名:aroundZ
  • 源码定位:L73
  • 返回类型:Matrix3f
  • 修饰符:public

参数:

  • input: Matrix3f

说明:

TODO

代码

public record GivensParameters(float sinHalf, float cosHalf) {
    public static GivensParameters fromUnnormalized(float sinHalf, float cosHalf) {
        float w = Math.invsqrt(sinHalf * sinHalf + cosHalf * cosHalf);
        return new GivensParameters(w * sinHalf, w * cosHalf);
    }
 
    public static GivensParameters fromPositiveAngle(float angle) {
        float sin = Math.sin(angle / 2.0F);
        float cos = Math.cosFromSin(sin, angle / 2.0F);
        return new GivensParameters(sin, cos);
    }
 
    public GivensParameters inverse() {
        return new GivensParameters(-this.sinHalf, this.cosHalf);
    }
 
    public Quaternionf aroundX(Quaternionf input) {
        return input.set(this.sinHalf, 0.0F, 0.0F, this.cosHalf);
    }
 
    public Quaternionf aroundY(Quaternionf input) {
        return input.set(0.0F, this.sinHalf, 0.0F, this.cosHalf);
    }
 
    public Quaternionf aroundZ(Quaternionf input) {
        return input.set(0.0F, 0.0F, this.sinHalf, this.cosHalf);
    }
 
    public float cos() {
        return this.cosHalf * this.cosHalf - this.sinHalf * this.sinHalf;
    }
 
    public float sin() {
        return 2.0F * this.sinHalf * this.cosHalf;
    }
 
    public Matrix3f aroundX(Matrix3f input) {
        input.m01 = 0.0F;
        input.m02 = 0.0F;
        input.m10 = 0.0F;
        input.m20 = 0.0F;
        float c = this.cos();
        float s = this.sin();
        input.m11 = c;
        input.m22 = c;
        input.m12 = s;
        input.m21 = -s;
        input.m00 = 1.0F;
        return input;
    }
 
    public Matrix3f aroundY(Matrix3f input) {
        input.m01 = 0.0F;
        input.m10 = 0.0F;
        input.m12 = 0.0F;
        input.m21 = 0.0F;
        float c = this.cos();
        float s = this.sin();
        input.m00 = c;
        input.m22 = c;
        input.m02 = -s;
        input.m20 = s;
        input.m11 = 1.0F;
        return input;
    }
 
    public Matrix3f aroundZ(Matrix3f input) {
        input.m02 = 0.0F;
        input.m12 = 0.0F;
        input.m20 = 0.0F;
        input.m21 = 0.0F;
        float c = this.cos();
        float s = this.sin();
        input.m00 = c;
        input.m11 = c;
        input.m01 = s;
        input.m10 = -s;
        input.m22 = 1.0F;
        return input;
    }
}

引用的其他类