1
$\begingroup$

I want to put a label in the three arrowheads on the top. I tryed with "VertexLabel" but I don't know how this command works.enter image description here

CampoB = 1;
AFLorentz = 1;
MovimentoX = 0 ;
ring[z_] := 
  Graphics3D[
   Rotate[Arrow@
     Table[{Cos[u] - MovimentoX, Sin[u], z}, {u, 0, 2 \[Pi], 
       2 \[Pi]/30}], {{-1, 0, 0}, {1, 0, 0}}], Boxed -> False];

RingSet = Show[Table[myring[z], {z, -7, 1, 2}]];

FLorentz = 
  Arrow[{{0 + MovimentoX, 0, 8}, {AFLorentz + MovimentoX, 0, 8}}];

Cilindro = 
  Graphics3D[{{Red, Opacity[0.1], 
     Cylinder[{{0 + MovimentoX, 0, -1}, {0 + MovimentoX, 0, 7}}, 
      1]}, {Thickness[0.01], Arrowheads[{0, .03}], FLorentz, 
     Arrow[{{0 + MovimentoX, 0, 8}, {0 + MovimentoX, -0 - CampoB, 
        8}}], Arrow[{{0 + MovimentoX, 0, -1}, {0 + MovimentoX, 0, 
        10}}]}}];

Imagem = Show[Cilindro, RingSet, 
  PlotRange -> {{-5, 5}, {-3, 3}, {-1, 10}}, ImageSize -> Large, 
  ViewPoint -> {-2, -1.5, 1.7}]

The part of code wich is drawing the three arrows on the the top are:

"FLorentz = Arrow[{{0 + MovimentoX, 0, 8}, {AFLorentz + MovimentoX, 0, 8}}];"

and inside "Cilindro =", "Arrow[{{0 + MovimentoX, 0, 8}, {0 + MovimentoX, -0 - CampoB, 8}}], Arrow[{{0 + MovimentoX, 0, -1}, {0 + MovimentoX, 0, 10}}]}}]"

$\endgroup$
2
$\begingroup$

It depends on how you want these labels drawn? Do you want them to be 3D objects and rotate accordingly? Or you just need them always face the camera?

For the second case the Text[] is what you need (I replaced myring with ring):

Cilindro = 
  Graphics3D[{{Red, Opacity[0.1], 
     Cylinder[{{0 + MovimentoX, 0, -1}, {0 + MovimentoX, 0, 7}}, 
      1]}, {Thickness[0.01], Arrowheads[{0, .03}], FLorentz, 
     Text["X", {0.2 + AFLorentz + MovimentoX, 0, 8}], 
     Arrow[{{0 + MovimentoX, 0, 8}, {0 + MovimentoX, -0 - CampoB, 
        8}}], Text["Y", {MovimentoX, -0 - CampoB - 0.2, 8}], 
     Arrow[{{0 + MovimentoX, 0, -1}, {0 + MovimentoX, 0, 10}}], 
     Text["Z", {0, 0, 10.2}]}}];

enter image description here

For the first case you can actually construct labels (to be artistic?)

moveScale[pos_, scale_] := #*scale + pos &;
zLabel[pos_, size_] := 
  Tube[moveScale[pos, 
     size] /@ {{-1, 0, 1}, {1, 0, 1}, {-1, 0, -1}, {1, 0, -1}}, 
   0.2*size];
xLabel[pos_, 
   size_] := {Tube[
    moveScale[pos, size] /@ {{-0.5, 0, 1}, {0.5, 0, -1}}, 0.2*size], 
   Tube[moveScale[pos, size] /@ {{0.5, 0, 1}, {-0.5, 0, -1}}, 
    0.2*size]};
yLabel[pos_, 
   size_] := {Tube[
    moveScale[pos, size] /@ {{-0.5, 0, 1}, {0.0, 0, 0}}, 0.2*size], 
   Tube[moveScale[pos, size] /@ {{0.5, 0, 1}, {-0.5, 0, -1}}, 
    0.2*size]};

Cilindro = 
  Graphics3D[{{Green, zLabel[{0.5, 0, 9.5}, 0.1]}, {Red, 
     xLabel[{0.2 + AFLorentz + MovimentoX, 0, 8}, 0.1]},
    {Blue, yLabel[{MovimentoX, -0 - CampoB - 0.2, 8}, 0.1]}, {Red, 
     Opacity[0.1], 
     Cylinder[{{0 + MovimentoX, 0, -1}, {0 + MovimentoX, 0, 7}}, 
      1]}, {Thickness[0.01], Arrowheads[{0, .03}], FLorentz, 
     Arrow[{{0 + MovimentoX, 0, 8}, {0 + MovimentoX, -0 - CampoB, 
        8}}], Arrow[{{0 + MovimentoX, 0, -1}, {0 + MovimentoX, 0, 
        10}}]}}];

Imagem = Show[Cilindro, RingSet, 
  PlotRange -> {{-5, 5}, {-3, 3}, {-1, 10}}, ImageSize -> Large, 
  ViewPoint -> {-2, -1.5, 1.7}]

Now your "labels" will rotate accordingly. enter image description here

$\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.