diff options
| author | Anthony LaTorre <devnull@localhost> | 2012-12-21 11:46:24 -0500 |
|---|---|---|
| committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:39 -0700 |
| commit | 79e3643283034e1923c2a84fe0c4d0eb52b97570 (patch) | |
| tree | 3c41502f8f99b51940f31ef20afedb56f08927ab /chroma/cuda | |
| parent | 581f4305ffe86cb42d5bcaa9bf081e6ea4abceca (diff) | |
| download | chroma-79e3643283034e1923c2a84fe0c4d0eb52b97570.tar.gz chroma-79e3643283034e1923c2a84fe0c4d0eb52b97570.tar.bz2 chroma-79e3643283034e1923c2a84fe0c4d0eb52b97570.zip | |
rotate() does not need to create a matrix. update test. remove superflous function in last commit.
Diffstat (limited to 'chroma/cuda')
| -rw-r--r-- | chroma/cuda/rotate.h | 11 | ||||
| -rw-r--r-- | chroma/cuda/transform.cu | 11 |
2 files changed, 11 insertions, 11 deletions
diff --git a/chroma/cuda/rotate.h b/chroma/cuda/rotate.h index 15f8037..f93abcc 100644 --- a/chroma/cuda/rotate.h +++ b/chroma/cuda/rotate.h @@ -21,6 +21,17 @@ make_rotation_matrix(float phi, const float3 &n) __device__ float3 rotate(const float3 &a, float phi, const float3 &n) { + float cos_phi = cosf(phi); + float sin_phi = sinf(phi); + + return a*cos_phi + n*dot(a,n)*(1.0f-cos_phi) + cross(a,n)*sin_phi; +} + +/* rotate points counterclockwise, when looking towards +infinity, + through an angle `phi` about the axis `n`. */ +__device__ float3 +rotate_with_matrix(const float3 &a, float phi, const float3 &n) +{ return make_rotation_matrix(phi,n)*a; } diff --git a/chroma/cuda/transform.cu b/chroma/cuda/transform.cu index 1c5a6cb..1f4405e 100644 --- a/chroma/cuda/transform.cu +++ b/chroma/cuda/transform.cu @@ -31,17 +31,6 @@ rotate(int nthreads, float3 *a, float phi, float3 axis) a[id] = rotate(a[id], phi, axis); } -__global__ void -rotate_(int nthreads, float3 *a, float phi, float3 axis) -{ - int id = blockIdx.x*blockDim.x + threadIdx.x; - - if (id >= nthreads) - return; - - a[id] = rotate(a[id], phi, axis); -} - /* Rotate the points `a` through an angle `phi` counter-clockwise (when looking towards +infinity along `axis`) about the axis defined by the point `point` and the vector `axis` . */ |
