use of org.terasology.math.geom.BaseVector3f in project Terasology by MovingBlocks.
the class Region3i method createFromCenterExtents.
/**
* Create a region with center point and x,y,z coordinate extents size
* @param center the center point of region
* @param extents the extents size of each side of region
* @return a new region base on the center point and extents size
*/
public static Region3i createFromCenterExtents(BaseVector3f center, BaseVector3f extents) {
Vector3f min = new Vector3f(center.x() - extents.x(), center.y() - extents.y(), center.z() - extents.z());
Vector3f max = new Vector3f(center.x() + extents.x(), center.y() + extents.y(), center.z() + extents.z());
max.x = max.x - Math.ulp(max.x);
max.y = max.y - Math.ulp(max.y);
max.z = max.z - Math.ulp(max.z);
return createFromMinMax(new Vector3i(min), new Vector3i(max));
}
Aggregations