I am using three.js lib on my backend to calculate AABB (axis aligned bounding box).
getAABB: function (position, scale, orientation) {
const cube = new Mesh(new BoxGeometry(0, 0, 0));
cube.position.set(...position);
cube.scale.set(...scale);
cube.rotation.set(...orientation);
const bb = new Box3().setFromObject(cube);
const { min, max } = bb;
return {
x: {
min: min.x,
max: max.x,
},
y: {
min: min.y,
max: max.y,
},
z: {
min: min.z,
max: max.z,
}
};
}
For [email protected] the results are looking good:
{
x: { min: 0.5391231359521602, max: 3.46087686404784 },
y: { min: 0.32046946879189564, max: 3.6795305312081044 },
z: { min: 0.4349899537033477, max: 3.5650100462966523 },
}
But once I do update to [email protected] it is starting to return wrong results:
{
x: { min: 2, max: 2 },
y: { min: 2, max: 2 },
z: { min: 2, max: 2 },
}
In this example you can see the wrong results for 0.119 https://jsfiddle.net/yura_syedin/zwm3jkdL/
Here is the correct result for 0.118 https://jsfiddle.net/yura_syedin/5801pLaw/34/

It looks like the
BoxGeometryconstructor had a bug fixed inr119.r118when you constructed a box with0, 0, 0width/height/depth parameters, the constructor thought they weren't being defined, and it would default to1, 1, 1. Here's the implementation forr118.r119when you construct a box with0, 0, 0, it respects those dimensions, and gives you a box withmin: 2, max: 2, since it's respecting that the dimensions are 0 units. Here's the implementation forr119.Just make sure you're initializing the box with some non-zero value, and you'll get equal results across versions.