<p>Scaling is linear, so you can do this in one step rather than iteratively. If you have two vector values <code>sizeA</code> and <code>sizeB</code> for the sizes of the two meshes’ bounding boxes, the vector value you should scale mesh B by is <code>sizeA / sizeB</code>. If you want to scale it uniformly, you’ll need to pick a single scalar value; one way to do that would be to average the ratios of each component, i.e. <code>(sizeA.x / sizeB.x + sizeA.y / sizeB.y + sizeA.z / sizeB.z) / 3</code>.</p>

CC BY-SA 4.0
2021-09-10T17:32:04.127Z
2021-09-10T17:32:04.127Z
Noah Witherspoon
<p>I have a mesh (Mesh-A) with a bounding box of some arbitrary size defined by X,Y,Z scale.
In runtime I import another mesh (Mesh-B),which has an overall topology similar to the Mesh-A, but it can have a different default scale. I am looking for an efficient algorithm to rescale the Mesh-B to have the new scale equal to the Mesh-A,which basically means - their bounding boxes are of similar sizes. The naive approach would be to run for... loop, scaling the Mesh-B transform,till its BB has an approximate size equal to that of  the Mesh-B's BB. I would like to learn other approaches.</p>

CC BY-SA 4.0
2021-09-11T13:34:53.010Z
Scaling by BB does not seem a very fruitful way to do anything. I mean a elephant does not have the same BB as a human. Ideally youd have some feature you can relate.
joojaa
<transformations>
Efficient algorithm for mesh scale adjustment based on the scale of another mesh
Michael IV
# Efficient algorithm for mesh scale adjustment based on the scale of another mesh

(Asked by: username_0 on 2021-09-10)

I have a mesh (Mesh-A) with a bounding box of some arbitrary size defined by X,Y,Z scale.
In runtime I import another mesh (Mesh-B),which has an overall topology similar to the Mesh-A, but it can have a different default scale. I am looking for an efficient algorithm to rescale the Mesh-B to have the new scale equal to the Mesh-A,which basically means - their bounding boxes are of similar sizes. The naive approach would be to run for... loop, scaling the Mesh-B transform,till its BB has an approximate size equal to that of the Mesh-B's BB. I would like to learn other approaches.

**Tags:** transformations

> **Comments:**
> **username_1**: Scaling by BB does not seem a very fruitful way to do anything. I mean a elephant does not have the same BB as a human. Ideally youd have some feature you can relate.  

---

## 1 answers

### Answer by username_2 on 2021-09-10. Score: 3 | Accepted answer

Scaling is linear, so you can do this in one step rather than iteratively. If you have two vector values `sizeA` and `sizeB` for the sizes of the two meshes’ bounding boxes, the vector value you should scale mesh B by is `sizeA / sizeB`. If you want to scale it uniformly, you’ll need to pick a single scalar value; one way to do that would be to average the ratios of each component, i.e. `(sizeA.x / sizeB.x + sizeA.y / sizeB.y + sizeA.z / sizeB.z) / 3`.


---

