Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_mpq2.hh')
-rw-r--r--source/blender/blenlib/BLI_mpq2.hh7
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();