4 triple b = (.31,.95,0);
5 triple c = (.4,.5,0.76);
7 currentprojection=orthographic(2 * (-0.5*X+Y+.5*Z)+ 3*Z + Y, target=3*Z+Y);
12 // orthonormal coordinates
13 draw(Label("$\vec{x}$", 1), (-3*X)--(X), gray, Arrow3());
14 draw(Label("$\vec{y}$", 1), (-Y)--(Y), gray, Arrow3());
15 draw(Label("$\vec{z}$", 1), (-2*Z)--(2*Z), gray, Arrow3());
18 // La construction d'Ewald
19 void ewald(triple ki, real gamma, real delta, real alpha, real phi)
22 triple kf = rotate(gamma, Z) * rotate(-delta, Y) * ki;
24 triple n = rotate(phi, Y) * rotate(alpha, X) * scale3(length(Q)) * Y;
26 // incomming and outgoing beam
27 draw(Label("$\vec{k_i}$", .5, S), shift(-ki)*(O--ki), blue, Arrow3());
28 draw(Label("$\vec{k_f}$"), shift(-ki)*(O--kf), green, Arrow3());
31 draw(Label("$\vec{Q}$", 1), O--Q, red, Arrow3());
34 draw(Label("$\vec{n}$", 1), O--n, orange, Arrow3());
37 draw(Label("$\tau$"), arc(O, Q, n), red, ArcArrow3());
40 draw(Label("$\psi$", .5, E), circle(Q, .2k, Q), red, ArcArrow3);
43 surface Ewalds = shift(-ki) * rotate(90, Y) * scale3(k) * unithemisphere;
44 draw(Ewalds, green+opacity(0.3), render(compression=Zero,merge=true));
48 ewald(2*X, -30, 40, 60, -60);