Spaces:
Build error
Build error
File size: 1,842 Bytes
d46f4a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
package com.mojang.math;
import java.util.Arrays;
import net.minecraft.Util;
import org.joml.Matrix3f;
public enum SymmetricGroup3 {
P123(0, 1, 2),
P213(1, 0, 2),
P132(0, 2, 1),
P231(1, 2, 0),
P312(2, 0, 1),
P321(2, 1, 0);
private final int[] permutation;
private final Matrix3f transformation;
private static final int ORDER = 3;
private static final SymmetricGroup3[][] cayleyTable = Util.make(new SymmetricGroup3[values().length][values().length], p_109188_ -> {
for (SymmetricGroup3 symmetricgroup3 : values()) {
for (SymmetricGroup3 symmetricgroup31 : values()) {
int[] aint = new int[3];
for (int i = 0; i < 3; i++) {
aint[i] = symmetricgroup3.permutation[symmetricgroup31.permutation[i]];
}
SymmetricGroup3 symmetricgroup32 = Arrays.stream(values()).filter(p_175577_ -> Arrays.equals(p_175577_.permutation, aint)).findFirst().get();
p_109188_[symmetricgroup3.ordinal()][symmetricgroup31.ordinal()] = symmetricgroup32;
}
}
});
private SymmetricGroup3(final int p_109176_, final int p_109177_, final int p_109178_) {
this.permutation = new int[]{p_109176_, p_109177_, p_109178_};
this.transformation = new Matrix3f();
this.transformation.set(this.permutation(0), 0, 1.0F);
this.transformation.set(this.permutation(1), 1, 1.0F);
this.transformation.set(this.permutation(2), 2, 1.0F);
}
public SymmetricGroup3 compose(SymmetricGroup3 p_109183_) {
return cayleyTable[this.ordinal()][p_109183_.ordinal()];
}
public int permutation(int p_109181_) {
return this.permutation[p_109181_];
}
public Matrix3f transformation() {
return this.transformation;
}
} |