[doc] fix figure generation with asy
[hkl.git] / Documentation / figures / zaxis.asy
blob24951b78d9df6f7204386dc8efab07da9d202362
1 import solids;
3 currentprojection=orthographic(1,0,0);
4 currentlight=White;
6 size(300,0);
8 real k = 2;
9 real delta = 30;
10 real gamma = 10;
11 real mu = 10;
13 // points
14 triple C = unit((-1, 0, 0)) * k;
15 triple O = O;
16 triple P1 = rotate(-delta, Y) * rotate(gamma, Z) * (-C) + C;
18 // vectors
19 triple ki = -C;
20 triple kf = P1 - C;
22 // Planes
23 pen bg = gray(0.9) + opacity(0.5);
25 real r = 1.5;
26 pen p = rgb(0,0.7,0);
27 draw( Label("$x$",1), O--r*X, p, Arrow3(HookHead3));
28 draw( Label("$y$",1), O--r*Y, p, Arrow3(HookHead3));
29 draw( Label("$z$",1), O--r*Z, p, Arrow3(HookHead3));
30 label("$O$", (0,0,0), W);
32 // draw the ki vector
33 path3 ki_p = shift(C) * (O--ki);
34 draw(Label("$\vec{k_i}$", .5), ki_p, red, Arrow3);
36 // kf
37 path3 kf_p = shift(C) * (O--kf);
38 draw(Label("$\vec{k_f}$", .5), kf_p, red, Arrow3);
40 // Q
41 path3 Q_p = O--P1;
42 draw(Label("$\vec{Q}$", .5), Q_p, red, Arrow3);
44 // draw the dots
45 dot("$C$", C, p);
46 dot("$P_1$", P1, blue);
48 // rotation plan define by the rotation axis
49 triple omega = rotate(mu, Z) * -Y;
50 draw( Label("$\Omega$", 1), O--omega, blue, Arrow3(HookHead3));
52 // circle generated by the revolution of P around omega
53 triple C1 = planeproject(omega, P1) * O;
54 triple C2 = planeproject(omega, P1) * ki;
55 dot("$C_1$", C1, blue);
56 draw(O--C1, dashed+blue);
57 path3 Pcircle = circle(C1, length(P1-C1), omega);
58 draw(Pcircle, dashed+blue);
60 // Ewalds sphere
61 surface Ewalds = shift(C) * scale3(k) * unitsphere;
62 draw(Ewalds, green+opacity(0.3), render(compression=Zero,merge=true));
64 // intersection points of this Cricle with the Ewalds sphere
65 // and the arc, ATTENTION problem de precision lors du calcul
66 // des intersections. Pour l'instant ne pas utiliser delta > 160
67 triple P2 = rotate(180, C1, C2) * P1;
68 path3 Parc = arc(C1, P1, P2, omega, CW);
69 draw(C1--P1, blue);
70 dot("$P_2$", P2, blue);
71 draw(C1--P2, blue);
72 draw(Parc, blue, Arrows3());