diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel.cu | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/kernel.cu b/src/kernel.cu index be0087d..82efe88 100644 --- a/src/kernel.cu +++ b/src/kernel.cu @@ -62,27 +62,39 @@ __device__ __noinline__ void to_diffuse(Photon &p, State &s, curandState &rng, c extern "C" { -/* Translate `points` by the vector `v` */ -__global__ void translate(int nthreads, float3 *points, float3 v) +/* Translate the points `a` by the vector `v` */ +__global__ void translate(int nthreads, float3 *a, float3 v) { int id = blockIdx.x*blockDim.x + threadIdx.x; if (id >= nthreads) return; - points[id] += v; + a[id] += v; } -/* Rotate `points` through an angle `phi` counter-clockwise about the +/* Rotate the points `a` through an angle `phi` counter-clockwise about the axis `axis` (when looking towards +infinity). */ -__global__ void rotate(int nthreads, float3 *points, float phi, float3 axis) +__global__ void rotate(int nthreads, float3 *a, float phi, float3 axis) { int id = blockIdx.x*blockDim.x + threadIdx.x; if (id >= nthreads) return; - points[id] = rotate(points[id], phi, axis); + a[id] = rotate(a[id], phi, axis); +} + +__global__ void rotate_around_point(int nthreads, float3 *a, float phi, float3 axis, float3 point) +{ + int id = blockIdx.x*blockDim.x + threadIdx.x; + + if (id >= nthreads) + return; + + a[id] -= point; + a[id] = rotate(a[id], phi, axis); + a[id] += point; } __global__ void update_xyz_lookup(int nthreads, int total_threads, int offset, float3 position, curandState *rng_states, float wavelength, float3 xyz, float3 *xyz_lookup1, float3 *xyz_lookup2, int max_steps) |