summaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 21:23:42 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 21:23:42 +0200
commit10c9d92cd2581448d76548efb20957a7a1c24478 (patch)
tree5f039656bc78cd2a882b872548c340de8ea5263c /src/math
parent51884cef8e015bccbe1fa96dc56dc2f32439ccc5 (diff)
downloadcolobot-10c9d92cd2581448d76548efb20957a7a1c24478.tar.gz
colobot-10c9d92cd2581448d76548efb20957a7a1c24478.tar.bz2
colobot-10c9d92cd2581448d76548efb20957a7a1c24478.zip
Mouse wheel events, motion vectors
- added mouse wheel events - added motion vectors to CRobotMain - other minor changes in event.h
Diffstat (limited to 'src/math')
-rw-r--r--src/math/vector.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/math/vector.h b/src/math/vector.h
index eb54a5b..222d0cd 100644
--- a/src/math/vector.h
+++ b/src/math/vector.h
@@ -267,4 +267,14 @@ inline float Distance(const Math::Vector &a, const Math::Vector &b)
(a.z-b.z)*(a.z-b.z) );
}
+//! Clamps the vector \a vec to range between \a min and \a max
+inline Vector Clamp(const Vector &vec, const Vector &min, const Vector &max)
+{
+ Vector clamped;
+ clamped.x = Min(Max(min.x, vec.x), max.x);
+ clamped.y = Min(Max(min.y, vec.y), max.y);
+ clamped.z = Min(Max(min.z, vec.z), max.z);
+ return clamped;
+}
+
}; // namespace Math