1
$\begingroup$

How to prevent the Graphics3D object in following code from shaking when continuously changing the phi parameter?

(*magnetic field*)
magneticField = {Arrowheads[{{Small, 0.3}, {Small, 0.7}}], 
   Arrow /@ 
    Transpose@
     Flatten[Table[{i, 
          j, #}, {i, {-1.5, 0, 1.5}}, {j, {-1.5, 0, 1.5}}] & /@ {-3, 
        3}, {{1}, {2, 3}, {4}}]};
(*points of current*)
current[l_, θ_, ϕ_] := 
  current[2, 90 Degree, ϕ] = {-0.5 l {Sin[θ] Cos[ϕ], 
      Sin[θ] Sin[ϕ], Cos[θ]}, 
    0.5 l {Sin[θ] Cos[ϕ], Sin[θ] Sin[ϕ], 
      Cos[θ]}};
Manipulate[
 (*wire*)
 wire = {Blue, Arrowheads[{{Medium, 0.9}}], 
   Arrow[Tube@current[2, 90 Degree, phi]]};
 (*Ampere force*)
 force = {Red, Arrow[{{0, 0, 0}, 
     Cross[(#2 - #1) & @@ current[2, 90 Degree, phi], {0, 0, 1}]}]};
 (*graphics*)
 Graphics3D[{magneticField, wire, force}, Axes -> False, 
  SphericalRegion -> True, Boxed -> False]
 , {phi, 0, 2 π, 0.1 π}]

I actually tried setting ViewVector -> {{6, 6, 6}, {0, 0, 0}}. It worked, but it sacrificed the ability to maintain the viewpoint when phi is continuously changed.

So what are the proper options to prevent image from shaking when phi is continuously changed?

$\endgroup$
4
$\begingroup$

Add PlotRange -> {{-2, 2}, {-2, 2}, {-2, 2}} to your Graphics3D

$\endgroup$
  • $\begingroup$ Well...Axes->False blinded me... $\endgroup$ – Naitree Nov 3 '14 at 8:40

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.