summaryrefslogtreecommitdiff
path: root/src/rotate.h
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-09-08 11:38:18 -0400
committerStan Seibert <stan@mtrr.org>2011-09-08 11:38:18 -0400
commit3defeae5de899b315928f1b518fe2ff75662d430 (patch)
treeeefd3114a10284db2eaec4d2b6358ba1c97bb965 /src/rotate.h
parent7cae8c3b343d1bde0320ff2ea224cc1ef79889df (diff)
parentc7c161179a0a26dc9b4e3acdbc61a48803fa00e7 (diff)
downloadchroma-3defeae5de899b315928f1b518fe2ff75662d430.tar.gz
chroma-3defeae5de899b315928f1b518fe2ff75662d430.tar.bz2
chroma-3defeae5de899b315928f1b518fe2ff75662d430.zip
merge
Diffstat (limited to 'src/rotate.h')
-rw-r--r--src/rotate.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/rotate.h b/src/rotate.h
index 7fc6f7e..15f8037 100644
--- a/src/rotate.h
+++ b/src/rotate.h
@@ -6,21 +6,22 @@
__device__ const Matrix IDENTITY_MATRIX = {1,0,0,0,1,0,0,0,1};
-__device__ __host__ Matrix make_rotation_matrix(float phi, const float3 &n)
+__device__ Matrix
+make_rotation_matrix(float phi, const float3 &n)
{
- /* rotate points counterclockwise, when looking towards +infinity,
- through an angle `phi` about the axis `n`. */
+ float cos_phi = cosf(phi);
+ float sin_phi = sinf(phi);
- float cos_phi = cosf(phi);
- float sin_phi = sinf(phi);
-
- return IDENTITY_MATRIX*cos_phi + (1-cos_phi)*outer(n,n) +
- sin_phi*make_matrix(0,n.z,-n.y,-n.z,0,n.x,n.y,-n.x,0);
+ return IDENTITY_MATRIX*cos_phi + (1-cos_phi)*outer(n,n) +
+ sin_phi*make_matrix(0,n.z,-n.y,-n.z,0,n.x,n.y,-n.x,0);
}
-__device__ __host__ float3 rotate(const float3 &a, float phi, const float3 &n)
+/* rotate points counterclockwise, when looking towards +infinity,
+ through an angle `phi` about the axis `n`. */
+__device__ float3
+rotate(const float3 &a, float phi, const float3 &n)
{
- return make_rotation_matrix(phi,n)*a;
+ return make_rotation_matrix(phi,n)*a;
}
#endif