AngRecSp.cpp (Tue Feb 4 1997 20:54:22)  printed by mikulik from PetrPC (Tue Feb 04 1997 20:54:25)  Page 1

/* ******************* AngRecSp.cpp *******************/ #include ¡math.h¿ #include ”AngRecSp.h”

1 Definitions

Approximate vs. exact formulae char RecSpaceNearOriginApprox = 1; extern double VelkeK; // I define it in ...I.h

2 Angular to reciprocal coordinates

Transformation (θ_{1}, θ_{2}) ⟶ (Q_{x}, Q_{z}). Note: it uses the global value VelkeK= \frac{2π}{λ}.

void QxQz˙ from˙ Theta1Theta2 (

double& Qx, double& Qz, double Theta1, double Theta2 ) – if (RecSpaceNearOriginApprox) –

Qz = VelkeK * ( Theta1 + Theta2 ); Q_{z} = K(θ_{1} + θ_{2}) Qx = Qz * ( Theta1 - Theta2 ) /2; Q_{x} = \frac{K}{2}(θ_{1}^{2} − θ_{2}^{2}) ˝

else – Qz = VelkeK * ( sin(Theta2)+sin(Theta1) ); Q_{z} = K(sin θ_{1} + sin θ_{2}) Qx = VelkeK * ( cos(Theta2)-cos(Theta1) ); Q_{x} = K(cos θ_{1} − cos θ_{2}) ˝

˝

3 Reciprocal to angular coordinates

Transformation (Q_{x}, Q_{z}) ⟶ (θ_{1}, θ_{2}). Note: it uses the global value VelkeK= \frac{2π}{λ}.

void Theta1Theta2˙ from˙ QxQz ( double& Theta1, double& Theta2, double Qx, double Qz) – if (Qz==0) – Theta1=Theta2=0; return; ˝ double sigma, delta; if (RecSpaceNearOriginApprox) –

θ_{1} = \frac{Q_{z}}{2K} + \frac{Q_{x}}{Q_{z}} θ_{2} = \frac{Q_{z}}{2K} − \frac{Q_{x}}{Q_{z}} sigma = Qz/(2*VelkeK); delta = Qx/Qz; Theta1=sigma+delta; Theta2=sigma-delta; ˝

else – θ_{1} = atan \frac{Q_{x}}{Q_{z}} − asin \frac{|Q|}{2K} θ_{2} = atan \frac{Q_{x}}{Q_{z}} + asin \frac{|Q|}{2K} sigma = asin ( sqrt( Qx*Qx+Qz*Qz ) / (2*VelkeK) ); delta = atan ( Qx/Qz ); Theta1=sigma-delta; Theta2=sigma+delta; ˝

˝ ;

// eof AngRecSp.cpp

4 Now some trip and trap test, nothing to do with X-rays:

/* 5 full line comment */

/* 6 full line comment which is veeerry looong ze by se nam z toho chtelo
straslive moc plakat, ne? */

/* ţ — ! 7 ahojţline with comment

8 full line which is

*/

10 helemeSeNaNeho L^{A}TEX cau a tak nevim co si o tom mam myslit, TEXu. Ty prvni radek, druhy i treti radek by mohly byt OK? prvni radek, druhy i treti radek by mohly byt OK? snad jo? 11 helemeSeNaNeho L^{A}TEX cau a tak nevim co si o tom mam myslit, TEXu. Ty prvni radek, druhy i treti radek by mohly byt OK? prvni radek, druhy i treti radek by mohly byt OK? snad jo?