diff options
author | Anthony LaTorre <telatorre@gmail.com> | 2011-05-13 11:48:09 -0400 |
---|---|---|
committer | Anthony LaTorre <telatorre@gmail.com> | 2011-05-13 11:48:09 -0400 |
commit | ac21db3d6c1d33b4c97c810561ce7f3998a595b4 (patch) | |
tree | 01a1fa6d90b1dde06002982922b1a9da639ea08a /src | |
parent | 519acb39bdb1df9869bb17bcc710108ac8c02983 (diff) | |
download | chroma-ac21db3d6c1d33b4c97c810561ce7f3998a595b4.tar.gz chroma-ac21db3d6c1d33b4c97c810561ce7f3998a595b4.tar.bz2 chroma-ac21db3d6c1d33b4c97c810561ce7f3998a595b4.zip |
use floats
Diffstat (limited to 'src')
-rw-r--r-- | src/intersect.cu | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/intersect.cu b/src/intersect.cu index 8c2bf45..73b4483 100644 --- a/src/intersect.cu +++ b/src/intersect.cu @@ -24,24 +24,24 @@ __device__ bool intersect_triangle(const float3 &origin, const float3 &direction float determinant = det(m); - if (determinant == 0.0) + if (determinant == 0.0f) return false; float3 b = origin-v0; float u1 = ((m.a11*m.a22 - m.a12*m.a21)*b.x + (m.a02*m.a21 - m.a01*m.a22)*b.y + (m.a01*m.a12 - m.a02*m.a11)*b.z)/determinant; - if (u1 < 0.0) + if (u1 < 0.0f) return false; float u2 = ((m.a12*m.a20 - m.a10*m.a22)*b.x + (m.a00*m.a22 - m.a02*m.a20)*b.y + (m.a02*m.a10 - m.a00*m.a12)*b.z)/determinant; - if (u2 < 0.0) + if (u2 < 0.0f) return false; float u3 = ((m.a10*m.a21 - m.a11*m.a20)*b.x + (m.a01*m.a20 - m.a00*m.a21)*b.y + (m.a00*m.a11 - m.a01*m.a10)*b.z)/determinant; - if (u3 < 0.0 || (1-u1-u2) < 0.0) + if (u3 < 0.0f || (1-u1-u2) < 0.0f) return false; intersection = origin + direction*u3; @@ -61,7 +61,7 @@ __device__ bool intersect_box(const float3 &origin, const float3 &direction, con { float kmin, kmax, kymin, kymax, kzmin, kzmax; - if (direction.x >= 0.0) + if (direction.x >= 0.0f) { kmin = (lower_bound.x - origin.x)/direction.x; kmax = (upper_bound.x - origin.x)/direction.x; @@ -75,7 +75,7 @@ __device__ bool intersect_box(const float3 &origin, const float3 &direction, con if (kmax < kmin) return false; - if (direction.y >= 0.0) + if (direction.y >= 0.0f) { kymin = (lower_bound.y - origin.y)/direction.y; kymax = (upper_bound.y - origin.y)/direction.y; @@ -98,7 +98,7 @@ __device__ bool intersect_box(const float3 &origin, const float3 &direction, con if (kmin > kmax) return false; - if (direction.z >= 0.0) + if (direction.z >= 0.0f) { kzmin = (lower_bound.z - origin.z)/direction.z; kzmax = (upper_bound.z - origin.z)/direction.z; @@ -121,7 +121,7 @@ __device__ bool intersect_box(const float3 &origin, const float3 &direction, con if (kmin > kmax) return false; - if (kmax < 0.0) + if (kmax < 0.0f) return false; return true; |