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:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2005-01-09 03:06:45 +0300
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2005-01-09 03:06:45 +0300
commit4f2e57a5410c13ccf63532cdc0e67a299ba2410d (patch)
treef011ee91f8853be13d3af63b15aed27fb1f54c32 /intern/moto/include/MT_Scalar.h
parent5ea2ed38e76c5da7b801d77f659567784f6c7390 (diff)
Fix bug #2006:
Floating point imprecision made MT_Quaternion::angle return NaN, since acos(x) is NaN for |x| > 1. Because of the way NaN's propagate through float math, the view pos would be set to [NaN, NaN, NaN] resulting in a grey screen.
Diffstat (limited to 'intern/moto/include/MT_Scalar.h')
-rwxr-xr-xintern/moto/include/MT_Scalar.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/intern/moto/include/MT_Scalar.h b/intern/moto/include/MT_Scalar.h
index 0a72a52c20e..6ee0948f244 100755
--- a/intern/moto/include/MT_Scalar.h
+++ b/intern/moto/include/MT_Scalar.h
@@ -83,5 +83,13 @@ inline MT_Scalar MT_random() {
return MT_Scalar(MT_rand()) / MT_Scalar(MT_RAND_MAX);
}
+inline MT_Scalar MT_clamp(const MT_Scalar x, const MT_Scalar min, const MT_Scalar max)
+{
+ if (x < min)
+ return min;
+ else if (x > max)
+ return max;
+ return x;
+}
#endif