/** * Adjust the specified mins and maxs vectors so that they contain the specified point. * @param point Point being added * @param mins Min coordinates of the bounding box * @param maxs Max coordinates of the bounding box */ public static void addPointToBounds(Tuple3f point, Tuple3f mins, Tuple3f maxs) { mins.x = Math.min(mins.x, point.x); mins.y = Math.min(mins.y, point.y); mins.z = Math.min(mins.z, point.z); maxs.x = Math.max(maxs.x, point.x); maxs.y = Math.max(maxs.y, point.y); maxs.z = Math.max(maxs.z, point.z); }
/** * Clamp the Tuple3f to 1/8 units. This way positions will * be accurate for client side prediction. */ public static void clampEight(Tuple3f t) { t.x = Math.round(t.x * 8) * 0.125F; t.y = Math.round(t.y * 8) * 0.125F; t.z = Math.round(t.z * 8) * 0.125F; }