Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-09-16 06:41:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-09-16 06:41:16 +0400
commit106ea0b20b216ebdc25e18742810aa1cf94ffa27 (patch)
tree0d00b39707233155c52ea09b7ee459d98798a497 /intern
parent13c5b0d54639123e7d35c1b3f71fc987ba78adef (diff)
Cleanup: sync map_to_sphere, UNLIKELY xy zero case
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/util/util_math.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 1e8d8f37d1e..c332e1709db 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -1419,10 +1419,12 @@ ccl_device bool map_to_sphere(float *r_u, float *r_v,
{
float len = sqrtf(x * x + y * y + z * z);
if(len > 0.0f) {
- if(x == 0.0f && y == 0.0f)
+ if(UNLIKELY(x == 0.0f && y == 0.0f)) {
*r_u = 0.0f; /* othwise domain error */
- else
+ }
+ else {
*r_u = (1.0f - atan2f(x, y) / M_PI_F) / 2.0f;
+ }
*r_v = 1.0f - safe_acosf(z / len) / M_PI_F;
return true;
}