# OpenGl Z-Order Equivalent in Mathematica?

I am trying to draw the arrows in this picture on top of the two parallel plates. In OpenGL I would just set the 4th coordinate the z-order to be closer. Any ideas how to draw them on top in mathematica?

R0 = .5;
Rl = 12;
Rw = 1;
or = {-0.5, 0, -0.}
ArrLen = 2;
(*vp=Options[Graphics3D,ViewPoint][[1,2]];*)
vp = {2.172860287784637, -2.2696686904229137, 1.2558989630867607};
Graphics3D[{(*EdgeForm[Thickness[0.002]],*)
(*Top Plate*)
{Gray, Opacity[1],  Polygon[{{0, -Rw, R0}, {0, Rw, R0}, {Rl, Rw, R0}, {Rl, -Rw, R0}}]},
(*Bottom Plate*)
{Gray, Polygon[{{0, -Rw, -R0}, {0, Rw, -R0}, {Rl, Rw, -R0}, {Rl, -Rw, -R0}}]},
(*Arrow E*)
{Red, Arrow[ Tube[{or + {#, 0, 0}, or + {#, 0, ArrLen*Sin[(2 \[Pi])/Rl #]} }]] & /@
Table[x, {x, 0, Rl, Rl/12}]},
(*Arrow H*)
{Green,  Arrow[Tube[{or + {#, 0, 0}, or + {#, ArrLen*Cos[(2 \[Pi])/Rl #], 0} }]] & /@
Table[x, {x, 0, Rl, Rl/12}]}
}, Boxed -> False, ViewPoint -> Dynamic[vp], ImageSize -> 400]

-

I don't believe you can influence the z-buffer of graphics directives directly so that they don't cover each other. One solution, if I understood your question correctly, would be to move the arrows in the direction of the view vector. First your code where I assign the image to gr:

R0 = .5;
Rl = 12;
Rw = 1;
or = {-0.5, 0, -0.};
ArrLen = 2;
vp = {2.172860287784637, -2.2696686904229137, 1.2558989630867607};
gr = Graphics3D[{(*EdgeForm[Thickness[
0.002]],*)(*Top Plate*){Gray, Opacity[1],
Polygon[{{0, -Rw, R0}, {0, Rw, R0}, {Rl, Rw, R0}, {Rl, -Rw,
R0}}]},(*Bottom Plate*){Gray,
Polygon[{{0, -Rw, -R0}, {0, Rw, -R0}, {Rl,
Rw, -R0}, {Rl, -Rw, -R0}}]},(*Arrow E*){Red,
Arrow[Tube[{or + {#, 0, 0},
or + {#, 0, ArrLen*Sin[(2 \[Pi])/Rl #]}}]] & /@
Table[x, {x, 0, Rl, Rl/12}]},(*Arrow H*){Green,
Arrow[Tube[{or + {#, 0, 0},
or + {#, ArrLen*Cos[(2 \[Pi])/Rl #], 0}}]] & /@
Table[x, {x, 0, Rl, Rl/12}]}}, Boxed -> False,
ViewPoint -> Dynamic[vp], ImageSize -> 400];


And then you can try something like the following. Please note, that you can adjust the zoom (which is altered when moving the arrows) with the ViewAngle option:

moveAlong[pt_, v_, l_] := pt + Normalize[v]*l

Manipulate[
gr /. Tube[{p1_, p2_}] :>
Tube[{moveAlong[p1, vp, l], moveAlong[p2, vp, l]}],
{l, 0, 10}]


-
can you provide the full code, Its not quite working here – AimForClarity Apr 2 '13 at 0:58
+1 interesting problem and solution. I wonder if setting Opacity for the plates would help. @AimForClarity – Vitaliy Kaurov Apr 2 '13 at 1:08
@halirutan thanks :) i think what i missed is the ViewAngle Option. – AimForClarity Apr 2 '13 at 4:28
@VitaliyKaurov Thanks :) i tried that but not the same effect – AimForClarity Apr 2 '13 at 4:28