0
$\begingroup$

I have a box $B_1$ with sides of $2$, $2.5$ and $3$ units, and box $B_2$ with sides of $1140$, $890$, and $1120$ units.

$B_1$ is the bounding box of a rabbit mesh, an elephant mesh, etc, inside $B_2$ is a voxelized 3D fractal isosurface. I wish to multiply the voxelized rabbit with the fractal with maximum resolution, without chopping a part of the rabbit.

How can I find the correct ratio to multiply $B_1$ so that it fits perfectly (with matching maximum) inside of box $B_2$ while keeping the same ratio of either?

I have $N$ randomly sized bounding boxes which have different ratios every time. I wish to generalize the formula.

$\endgroup$
2
  • 1
    $\begingroup$ B1 already fits inside B2 - do you wish to find the largest scaling factor such that it still fits? Is that what you mean by perfectly? What exactly is your goal when you have N boxes? I think you need to define your problem more precisely. $\endgroup$
    – mchristos
    Mar 30, 2017 at 10:23
  • $\begingroup$ Thanks a lot, i wrote more information in the first paragraph. $\endgroup$ Mar 30, 2017 at 10:35

1 Answer 1

1
$\begingroup$

Assuming you cannot rotate your boxes, you want to find

$$\min\left(\frac{1140}{2},\frac{890}{2.5},\frac{1120}{3}\right)$$

Here it is $356$, from the middle term. so if you multiply the sides of $B_2$ by $356$, you get an enlarged $712 \times 890 \times 1068$ box, which just fits in $B_1$.

If you can rotate your boxes, then sort the two sets of dimensions first and find $$\min\left(\frac{890}{2},\frac{1120}{2.5},\frac{1140}{3}\right)$$ to give $380$ from the right-hand term, and multiplying the sides of $B_2$ by $380$ gives you an enlarged $760 \times 950 \times 1140$ box, which with rotation just fits in $B_1$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .