use of com.builtbroken.mc.lib.transform.vector.Pos in project Engine by VoltzEngine-Project.
the class Cube method recalc.
/**
* Called after the cube's data has changed in order
* to update any internal data.
*/
protected void recalc() {
if (pointOne != null && pointTwo != null) {
lowerPoint = new Pos(Math.min(pointOne.x(), pointTwo.x()), Math.min(pointOne.y(), pointTwo.y()), Math.min(pointOne.z(), pointTwo.z()));
higherPoint = new Pos(Math.max(pointOne.x(), pointTwo.x()), Math.max(pointOne.y(), pointTwo.y()), Math.max(pointOne.z(), pointTwo.z()));
this.center = new Pos(min().x() + (getSizeX() / 2), min().y() + (getSizeY() / 2), min().z() + (getSizeZ() / 2));
} else {
this.center = null;
}
}
use of com.builtbroken.mc.lib.transform.vector.Pos in project Engine by VoltzEngine-Project.
the class Cube method getCorners.
public static IPos3D[] getCorners(Cube box) {
IPos3D[] array = new IPos3D[8];
if (box.isValid()) {
double l = box.pointTwo.x() - box.pointOne.x();
double w = box.pointTwo.z() - box.pointOne.z();
double h = box.pointTwo.y() - box.pointOne.y();
array[0] = new Pos(box.pointOne.x(), box.pointOne.y(), box.pointOne.z());
array[1] = new Pos(box.pointOne.x(), box.pointOne.y() + h, box.pointOne.z());
array[2] = new Pos(box.pointOne.x(), box.pointOne.y() + h, box.pointOne.z() + w);
array[3] = new Pos(box.pointOne.x(), box.pointOne.y(), box.pointOne.z() + w);
array[4] = new Pos(box.pointOne.x() + l, box.pointOne.y(), box.pointOne.z());
array[5] = new Pos(box.pointOne.x() + l, box.pointOne.y() + h, box.pointOne.z());
array[6] = new Pos(box.pointOne.x() + l, box.pointOne.y() + h, box.pointOne.z() + w);
array[7] = new Pos(box.pointOne.x() + l, box.pointOne.y(), box.pointOne.z() + w);
}
return array;
}
use of com.builtbroken.mc.lib.transform.vector.Pos in project Engine by VoltzEngine-Project.
the class Cube method add.
public Cube add(double x, double y, double z) {
if (isValid()) {
pointOne = new Pos(pointOne.x() + x, pointOne.y() + y, pointOne.z() + z);
pointTwo = new Pos(pointTwo.x() + x, pointTwo.y() + y, pointTwo.z() + z);
recalc();
}
return this;
}
Aggregations