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 three@0.118 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 three@0.119 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/