use of org.terasology.math.geom.Vector3i in project Terasology by MovingBlocks.
the class Region3i method createBounded.
/**
* Create a region by two point
* @param a vertex a
* @param b the diagonal vertex of a
* @return a new region base on vertex a and b
*/
public static Region3i createBounded(BaseVector3i a, BaseVector3i b) {
Vector3i min = new Vector3i(a);
min.min(b);
Vector3i max = new Vector3i(a);
max.max(b);
return createFromMinMax(min, max);
}
use of org.terasology.math.geom.Vector3i in project Terasology by MovingBlocks.
the class Region3i method createFromCenterExtents.
/**
* Create a region with center point and extents size
* @param center the center point of region
* @param extents the extents size of region
* @return a new region base on the center point and extents size
*/
public static Region3i createFromCenterExtents(BaseVector3i center, int extent) {
Vector3i min = new Vector3i(center.x() - extent, center.y() - extent, center.z() - extent);
Vector3i max = new Vector3i(center.x() + extent, center.y() + extent, center.z() + extent);
return createFromMinMax(min, max);
}
use of org.terasology.math.geom.Vector3i in project Terasology by MovingBlocks.
the class Region3i method expand.
public Region3i expand(BaseVector3i amount) {
Vector3i expandedMin = min();
expandedMin.sub(amount);
Vector3i expandedMax = max();
expandedMax.add(amount);
return createFromMinMax(expandedMin, expandedMax);
}
use of org.terasology.math.geom.Vector3i in project Terasology by MovingBlocks.
the class Region3i method intersect.
/**
* @param other
* @return The region that is encompassed by both this and other. If they
* do not overlap then the empty region is returned
*/
public Region3i intersect(Region3i other) {
Vector3i intersectMin = min();
intersectMin.max(other.min());
Vector3i intersectMax = max();
intersectMax.min(other.max());
return createFromMinMax(intersectMin, intersectMax);
}
use of org.terasology.math.geom.Vector3i in project Terasology by MovingBlocks.
the class Region3i method expandToContain.
public Region3i expandToContain(BaseVector3i adjPos) {
Vector3i expandedMin = min();
expandedMin.min(adjPos);
Vector3i expandedMax = max();
expandedMax.max(adjPos);
return createFromMinMax(expandedMin, expandedMax);
}
Aggregations