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:
authorCampbell Barton <ideasman42@gmail.com>2012-02-28 18:05:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-02-28 18:05:00 +0400
commited04c213745362fcab99cdda89343aca7cbb65e5 (patch)
treee1a6819df36bca9a884104882a2d146da1ba4c89 /source/blender/blenlib
parent150cedac5da7bfce5fdd7c621cb682d6f3e66c8b (diff)
code cleanup: use float vector size in function definitions, and const's where the values are unchanged.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_geom.h4
-rw-r--r--source/blender/blenlib/intern/BLI_kdtree.c7
-rw-r--r--source/blender/blenlib/intern/math_geom.c31
-rw-r--r--source/blender/blenlib/intern/math_rotation.c4
-rw-r--r--source/blender/blenlib/intern/scanfill.c2
5 files changed, 27 insertions, 21 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 61e34b7cb75..b46f79fb2e6 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -214,8 +214,8 @@ void box_minmax_bounds_m4(float min[3], float max[3],
/********************************** Mapping **********************************/
-void map_to_tube(float *u, float *v, const float x, const float y, const float z);
-void map_to_sphere(float *u, float *v, const float x, const float y, const float z);
+void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z);
+void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z);
/********************************** Normals **********************************/
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index 47c44629d65..6db21ec14a6 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -132,7 +132,7 @@ void BLI_kdtree_balance(KDTree *tree)
tree->root= kdtree_balance(tree->nodes, tree->totnode, 0);
}
-static float squared_distance(float *v2, float *v1, float *UNUSED(n1), float *n2)
+static float squared_distance(const float v2[3], const float v1[3], float *UNUSED(n1), float *n2)
{
float d[3], dist;
@@ -143,8 +143,11 @@ static float squared_distance(float *v2, float *v1, float *UNUSED(n1), float *n2
dist = dot_v3v3(d, d);
//if(n1 && n2 && (dot_v3v3(n1, n2) < 0.0f))
- if(n2 && (dot_v3v3(d, n2) < 0.0f))
+
+ /* can someone explain why this is done?*/
+ if(n2 && (dot_v3v3(d, n2) < 0.0f)) {
dist *= 10.0f;
+ }
return dist;
}
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index f418b87f37e..f903072afb9 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -2311,31 +2311,34 @@ void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], floa
/********************************** Mapping **********************************/
-void map_to_tube(float *u, float *v, const float x, const float y, const float z)
+void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z)
{
float len;
- *v = (z + 1.0f) / 2.0f;
+ *r_v = (z + 1.0f) / 2.0f;
- len= (float)sqrt(x*x+y*y);
- if(len > 0.0f)
- *u = (float)((1.0 - (atan2(x/len,y/len) / M_PI)) / 2.0);
- else
- *v = *u = 0.0f; /* to avoid un-initialized variables */
+ len = sqrtf(x * x + y * y);
+ if(len > 0.0f) {
+ *r_u = (float)((1.0 - (atan2(x/len,y/len) / M_PI)) / 2.0);
+ }
+ else {
+ *r_v = *r_u = 0.0f; /* to avoid un-initialized variables */
+ }
}
-void map_to_sphere(float *u, float *v, const float x, const float y, const float z)
+void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z)
{
float len;
- len= (float)sqrt(x*x+y*y+z*z);
+ len = sqrtf(x * x + y * y + z * z);
if(len > 0.0f) {
- if(x==0.0f && y==0.0f) *u= 0.0f; /* othwise domain error */
- else *u = (1.0f - atan2f(x,y) / (float)M_PI) / 2.0f;
+ if(x==0.0f && y==0.0f) *r_u= 0.0f; /* othwise domain error */
+ else *r_u = (1.0f - atan2f(x,y) / (float)M_PI) / 2.0f;
- *v = 1.0f - (float)saacos(z/len)/(float)M_PI;
- } else {
- *v = *u = 0.0f; /* to avoid un-initialized variables */
+ *r_v = 1.0f - (float)saacos(z/len)/(float)M_PI;
+ }
+ else {
+ *r_v = *r_u = 0.0f; /* to avoid un-initialized variables */
}
}
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 6337e30a54b..38bc4794135 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -80,7 +80,7 @@ void mul_qt_qtqt(float *q, const float *q1, const float *q2)
}
/* Assumes a unit quaternion */
-void mul_qt_v3(const float *q, float *v)
+void mul_qt_v3(const float q[4], float v[3])
{
float t0, t1, t2;
@@ -98,7 +98,7 @@ void mul_qt_v3(const float *q, float *v)
v[1]=t2;
}
-void conjugate_qt(float *q)
+void conjugate_qt(float q[4])
{
q[1] = -q[1];
q[2] = -q[2];
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 1e25d74cfb6..b828ae052f8 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -303,7 +303,7 @@ static void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* add pf2 to pf1 */
pf1->f= (pf1->f | pf2->f);
}
-static short testedgeside(float *v1, float *v2, float *v3)
+static short testedgeside(const float v1[3], const float v2[3], const float v3[3])
/* is v3 to the right of v1-v2 ? With exception: v3==v1 || v3==v2 */
{
float inp;