diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-24 06:25:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-24 06:25:00 +0400 |
commit | 2da6039e63afa783d8c3c784ac5743dc876e7236 (patch) | |
tree | f0808cc6e8e8bfedc652f96f2dd2a05953b9dbf2 /source/blender/blenlib/intern/math_geom_inline.c | |
parent | 9055ec3e0ae16b28dd95236ddfffbe5f8250e9fe (diff) |
rename axis_primary_v3() to max_axis_v3() to avoid confusion with axis_dominant_v3(). also add min_axis_v3().
Diffstat (limited to 'source/blender/blenlib/intern/math_geom_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_geom_inline.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c index bbf6dc9dfc2..01585c93bc8 100644 --- a/source/blender/blenlib/intern/math_geom_inline.c +++ b/source/blender/blenlib/intern/math_geom_inline.c @@ -137,28 +137,24 @@ MINLINE void madd_sh_shfl(float r[9], const float sh[9], const float f) add_sh_shsh(r, r, tmp); } -MINLINE int axis_primary_v3(const float vec[3]) +MINLINE int max_axis_v3(const float vec[3]) { const float x = vec[0]; const float y = vec[1]; const float z = vec[2]; + return ((x > y) ? + ((x > z) ? 0 : 2) : + ((y > z) ? 1 : 2)); +} - if (x > y) { - if (x > z) { - return 0; - } - else { - return 2; - } - } - else { - if (y > z) { - return 1; - } - else { - return 2; - } - } +MINLINE int min_axis_v3(const float vec[3]) +{ + const float x = vec[0]; + const float y = vec[1]; + const float z = vec[2]; + return ((x < y) ? + ((x < z) ? 0 : 2) : + ((y < z) ? 1 : 2)); } #endif /* __MATH_GEOM_INLINE_C__ */ |