diff options
author | Stan Seibert <stan@mtrr.org> | 2011-12-21 11:30:29 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:38 -0700 |
commit | e150de0d229401b045bf17cd5a1b658f69b2230c (patch) | |
tree | ea489cb5c887310e3cfa23f7b4b767ab4910f30d | |
parent | 04400903076e88d99cdd769de5504d7e259a1ffe (diff) | |
download | chroma-e150de0d229401b045bf17cd5a1b658f69b2230c.tar.gz chroma-e150de0d229401b045bf17cd5a1b658f69b2230c.tar.bz2 chroma-e150de0d229401b045bf17cd5a1b658f69b2230c.zip |
Use the sincosf() function when computing both the sin() and cos() of the same angle for greater efficiency.
-rw-r--r-- | chroma/cuda/photon.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chroma/cuda/photon.h b/chroma/cuda/photon.h index 371c122..ff2868a 100644 --- a/chroma/cuda/photon.h +++ b/chroma/cuda/photon.h @@ -127,10 +127,10 @@ __device__ float3 pick_new_direction(float3 axis, float theta, float phi) { // Taken from SNOMAN rayscatter.for - float cos_theta = cosf(theta); - float sin_theta = sinf(theta); - float cos_phi = cosf(phi); - float sin_phi = sinf(phi); + float cos_theta, sin_theta; + sincosf(theta, &sin_theta, &cos_theta); + float cos_phi, sin_phi; + sincosf(phi, &sin_phi, &cos_phi); float sin_axis_theta = sqrt(1.0f - axis.z*axis.z); float cos_axis_phi, sin_axis_phi; |