diff --git a/VirtualRobot/CMakeLists.txt b/VirtualRobot/CMakeLists.txt
index aad579fd4f258acd0f43845b7e7c652d442d07cc..6e4b359c39e8c6222c18b0b022e42b0866c71331 100644
--- a/VirtualRobot/CMakeLists.txt
+++ b/VirtualRobot/CMakeLists.txt
@@ -211,6 +211,7 @@ SET(SOURCES
     SphereApproximator.cpp
     Trajectory.cpp
     VirtualRobot.cpp
+    VirtualRobotChecks.cpp
     VirtualRobotException.cpp
     
     CollisionDetection/CDManager.cpp
@@ -401,6 +402,7 @@ SET(INCLUDES
     SphereApproximator.h
     Trajectory.h
     VirtualRobot.h
+    VirtualRobotChecks.h
     VirtualRobotException.h
     VirtualRobotImportExport.h
     VirtualRobotTest.h
diff --git a/VirtualRobot/VirtualRobotChecks.cpp b/VirtualRobot/VirtualRobotChecks.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b97ba6eaf834114c124dc2eefbf550bd03e5dbf9
--- /dev/null
+++ b/VirtualRobot/VirtualRobotChecks.cpp
@@ -0,0 +1,38 @@
+#include "VirtualRobotChecks.h"
+
+
+namespace VirtualRobot
+{
+
+    VirtualRobotCheckException::VirtualRobotCheckException(
+            const std::string& condition,
+            const std::string& file, int line, const std::string& function, 
+            const std::string& hint) :
+        VirtualRobotException(makeMsg(condition, file, line, function, hint))
+    {}
+    
+    std::string VirtualRobotCheckException::makeMsg(
+            const std::string& condition, 
+            const std::string& file, int line, const std::string& function, 
+            const std::string& hint,
+            const std::string& lhs, const std::string& rhs)
+    {
+        std::stringstream ss;
+        ss << "Condition '" << condition << "' failed.";
+        
+        if (!(lhs.empty() && rhs.empty()))
+        {
+            ss << "\n(lhs = " << lhs << ", rhs = " << rhs << ")";
+        }
+        
+        if (!hint.empty())
+        {
+            ss << "\n Hint: " << hint;
+        }
+        
+        ss << "\n(line " << line << " in " << function << "() in " << file << ")" ;
+        
+        return ss.str();
+    }
+
+}
diff --git a/VirtualRobot/VirtualRobotChecks.h b/VirtualRobot/VirtualRobotChecks.h
new file mode 100644
index 0000000000000000000000000000000000000000..a6f0e6c112eeaae5fd270e85689b6ff5e563569e
--- /dev/null
+++ b/VirtualRobot/VirtualRobotChecks.h
@@ -0,0 +1,115 @@
+#pragma once
+
+#include <sstream>
+
+#include "VirtualRobotException.h"
+
+
+namespace VirtualRobot
+{
+
+    class VIRTUAL_ROBOT_IMPORT_EXPORT VirtualRobotCheckException :
+            public VirtualRobotException
+    {
+    public:
+        
+        VirtualRobotCheckException(
+                const std::string& condition,
+                const std::string& filename, int line, const std::string& function,
+                const std::string& hint = "");
+        
+        template <typename LhsT, typename RhsT>
+        VirtualRobotCheckException(
+                const std::string& condition, const LhsT& lhs, const RhsT& rhs,
+                const std::string& filename, int line, const std::string& function,
+                const std::string& hint = "") :
+            VirtualRobotException(
+                makeMsg(condition, filename, line, function, toString(lhs), toString(rhs), hint))
+        {}
+        
+        
+    private:
+    
+        template <typename T>
+        static std::string toString(const T& t)
+        {
+            std::stringstream ss;
+            ss << t;
+            return ss.str();
+        }
+        
+        static std::string makeMsg(
+                const std::string& condition,
+                const std::string& file, int line, const std::string& function,
+                const std::string& hint = "",
+                const std::string& lhs = "", const std::string& rhs = "");
+        
+    };
+
+
+#define VR_CHECK_HINT(condition, hint) \
+    do { \
+        if( !(expression) ) { \
+            throw ::VirtualRobot::VirtualRobotCheckException( \
+                #condition, __FILE__, __LINE__, __FUNCTION__, hint); \
+        } \
+    } while(0);
+
+    
+#define VR_CHECK(condition) \
+    VR_CHECK_HINT(condition, "")
+
+    
+#define VR_CHECK_COMPARISON_HINT(lhs, rhs, cmp, hint) \
+    do { \
+        if( !(lhs cmp rhs) ) {\
+            throw ::VirtualRobot::VirtualRobotCheckException( \
+                #lhs " " #cmp " " #rhs, lhs, rhs, __FILE__, __LINE__, __FUNCTION__, hint); \
+        } \
+    } while(0)
+    
+    
+#define VR_CHECK_COMPARISON_HINT(lhs, rhs, cmp) \
+    VR_CHECK_HINT(lhs, rhs, cmp, "")
+    
+
+
+#define VR_CHECK_EQUAL(lhs, rhs)                    VR_CHECK_COMPARISION(lhs, rhs, ==)
+#define VR_CHECK_EQUAL_HINT(lhs, rhs, hint)         VR_CHECK_COMPARISION(lhs, rhs, ==, hint)
+    
+#define VR_CHECK_NOT_EQUAL(lhs, rhs)                VR_CHECK_COMPARISION(lhs, rhs, !=)
+#define VR_CHECK_NOT_EQUAL_HINT(lhs, rhs, hint)     VR_CHECK_COMPARISION(lhs, rhs, !=, hint)
+
+    
+#define VR_CHECK_LESS(lhs, rhs)                     VR_CHECK_COMPARISION(lhs, rhs, <)
+#define VR_CHECK_LESS_HINT(lhs, rhs, hint)          VR_CHECK_COMPARISION(lhs, rhs, <, hint)
+    
+#define VR_CHECK_LESS_EQUAL(lhs, rhs)               VR_CHECK_COMPARISION(lhs, rhs, <=)
+#define VR_CHECK_LESS_EQUAL_HINT(lhs, rhs, hint)    VR_CHECK_COMPARISION(lhs, rhs, <=, hint)
+
+    
+#define VR_CHECK_GREATER(lhs, rhs)                  VR_CHECK_COMPARISION(lhs, rhs, >)
+#define VR_CHECK_GREATER_HINT(lhs, rhs, hint)       VR_CHECK_COMPARISION(lhs, rhs, >, hint)
+
+#define VR_CHECK_GREATER_EQUAL(lhs, rhs)            VR_CHECK_COMPARISION(lhs, rhs, >=)
+#define VR_CHECK_GREATER_EQUAL_HINT(lhs, rhs, hint) VR_CHECK_COMPARISION(lhs, rhs, >=, hint)
+
+    
+#define VR_CHECK_NONNEGATIVE(value)                 VR_CHECK_GREATER_EQUAL(value, 0)
+#define VR_CHECK_NONNEGATIVE_HINT(value, hint)      VR_CHECK_GREATER_EQUAL(value, 0, hint)
+
+#define VR_CHECK_POSITIVE(value)                    VR_CHECK_GREATER(value, 0)
+#define VR_CHECK_POSITIVE_HINT(value, hint)         VR_CHECK_GREATER(value, 0, hint)
+    
+    
+#define VR_CHECK_FITS_SIZE(value, size) \ 
+    VR_CHECK_NONNEGATIVE(value); \
+    VR_CHECK_LESS(value, size)
+    
+#define VR_CHECK_FITS_SIZE_HINT(value, size, hint) \ 
+    VR_CHECK_NONNEGATIVE(value, hint); \
+    VR_CHECK_LESS(value, size, hint)
+
+
+
+}
diff --git a/VirtualRobot/VirtualRobotException.h b/VirtualRobot/VirtualRobotException.h
index 041347b41c00dd21cb699d1066cf1be03b9451f2..770b7436cc3f5753895cef1f44fc1205607d33f4 100644
--- a/VirtualRobot/VirtualRobotException.h
+++ b/VirtualRobot/VirtualRobotException.h
@@ -62,13 +62,22 @@ namespace VirtualRobot
  * The reported message is composed of the line number and the file in which
  * the throw occurred and is followed by the \a messageString parameter.
  */
-#define THROW_VR_EXCEPTION(messageString) do{std::stringstream s; s << __FILE__ << ":" << __LINE__ << ": " << BOOST_CURRENT_FUNCTION << ": " << messageString; std::string er = s.str(); throw VirtualRobot::VirtualRobotException(er);}while(0);
+#define THROW_VR_EXCEPTION(messageString) \
+    do { \
+        std::stringstream s; \
+        s << __FILE__ << ":" << __LINE__ << ": " << BOOST_CURRENT_FUNCTION << ": " << messageString; \
+        std::string er = s.str(); throw VirtualRobot::VirtualRobotException(er); \
+    } while(0);
 
 /**
  * This macro checks \a condition and calls THROW_VR_EXCEPTION
  * with the parameter \a messageString if the condition is true.
  */
-#define THROW_VR_EXCEPTION_IF(condition, messageString) do{if (condition) THROW_VR_EXCEPTION(messageString);}while(0);
+#define THROW_VR_EXCEPTION_IF(condition, messageString) \
+    do { \
+        if (condition) \
+            THROW_VR_EXCEPTION(messageString); \
+    } while(0);
 
 #ifdef WIN32
 #pragma warning(default:4275)