diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-28 12:27:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-28 13:40:14 +0400 |
commit | 918ad1719f5ece6cd1da9cc3c0933620b83a2526 (patch) | |
tree | 9c11c50e200f7a205ca545ec6628e9228f35656c /source/blender/blenlib/BLI_utildefines.h | |
parent | 47a8b38e5356356b19a51723a4efcc173063dad5 (diff) |
Transform: improve normal orientation
- when 3 verts are selected ensure the normal is flipped on the side of existing vert normals.
also use the most distant 2 verts to define the tangent.
- when 2 vertices are selected, the normal wasn't aligned with the vert normal.
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 9bf720c03ea..0f7c0ac0fd8 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -56,6 +56,15 @@ #define MAX3(x, y, z) (MAX2(MAX2((x), (y)), (z))) #define MAX4(x, y, z, a) (MAX2(MAX2((x), (y)), MAX2((z), (a)))) +/* min/max that return a value of our choice */ +#define MAX3_PAIR(cmp_a, cmp_b, cmp_c, ret_a, ret_b, ret_c) \ + ((cmp_a > cmp_b) ? ((cmp_a > cmp_c) ? ret_a : ret_c) : \ + ((cmp_b > cmp_c) ? ret_b : ret_c)) + +#define MIN3_PAIR(cmp_a, cmp_b, cmp_c, ret_a, ret_b, ret_c) \ + ((cmp_a < cmp_b) ? ((cmp_a < cmp_c) ? ret_a : ret_c) : \ + ((cmp_b < cmp_c) ? ret_b : ret_c)) + #define INIT_MINMAX(min, max) { \ (min)[0] = (min)[1] = (min)[2] = 1.0e30f; \ (max)[0] = (max)[1] = (max)[2] = -1.0e30f; \ |