diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-09 05:57:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-09 06:03:38 +0300 |
commit | 1898c1f05cd38ea82f6da2ac3af07bab56537f3b (patch) | |
tree | 72c6f836b80f95864cd8c0fefa544a9c3d9682e4 /source/blender/blenlib/intern/math_geom_inline.c | |
parent | d7851b87a7f7f471f9b5c6813be5f66a7936b2ff (diff) |
Math Lib: add axis_dominant_v3_ortho_single
Diffstat (limited to 'source/blender/blenlib/intern/math_geom_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_geom_inline.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c index 44b17681540..68a2e68db4f 100644 --- a/source/blender/blenlib/intern/math_geom_inline.c +++ b/source/blender/blenlib/intern/math_geom_inline.c @@ -199,6 +199,17 @@ MINLINE int axis_dominant_v3_single(const float vec[3]) ((y > z) ? 1 : 2)); } +/* the dominant axis of an orthogonal vector */ +MINLINE int axis_dominant_v3_ortho_single(const float vec[3]) +{ + const float x = fabsf(vec[0]); + const float y = fabsf(vec[1]); + const float z = fabsf(vec[2]); + return ((x < y) ? + ((x < z) ? 0 : 2) : + ((y < z) ? 1 : 2)); +} + MINLINE int max_axis_v3(const float vec[3]) { const float x = vec[0]; |