1
$\begingroup$

I wonder how is it possible to scale all shapes so that they are within boundaries of a [unit] sphere? I know how to do this for a cube: if radius of the sphere is S I set the length of X, Y and Z of the cube to S * math.sqrt(3)/3. This way, the corners of the cube are barely touching the surface of the sphere. But I don't know how to do this for other objects such as torus, cylinder and cone in Blender. I wonder, is there a general rule/equation to calculate the scaling factor of a shape so that it fits into a sphere with radius S?

$\endgroup$
2
$\begingroup$

Yes, there is a fairly general algorithm to calculate this scaling factor, which works for all shapes with a known parametric representation. First, substitute the parametric equation of the shape (e.g. a torus, cylinder or cone) into the implicit equation of the sphere, $x^2 + y^2 + z^2 = S^2$. Then, solve this equation for the radius of the sphere. The result will be one or more intervals for values of $S$ for which the shape intersects the sphere with radius $S$. The largest value of $S$ is the radius of the shape's bounding sphere.

Example (torus): Substituting the parametric equation of the torus centered at the origin with major radius $R$ and minor radius $r$ into the implicit equation of the sphere yields $2Rr \cos(\phi) + R^2 + r^2 - S^2 = 0$, which is equivalent to $S\in[R-r,R+r]$. So if you want a torus to fit into a unit sphere, you need to choose the major radius and minor radius such that $R+r\le 1$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.