diff options
author | Thomas White <taw@physics.org> | 2011-06-06 19:09:40 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:27 +0100 |
commit | 0427a9f2407af935be590b094ed4c518d7d2dc54 (patch) | |
tree | 8037ca02d8745cfc34e03f2b399a57411b5325fd /data/diffraction.cl | |
parent | b5cf39959f971132bfbd4d73878f86c026deb96a (diff) |
Add divergence to CPU version as well
Diffstat (limited to 'data/diffraction.cl')
-rw-r--r-- | data/diffraction.cl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/data/diffraction.cl b/data/diffraction.cl index ec3d528f..e58f16a2 100644 --- a/data/diffraction.cl +++ b/data/diffraction.cl @@ -37,6 +37,7 @@ float4 get_q(float fs, float ss, float res, float clen, float k, float4 q; float xs, ys; float kx, ky, kz; + float kxn, kyn, kzn; xs = fs*fsx + ss*ssx; ys = fs*fsy + ss*ssy; @@ -51,17 +52,18 @@ float4 get_q(float fs, float ss, float res, float clen, float k, az = atan2(ry, rx); - kx = k*native_sin(tt)*native_cos(az); - ky = k*native_sin(tt)*native_sin(az); - kz = k*(native_cos(tt)-1.0); + kxn = k*native_sin(tt)*native_cos(az); + kyn = k*native_sin(tt)*native_sin(az); + kzn = k*(native_cos(tt)-1.0); /* x divergence */ - kx = kx*cos(xdiv) +kz*sin(xdiv); - kz = -kx*sin(xdiv) +kz*cos(xdiv); + kx = kxn*cos(xdiv) +kzn*sin(xdiv); + kz = -kxn*sin(xdiv) +kzn*cos(xdiv); + kxn = kx; kzn = kz; /* y divergence */ - ky = ky*cos(ydiv) +kz*sin(ydiv); - kz = -ky*sin(ydiv) +kz*cos(ydiv); + ky = kyn*cos(ydiv) +kzn*sin(ydiv); + kz = -kyn*sin(ydiv) +kzn*cos(ydiv); q = (float4)(kx, ky, kz, 0.0); |