Formula For 3D Dilation?

1.6k Views Asked by At

If I have a sphere on a 3D grid with it's center being at the origin, and I want to double the size of the sphere, where would it's poles be?

2

There are 2 best solutions below

0
On

I don't have enough reputation to comment, but a few things:

  1. You haven't said where the "poles" are to begin with.
  2. It depends on what you mean by "size".

If we assume that we begin with a unit sphere, and that the poles are where we would typically find them on a globe ($(0,0,1)$ and $(0,0,-1)$), then we have to consider what "doubling the size" means.

If we double the radius, then the poles end up at $(0,0,2)$ and $(0,0,-2)$. If we double the volume, then since the volume depends upon an $r^3$ term, we must increase the radius from 1 to $2^{1/3}$. This puts the poles at $(0,0,2^{1/3})$ and $(0,0,-2^{1/3})$.

0
On

Since the volume of a sphere is $$V(r) = \frac{4\pi}{3} r^3$$ and you wish to double the volume, the radius must change (from $r_1$ to $r_2$), $$\frac{V(r_2)}{V(r_1)} = \frac{r_2^3}{r_1^3} = 2$$ in other words, $$r_2^3 = 2 r_1^3$$ by a factor of $\sqrt[3]{2}$, $$r_2 = 2^{1/3} r_1$$

If the poles of the original sphere are at $(x_N,y_N,z_N)$ and $(x_S,y_S,z_S)$, the center of that sphere is at the middle of them, $$(x_C,y_C,z_C) = \left( \frac{x_N+x_S}{2}, \frac{y_N+y_S}{2}, \frac{z_N+z_S}{2} \right) $$ and the original radius is half the distance between the poles, $$r_1 = \frac{\sqrt{(x_N-x_S)^2 + (y_N-y_S)^2 + (z_N-z_S)^2}}{2}$$

If we expand the sphere to double the volume, with center not moving, the distance between the poles will be $\sqrt[3]{2}$ as far as originally. Because scaling is linear, we don't need to know the original radius; we only need to scale the coordinates by the same factor. To keep the center from moving, we move the poles in opposite directions, by the same amount (half the change, i.e. by a factor of $\sqrt[3]{2}/2 = 2^{-2/3} \approx 0.62996$):

$$\begin{cases} x_N' = x_N + 2^{-2/3}(x_N - x_S) \\ y_N' = y_N + 2^{-2/3}(y_N - y_S) \\ z_N' = z_N + 2^{-2/3}(z_N - z_S) \\ x_S' = x_S - 2^{-2/3}(x_N - x_S) \\ y_S' = y_S - 2^{-2/3}(y_N - y_S) \\ z_S' = z_S - 2^{-2/3}(z_N - z_S) \end{cases}$$ where $(x_N', y_N', z_N')$ and $(x_S', y_S', z_S')$ are the new locations for the poles.

When implementing something like this, it is a very common bug to not use temporary variables, but instead modify the single set of pole coordinates directly. That is a bug, because then the two poles are not moved by the same amount. (Instead, you should first calculate the difference between the coordinates, scale it by the factor mentioned above, and use them to modify the pole coordinates, to ensure both poles are moved the same amount.)