code for assignment 3
[MicroTrace.git] / InfinitePlane.cxx
index 54c9570..f73d835 100644 (file)
@@ -1,11 +1,11 @@
 #include "InfinitePlane.hxx"
 
 InfinitePlane::InfinitePlane(const Vec3f& a, const Vec3f& n, Shader* shader)
-  : Primitive(shader),
+  : Primitive(shader), 
     m_a(a),
     m_n(n)
 {
-
+  
 }
 
 InfinitePlane::~InfinitePlane()
@@ -17,15 +17,17 @@ InfinitePlane::Intersect(Ray& ray)
 {
   Vec3f diff = m_a - ray.origin();
   float t = diff.dot(m_n) / ray.direction().dot(m_n);
-  if (t < 1e-5 || t > ray.t())
+  if (t < Epsilon || t > ray.t()) 
     return false;
+  
   ray.setT(t);
+  ray.setHit(this);
+
   return true;
 }
 
 Vec3f
 InfinitePlane::GetNormal(Ray& ray)
 {
-  // We already have the surface normal
   return m_n;
 }
This page took 0.024054 seconds and 4 git commands to generate.