code for assignment 3
[MicroTrace.git] / Vec3f.cxx
index f656d29..7c39435 100644 (file)
--- a/Vec3f.cxx
+++ b/Vec3f.cxx
@@ -211,3 +211,15 @@ Vec3f::operator[](unsigned int i)
   assert(i < 3);
   return m_values[i];
 }
+
+void
+Vec3f::clamp()
+{
+  for(unsigned int i = 0; i < 3; ++i)
+    {
+      if(m_values[i] < 0.0)
+       m_values[i] = 0.0;
+      if(m_values[i] > 1.0)
+       m_values[i] = 1.0;
+    }
+}
This page took 0.020597 seconds and 4 git commands to generate.