started making list ops, about to come up with new patterns for things

This commit is contained in:
Talia-12 2023-05-31 18:40:44 +10:00
parent 24dcfb414b
commit e67c61a23e
3 changed files with 46 additions and 1 deletions

View file

@ -22,4 +22,12 @@ public interface Arithmetic {
HexPattern MOD = HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST);
HexPattern PACK = HexPattern.fromAngles("eqqqqq", HexDir.EAST);
HexPattern UNPACK = HexPattern.fromAngles("qeeeee", HexDir.EAST);
// Lists
HexPattern INDEX = HexPattern.fromAngles("deeed", HexDir.NORTH_WEST);
HexPattern SLICE = HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST);
HexPattern REV = HexPattern.fromAngles("qqqaede", HexDir.EAST);
HexPattern INDEX_OF = HexPattern.fromAngles("dedqde", HexDir.EAST);
HexPattern REMOVE = HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST);
HexPattern REPLACE = HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST);
}

View file

@ -0,0 +1,37 @@
package at.petrak.hexcasting.api.casting.arithmetic.impls;
import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic;
import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator;
import at.petrak.hexcasting.api.casting.math.HexPattern;
import java.util.List;
public enum ListArithmetic implements Arithmetic {
INSTANCE;
public static final List<HexPattern> OPS = List.of(
INDEX,
SLICE,
ADD,
ABS,
REV,
INDEX_OF,
REMOVE,
REPLACE
);
@Override
public String arithName() {
return null;
}
@Override
public Iterable<HexPattern> opTypes() {
return null;
}
@Override
public Operator getOperator(HexPattern pattern) {
return null;
}
}

View file

@ -41,7 +41,7 @@ public class OperatorVec3Delegating extends Operator {
fb.apply(new IterPair<>(new DoubleIota(lh.x()), new DoubleIota(rh.x()))),
fb.apply(new IterPair<>(new DoubleIota(lh.y()), new DoubleIota(rh.y()))),
fb.apply(new IterPair<>(new DoubleIota(lh.z()), new DoubleIota(rh.z()))),
(x, y, z) -> new Vec3Iota(new Vec3(downcast(x, DOUBLE).getDouble(), downcast(y, DOUBLE).getDouble(), downcast(y, DOUBLE).getDouble()))
(x, y, z) -> new Vec3Iota(new Vec3(downcast(x, DOUBLE).getDouble(), downcast(y, DOUBLE).getDouble(), downcast(z, DOUBLE).getDouble()))
);
}