From 383b4c07274cba538efac5571e7c519ff45f3e97 Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Sun, 19 Jul 2020 14:16:39 -0400 Subject: 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. --- source/blender/blenlib/BLI_mpq2.hh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/blenlib/BLI_mpq2.hh') 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(); -- cgit v1.2.3