+// clamp a value to lie between min and max
+template <class T>
+inline void SG_CLAMP_RANGE(T &x, const T min, const T max ) {
+ if ( x < min ) { x = min; }
+ if ( x > max ) { x = max; }
+}
+
+// normalize a value to lie between min and max
+template <class T>
+inline void SG_NORMALIZE_RANGE( T &val, const T min, const T max ) {
+ T step = max - min;
+ while( val >= max ) val -= step;
+ while( val < min ) val += step;
+}
+
+// avoid an 'unused parameter' compiler warning.
+#define SG_UNUSED(x) (void)x
+
+// easy way to disable the copy constructor and assignment operator
+// on an object
+#define SG_DISABLE_COPY(Class) \
+ Class(const Class &); \
+ Class &operator=(const Class &);
+