# Bounding Box size calculation

**URL:** <https://forum.babylonjs.com/t/bounding-box-size-calculation/30876>\
**Category:** Questions\
**Created:** [May 30, 2022, 6:44pm UTC](https://forum.babylonjs.com/t/bounding-box-size-calculation/30876 "2022-05-30T18:44:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/andi/32/12152_2.png) [@Andi](https://forum.babylonjs.com/u/Andi)\
**Post date:** [May 30, 2022, 6:44pm UTC](https://forum.babylonjs.com/t/bounding-box-size-calculation/30876/1 "2022-05-30T18:44:32Z")

</div>

I’m working on a QuadTree implementation and levereging the BoundinBox class. I’m a bit baffled by the `extendSize` property, and I think my understanding might be off?

Let’s say we define a BoundingBox with:

- min: 0, 0, 0
- max: 1000, 0, 1000

I would expect the following:

- center 500, 0, 500
- size 1000, 0, 1000 ??

But at the moment the size is 500, 0, 500 - and looking at the code it does seem correct:

> <https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Culling/boundingBox.ts#L114>

Any idea why the size would be 500 when I would expect a side size (in the case of a rectangle, or square) - to be 1000?

My math skills are not great, but I’d like to try to understand exactly why size is defined as (max - min) / 2.

Thanks!

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [May 30, 2022, 8:24pm UTC](https://forum.babylonjs.com/t/bounding-box-size-calculation/30876/2 "2022-05-30T20:24:56Z")

</div>

Hi.

extendSize is a distance from the center of the box to it’s sides (x, y ,z)

So basically that’s W/2 x H/2 x D/2

If you want to get W x H x D you need to multiply each of these by 2. So something like  
extendSize.scale(2)

Basically extendSize being 500, 500 in that case is the expected result.

🙂
