Box3 Bounding Box

I am trying to understand this and I do but I need to understand it better from a mathematical point, is there any article or video about this subject I could not find anything concrete.

Thank you!

@Tibi any chance you can formulate your question as to what you’re trying to understand?

Yes of course.

I don’t understand completely how the bounding box works, I understand the concept but I need to know more, for example, I don’t understand completely the x,y, and also min and max.

In a project that I am making to position an object under another object that was scaled, I am using this approach to get the first object size and adding y/2 to the object that I want under the first object but I thought the y-axis starts from the center so why I have to divide it by 2 makes no sense to me, it is really unclear to me how it works…

Heres a 1 minute MS Paint job. The box gets wrapped around to the smallest values of the model local coordinate. So for example in this picture, the minimum in x is one very ear tip and maximum of x is the end of the other ear tip. So if you want the length of the model in the x, its x=xmax-xmin. Same for the rest of the axis. The axis is set to three js standards. Im having a hard time trying to understand about your project tho.


I understand now… so the origin is in the center… thank you is clear :slight_smile:

I have this piece of code to position a shadow under a model…


// Calculate the size of the group’s bounding box
const groupBoundingBox = new THREE.Box3();
groupBoundingBox.setFromObject(this.group, true);
const groupSize = new THREE.Vector3();
groupBoundingBox.getSize(groupSize);

// Determine the position of this.group.
const groupPosition = this.group.position.clone();

// Calculate the yOffset to align this.shadowGroup under this.group
const shadowPositionY = groupPosition.y - groupSize.y / 2 + this.shadowPlanePositionOffsetY;

// Set the position of this.shadowGroup to align it under this.group on the y-axis
this.shadowGroup.position.set(0, shadowPositionY, 0);

// Update this.shadowPositionY if needed
this.shadowPositionY = shadowPositionY;

What I don’t understand is why I need to divide the y of the group size to position the shadow exactly under the model since y is in the center… dose getSize returns the actual size on all axis?

while it might be, most of the times it’s not. that is why there is a need in separate min and max values

Ok I will do it the right way, thank you for clarifying this!