I am trying to determine the bounding box of a geometry after applying rotations to it.
I obtained the rotation code from the sample editor in Three JS:
object.rotation.x = xRadians;
object.rotation.y = yRdians;
object.rotation.z = zRadians
This rotation works as expected.
However, I am having trouble getting the updated bounding box:
Here is the code I am using to retrieve the bounding box:
var minX = parseFloat(object.boundingBox.min.x);
var minY = parseFloat(object.boundingBox.min.y);
var minZ = parseFloat(object.boundingBox.min.z);
Regardless of the rotation applied, I keep receiving the same values for minX-Z. How can I properly obtain the updated bounding box?
I am currently on version r-66.
In addition, I attempted the following approach:
var radians = x * Math.PI / 180;
var axisX = new THREE.Vector3(1, 0, 0);
var matrix = new THREE.Matrix4().makeRotationAxis(axisX, radians);
geometry.applyMatrix(matrix);
This method correctly updates the bounding box after performing relative rotation. However, I am looking to achieve the same result without relative rotation. The initial method I mentioned does not update the object's bounding box accordingly.
Any suggestions or ideas would be greatly appreciated. Thank you!