Skip to main content
deleted 87 characters in body
Source Link
LCarvalho
  • 9.3k
  • 5
  • 40
  • 97

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_, \[Theta]_θ_, \[Phi]_]ϕ_] := 
  current[2, 90 Degree, \[Phi]]ϕ] = {-0.5 l {Sin[\[Theta]]Sin[θ] Cos[\[Phi]]Cos[ϕ], 
      Sin[\[Theta]]Sin[θ] Sin[\[Phi]]Sin[ϕ], Cos[\[Theta]]Cos[θ]}, 
    0.5 l {Sin[\[Theta]]Sin[θ] Cos[\[Phi]]Cos[ϕ], Sin[\[Theta]]Sin[θ] Sin[\[Phi]]Sin[ϕ], 
      Cos[\[Theta]]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 \[Pi]π, 0.1 \[Pi]π}]

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?

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_, \[Theta]_, \[Phi]_] := 
  current[2, 90 Degree, \[Phi]] = {-0.5 l {Sin[\[Theta]] Cos[\[Phi]], 
      Sin[\[Theta]] Sin[\[Phi]], Cos[\[Theta]]}, 
    0.5 l {Sin[\[Theta]] Cos[\[Phi]], Sin[\[Theta]] Sin[\[Phi]], 
      Cos[\[Theta]]}};
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 \[Pi], 0.1 \[Pi]}]

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?

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?

Tweeted twitter.com/#!/StackMma/status/529146081901154304
Source Link
Naitree
  • 1.2k
  • 9
  • 21

Image shaking when Manipulate with slider

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_, \[Theta]_, \[Phi]_] := 
  current[2, 90 Degree, \[Phi]] = {-0.5 l {Sin[\[Theta]] Cos[\[Phi]], 
      Sin[\[Theta]] Sin[\[Phi]], Cos[\[Theta]]}, 
    0.5 l {Sin[\[Theta]] Cos[\[Phi]], Sin[\[Theta]] Sin[\[Phi]], 
      Cos[\[Theta]]}};
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 \[Pi], 0.1 \[Pi]}]

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?