mmb.engine.rotate.Chirality Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multimachinebuilder Show documentation
Show all versions of multimachinebuilder Show documentation
Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world.
THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<
/**
*
*/
package mmb.engine.rotate;
import java.util.EventListener;
import java.util.function.Consumer;
import mmb.NN;
/**
* @author oskar
* This enum defines chirality
*/
public enum Chirality {
/**
* Describes anti-clockwise chirality, in order of [+X, -Y, -X, +Y]
*/
L {
@Override
public Rotation right(Rotation rotation) {
return rotation.ccw();
}
@Override
public Rotation left(Rotation rotation) {
return rotation.cw();
}
@Override
public Side right(Side rotation) {
return rotation.ccw();
}
@Override
public Side left(Side rotation) {
return rotation.cw();
}
@Override
public Chirality reverse() {
return R;
}
},
/**
* Describes clockwise chirality, in order of [+X, +Y, -X, -Y]
*/
R {
@Override
public Rotation right(Rotation rotation) {
return rotation.cw();
}
@Override
public Rotation left(Rotation rotation) {
return rotation.ccw();
}
@Override
public Side right(Side rotation) {
return rotation.cw();
}
@Override
public Side left(Side rotation) {
return rotation.ccw();
}
@Override
public Chirality reverse() {
return L;
}
};
/**
* Rotates the object in the chirality's "right" direction, meaning the same as positive
* @param rotation rotation to rotate
* @return rotated rotation
*/
public abstract @NN Rotation right(Rotation rotation);
/**
* Rotates the object in the chirality's "left" direction, meaning the same as negative
* @param rotation rotation to rotate
* @return rotated rotation
*/
public abstract @NN Rotation left(Rotation rotation);
/**
* Rotates the object in the chirality's "right" direction, meaning the same as positive
* @param rotation rotation to rotate
* @return rotated rotation
*/
public abstract @NN Side right(Side rotation);
/**
* Rotates the object in the chirality's "left" direction, meaning the same as negative
* @param rotation rotation to rotate
* @return rotated rotation
*/
public abstract @NN Side left(Side rotation);
/**
* @return reverse of this chirality
*/
public abstract @NN Chirality reverse();
/**
* @author oskar
* Represents a chirality listener, used in chiral blocks
*/
public static interface ChiralityListener extends EventListener, Consumer{
//unused
}
}