I want to draw three vectors inside a spherical shell. One of the vectors will be moving, the others will be stationary. However, the animation is the next step. For now, I would like to get the vectors drawn.

The three vectors need to go from the origin to the surface of the sphere. I am using an external program to create a list of angles that change with Temperature and these vectors represent an external magnetic field and easy axis. Those two angles are stationary, one perfectly vertical (along the z-axis) another at phi = pi/4. The third will change, but, can be stationary drawing. Obviously r is constant since they go to the surface.

I tried Show[Graphics3D[Sphere[{0, 0, 0}]], Boxed -> False], but I would prefer something more transparent with axes at the origin not outside the sphere.

Something like this with two more vectors and 3D:

enter image description here

  • $\begingroup$ Please provide more details. As it is, it's unclear what you really want. Vectors pointing from the origin to the surface of the sphere? Vectors tangent to the sphere? Random vectors or particular ones? Anyway, look at Graphics3D and cousins. $\endgroup$
    – march
    Jan 28, 2016 at 21:18
  • $\begingroup$ all three vectors from origin to the surface of the sphere $\endgroup$
    – Joseph
    Jan 28, 2016 at 21:25
  • 1
    $\begingroup$ Please edit your post with the new details (and include more details about how they should be oriented, etc.). Also make sure to read the documentation on Graphics3D and Arrow in particular. There should be plenty of examples in the documentation of how to do this. $\endgroup$
    – march
    Jan 28, 2016 at 21:27
  • $\begingroup$ You may be interested in my answer here as an example of how to do it. $\endgroup$
    – Jens
    Jan 28, 2016 at 22:09

1 Answer 1

 Graphics3D[{{Opacity[0.5], Sphere[]}, 
   {EdgeForm[{Dashed, Red}], 
    FaceForm[None], Cylinder[{{0, 0, -.001}, {0, 0, .001}}]}, 
   {Dashed, Line[{{0, 0, 0}, {1, 0, 0}}]}, 
   {Dashed, Line[{{0, 0, 0}, {0, 1, 0}}]}, 
   {Dashed, Line[{{0, 0, 0}, {0, 0, 1}}]}, 
   Arrow[{{1, 0, 0}, {1.3, 0, 0}}], 
   Arrow[{{0, 1, 0}, {0, 1.3, 0}}], 
   Arrow[{{0, 0, 1}, {0, 0, 1.3}}], 
   Text[Style["x", 18], {1.4, 0, 0}], 
   Text[Style["y", 18], {0, 1.4, 0}], 
   Text[Style["z", 18], {0, 0, 1.4}], 
   Text[Style["r", 18, Red], .5 {Cos[θ] Sin[φ], Sin[θ] Sin[φ], Cos[φ]}], 
   {Red, Arrow[{{0, 0, 0}, {Cos[θ] Sin[φ], 
    Sin[θ] Sin[φ], Cos[φ]}}]}}, 
  Boxed -> False], 
  {θ, 0, 2 π}, 
  {{φ, .3}, 0, π}]

enter image description here

  • $\begingroup$ This is the perfect starting point! Thank you! I will work with this and get it setup the way I need before asking anything else. $\endgroup$
    – Joseph
    Jan 28, 2016 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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