Thanks to those (Heike, Jens, MrWizard, and R.M.) who helped me yesterday with figuring out how to plot an EM wave. Now I am running into trouble with the Show
command. I am trying to combine three Graphics3D objects:
- a slab
- a grating, and
- a wave.
The wave is supposed to be comparable in size with the grating and it should fall on it from the top (like light would fall on a grating). Show
puts these together as a GIANT giant slab with grating and a puny EM wave.
The problem is that Mathematica puts all objects' coordinate axes origin to the same point. How can I control the relative placement and sizes of these objects in Show
?
My code follows:
(*
sw = slab width, sh = slab height, gw = grid width, gh =
grid height, cw = channel width, sl = slab length, EM1s =
strentgth of EM wave 1, EM1f = frequency of EM wave 1
*)
sw = 38; sh = 4; gw = 3; gh = 4; cw = 6; sl = 7 gw + 6 cw;
grating = Graphics3D[{RGBColor[0.917, 0.082, 0.478],
Cuboid[{{0, 0, sh}, {sw, gw, sh + gh}}],
Cuboid[{{0, gw + cw, sh}, {sw, 2 gw + cw, sh + gh}}],
Cuboid[{{0, 2 (gw + cw), sh}, {sw, 3 gw + 2 cw, sh + gh}}],
Cuboid[{{0, 3 (gw + cw), sh}, {sw, 4 gw + 3 cw, sh + gh}}],
Cuboid[{{0, 4 (gw + cw), sh}, {sw, 5 gw + 4 cw, sh + gh}}],
Cuboid[{{0, 5 (gw + cw), sh}, {sw, 6 gw + 5 cw, sh + gh}}],
Cuboid[{{0, 6 (gw + cw), sh}, {sw, 7 gw + 6 cw, sh + gh}}]},
Boxed -> False];
slab = Graphics3D[{RGBColor[0.101, 0.701, 0.623],
Cuboid[{0, 0, 0}, {sw, sl, sh}]}, Boxed -> False
];
EM1s = 1; EM1f = 3; x1 = 2 Pi;
pts1 = Table[{t (x1/(2 Pi)), -EM1s Sin[EM1f t (x1/(2 Pi))], 0}, {t, 0,
2 Pi, 0.03}];
pts2 = {#, 0, -#2} & @@@ pts1;
EMw1 = Graphics3D[{Thickness[0.007],
{RGBColor[0.439, 0.188, 0.627], Line[pts1]},
{RGBColor[1, 0.721, 0.039], Line[pts2]}, Thickness[0.002],
Line[{#, # {1, 0, 1}}] & /@ pts1[[;; ;; 3]],
RGBColor[1, 0.721, 0.039],
Line[{#, # {1, 1, 0}}] & /@ pts2[[;; ;; 3]]},
AxesOrigin -> {0, 0, 0}, Axes -> {True, False, False},
Ticks -> None,
AxesStyle ->
Directive[Thickness[0.0075], RGBColor[0.439, 0.188, 0.627]],
Boxed -> False];
Show[slab, grating, EMw1, Axes -> False, Boxed -> False,
ImageSize -> {400, 520}, PlotRange -> All]