diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-02-14 21:35:43 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-02-14 21:35:43 +0400 |
commit | e3944f5bfaffebe0f55df47db76515dd0ac7426b (patch) | |
tree | e116a941d1d0761a832a9765bc4af707e5e8c01c /source/blender/blenlib | |
parent | 7ae735dc4a9a6400ec33f01f7a409ed3710493b7 (diff) |
Divide by 3 instead of multiplying by variations of 0.333
Fixes small precision problems.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 1e1d97a35a4..7337718bd3c 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -39,9 +39,9 @@ void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3]) { - cent[0] = 0.33333f * (v1[0] + v2[0] + v3[0]); - cent[1] = 0.33333f * (v1[1] + v2[1] + v3[1]); - cent[2] = 0.33333f * (v1[2] + v2[2] + v3[2]); + cent[0] = (v1[0] + v2[0] + v3[0]) / 3.0f; + cent[1] = (v1[1] + v2[1] + v3[1]) / 3.0f; + cent[2] = (v1[2] + v2[2] + v3[2]) / 3.0f; } void cent_quad_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |