# Fix the dimensions in Graphics3D

Starting from what is read here, write the following code:

spring[r_, x1_, x2_] := Module[{m, n},
xvalues = Table[m, {m, x1, x2, (x2 - x1)/1000}];
yvalues = Table[r Sin[n Pi/2], {n, 0, 100, .1}];
zvalues = Table[r Cos[n Pi/2], {n, 0, 100, .1}];
Line[Transpose@{xvalues, yvalues, zvalues}]] /. Line -> Tube;

x[t_] := 10 Cos[t]
tmax = 15;
xmin = NMinValue[{x[t], 0 <= t <= tmax}, t];
xmax = NMaxValue[{x[t], 0 <= t <= tmax}, t];

Magnify[
Graphics3D[
{
spring[.2, xmin - .1, x[0]],
{LightGray, Sphere[{x[0], 0, 0}, .3]}
},
Axes -> {True, False, False},
Boxed -> False,
ImageSize -> {200, 200},
Lighting -> "Neutral",
PlotRange -> {{xmin - .1, xmax + .1}, {-1, 1}, {-1, 1}},
ViewPoint -> Above],
1.5]


you get:

Unfortunately, if I choose x[t_] := Cos[t] the result would be the following:

So the question is as follows: how can I do so to make the size of the graphic representation always equal and only change the x-axis scale?

Thank you!

• Inside frames you have to specify a fixed ImageSize. In addition to that (also inside frames) you should set ViewVertical (to control magnification) and PlotRangePadding.
– eldo
Aug 19 '17 at 13:06
• I have tried and are almost there. I just want the x-axis to be always equal like ImageSize, changing only the scale in it. It's possible? Thank you!
– TeM
Aug 19 '17 at 15:18
• Try AspectRatio->1/4 (inside frames)
– eldo
Aug 19 '17 at 19:08
• Unfortunately, by doing this the ball becomes oval and so on. I have tried to simplify the request so that we can concentrate on the essentials.
– TeM
Aug 20 '17 at 8:54