1
$\begingroup$

Help with math formula to maintain distance along the x-axis between an outer cube and an inner cube of 0.88 while scaling.

img1

Outer cube dimensions = x=4.4, y=11.4, z=11
Inner cube dimensions = x=2.64, y=9.48, z=16.8

My thought process was to scale everything along the x-axis then reduce the outer cubes faces so it will maintain the 0.88 distance between the two. I'm just having an issue with the formula required to do this.

Example:

If I scale the object along the x-axis 3 times it gives me this see image below:

img2

But I'm trying to get something like this scale / adjust the outer faces of the cube along the x-axis so the distance maintains the 0.88 distance.

img3

img4

When I do this graphically it comes out the scale I should use is 0.7339...How can I do this using a formula?

PS: I know I can select the outer faces and scale in the x-axis direction till it reaches 0.88.

I'm looking for a formula due to the fact that this is going to be used in Geometry Nodes to make different magnet holders parametric which will then be 3D printed to test different Halbach array setups.

$\endgroup$
4
  • 1
    $\begingroup$ Why not use a Solidify with 0.88 thickness? $\endgroup$ Apr 26, 2022 at 10:36
  • $\begingroup$ Was trying to use a formula in GN (I want to learn ;-) ) it may also make it more adjustable in cases of strange shape magnet holders. Solidify can go a little wonky on strange shapes. $\endgroup$
    – Rick T
    Apr 26, 2022 at 10:49
  • $\begingroup$ You illustrate front/back walls a different thickness from left/right. You also say in a comment, below, the shapes may be 'irregular'. If you want different thicknesses on various walls, how do you want to indicate which walls have which thickness? Could you show what you'd like the initial user-input to be? $\endgroup$
    – Robin Betts
    Apr 27, 2022 at 9:25
  • 1
    $\begingroup$ @RobinBetts Marty's answer was basically what I needed. I had help from another person which basically got me to the final answer I was looking for. I posted the solution as one of the answers just in case this comes up again. $\endgroup$
    – Rick T
    Apr 27, 2022 at 14:30

4 Answers 4

2
$\begingroup$

Here's an answer for the x dimension. The others should be obvious.

Let $w$ be the width distance you want to separate the inner and outer box by.

Let $x_0$ be the original width of the outside box.

let $x_1 = x_0 - 2w$ be the width of the inside box.

let $s_0$ be the factor you want to scale the outside box by.

The new outside width is $x_0*s_0$. Call this $X_0$

The new inside width then should be $X_0 -2w$. Call this $X_1$.

$X_1 = X_0 - 2w = s_0*x_0 - 2w$

But we want $X_1 = s_1 * x_1$ so we need to solve for $s_1$.

$s1 = X_1 / x_1 = (s_0 *x_0 - 2w) / (x_0 - 2w)$

Because your original inner width depends on your original outer width and your original width difference, you can calculate the new scale factor for the inner box in terms of the original outer width, the width difference, and the scale factor for the outer box.

$\endgroup$
2
  • $\begingroup$ Thanks!!! When I do this graphically the scale I should use to reduce the x-axis outer box should be 0.7339... but when I use the equation you so kindly provided it comes out as = (3*4.4-2*0.88) / (4.4-2*0.88)=4.333 any idea what I missed? $\endgroup$
    – Rick T
    Apr 27, 2022 at 4:27
  • $\begingroup$ Ok my issue has been fixed. I'll post it as another answer but yours really did it. $\endgroup$
    – Rick T
    Apr 27, 2022 at 14:31
2
$\begingroup$

What I had help getting....

Suppose you want scale the $\ x$-dimension of the inner object by a scale factor $\ s\ $, and keep the $\ x$-distance between the surfaces of the inner and outer objects fixed at $\ d\ $.

Let $\ w\ $ be the $\ x$-width of the inner object before scaling. Then the $\ x$-width of the outer object will be $\ w+2d\ $. After scaling, the $\ x$-width of the inner object will be $\ sw\ $, and the $\ x$-width of the outer object will have to be $\ sw+2d $. The outer object will thus have been scaled in the $ x$-direction by the factor $$ f=\frac{sw+2d}{w+2d}\ , $$ and if you've already scaled the outer object instead by the factor $\ s\ $, then you'll have to rescale it by the factor $\ \frac{f}{s}\ $ to obtain the right dimensions.

In your example, $\ w=2.64,$$\,d=0.88\ ,$ and $\ s=3\ $, and if we plug these into the above formula, we get $$ f=\frac{3\times2.64+2\times0.88}{2.64+2\times0.88}=\frac{11}{5} $$

Thus, after scaling the outer box up by a factor of $\ 3\ $, you need to rescale it by the factor $\ \frac{11}{15}\approx0.7333\ $ to get the right dimensions. I assume the digit $9$ appearing in the fourth decimal place of the scaling factor $\ 0.7339\dots\ $ you give is either a typo or rounding error.

$\endgroup$
0
$\begingroup$

Maybe make this all with GeoNodes. Make a cube, delete the top face and with extrude node set to 0.88 and some selection nodes you can isolate the faces that you want to extrude and then you can use this as a group to instance everything.

$\endgroup$
3
  • $\begingroup$ Some of the shapes maybe irregular hence I was looking for a formula, I should be able to adjust the formula if need be. $\endgroup$
    – Rick T
    Apr 26, 2022 at 10:44
  • $\begingroup$ Im not that good with maths :/ but i can imagine having a specific value for every face extruded, so you can hardcode the dimensions by hand. Oh well, i have run out of ideas :D $\endgroup$
    – Crfko
    Apr 26, 2022 at 10:46
  • $\begingroup$ Thanks every bit helps I'm trying to make it parametric. $\endgroup$
    – Rick T
    Apr 26, 2022 at 10:48
0
$\begingroup$

There is actually a tool in Blender to do exactly that which is called push/pull https://docs.blender.org/manual/en/latest/modeling/meshes/editing/mesh/transform/push_pull.html#:~:text=Push%2FPull%20will%20move%20the,center%20by%20the%20same%20distance.

$\endgroup$

You must log in to answer this question.

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