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
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/util_math.h')
-rw-r--r--intern/cycles/util/util_math.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index b7133582696..6fe1b2bcf54 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -296,19 +296,19 @@ __device_inline bool operator==(const int2 a, const int2 b)
return (a.x == b.x && a.y == b.y);
}
-__device_inline float length(const float2 a)
+__device_inline float len(const float2 a)
{
return sqrtf(dot(a, a));
}
__device_inline float2 normalize(const float2 a)
{
- return a/length(a);
+ return a/len(a);
}
-__device_inline float2 normalize_length(const float2 a, float *t)
+__device_inline float2 normalize_len(const float2 a, float *t)
{
- *t = length(a);
+ *t = len(a);
return a/(*t);
}
@@ -454,13 +454,14 @@ __device_inline float3 cross(const float3 a, const float3 b)
return r;
}
-__device_inline float length(const float3 a)
+#endif
+
+__device_inline float len(const float3 a)
{
return sqrtf(dot(a, a));
}
-#endif
-__device_inline float length_squared(const float3 a)
+__device_inline float len_squared(const float3 a)
{
return dot(a, a);
}
@@ -469,14 +470,14 @@ __device_inline float length_squared(const float3 a)
__device_inline float3 normalize(const float3 a)
{
- return a/length(a);
+ return a/len(a);
}
#endif
-__device_inline float3 normalize_length(const float3 a, float *t)
+__device_inline float3 normalize_len(const float3 a, float *t)
{
- *t = length(a);
+ *t = len(a);
return a/(*t);
}
@@ -786,14 +787,14 @@ __device_inline float dot(const float4& a, const float4& b)
return reduce_add(a * b);
}
-__device_inline float length(const float4 a)
+__device_inline float len(const float4 a)
{
return sqrtf(dot(a, a));
}
__device_inline float4 normalize(const float4 a)
{
- return a/length(a);
+ return a/len(a);
}
__device_inline float4 min(float4 a, float4 b)
@@ -1049,7 +1050,7 @@ template<class A, class B> A lerp(const A& a, const A& b, const B& t)
__device_inline float triangle_area(const float3 v1, const float3 v2, const float3 v3)
{
- return length(cross(v3 - v2, v1 - v2))*0.5f;
+ return len(cross(v3 - v2, v1 - v2))*0.5f;
}
#endif
@@ -1211,7 +1212,7 @@ __device bool ray_aligned_disk_intersect(
{
/* aligned disk normal */
float disk_t;
- float3 disk_N = normalize_length(ray_P - disk_P, &disk_t);
+ float3 disk_N = normalize_len(ray_P - disk_P, &disk_t);
float div = dot(ray_D, disk_N);
if(div == 0.0f)
@@ -1224,7 +1225,7 @@ __device bool ray_aligned_disk_intersect(
/* test if within radius */
float3 P = ray_P + ray_D*t;
- if(length_squared(P - disk_P) > disk_radius*disk_radius)
+ if(len_squared(P - disk_P) > disk_radius*disk_radius)
return false;
*isect_P = P;