diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2020-07-19 21:16:39 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2020-07-19 21:16:39 +0300 |
commit | 383b4c07274cba538efac5571e7c519ff45f3e97 (patch) | |
tree | 7e96f93f96e525817f626ac62d96daab69147397 /source/blender/blenlib/BLI_mpq2.hh | |
parent | 41722bfaa6ea90291d0a616db1bbc5fca59bf2b4 (diff) |
Added floating filters to the initial plane-side tests in tri-tri intersect.
Needed an "abs" function for double3, so added it to all of the
float/double/mpq 2/3 types.
Diffstat (limited to 'source/blender/blenlib/BLI_mpq2.hh')
-rw-r--r-- | source/blender/blenlib/BLI_mpq2.hh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_mpq2.hh b/source/blender/blenlib/BLI_mpq2.hh index fc4702e4c01..e585c1d5a0a 100644 --- a/source/blender/blenlib/BLI_mpq2.hh +++ b/source/blender/blenlib/BLI_mpq2.hh @@ -131,6 +131,13 @@ struct mpq2 { return a * (1 - t) + b * t; } + static mpq2 abs(const mpq2 &a) + { + mpq_class abs_x = (a.x >= 0) ? a.x : -a.x; + mpq_class abs_y = (a.y >= 0) ? a.y : -a.y; + return mpq2(abs_x, abs_y); + } + static mpq_class distance(const mpq2 &a, const mpq2 &b) { return (a - b).length(); |