Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r806 - branches/vertical/Model/Primitives


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r806 - branches/vertical/Model/Primitives
  • Date: Tue, 27 Dec 2005 15:16:36 -0700 (MST)

Author: sparker
Date: Tue Dec 27 15:16:35 2005
New Revision: 806

Modified:
   branches/vertical/Model/Primitives/Parallelogram.cc
Log:
Since raypackets are never zero sized, change a for loop into a do loop to
eliminate a redundant compare/jump.  Makes a small difference.


Modified: branches/vertical/Model/Primitives/Parallelogram.cc
==============================================================================
--- branches/vertical/Model/Primitives/Parallelogram.cc (original)
+++ branches/vertical/Model/Primitives/Parallelogram.cc Tue Dec 27 15:16:35 
2005
@@ -52,7 +52,8 @@
     Point a(rays.getOrigin(0)-anchor);
     Real o1 = Dot(a, v1);
     Real o2 = Dot(a, v2);
-    for(int i=rays.begin();i<rays.end();i++){
+    int i = rays.begin();
+    do {
       Real dt=Dot(rays.getDirection(i), normal);
       if(Abs(dt) < (Real)1.e-6)
         continue;
@@ -69,9 +70,10 @@
 
       if(rays.hit(i, t, getMaterial(), this, getTexCoordMapper()))
         rays.scratchpad<Point>(i) = Point(a1, a2, 0);
-    }
+    } while(++i < rays.end());
   } else {
-    for(int i=rays.begin();i<rays.end();i++){
+    int i = rays.begin();
+    do {
       Vector dir = rays.getDirection(i);
       Real dt=Dot(dir, normal);
       if(Abs(dt) < (Real)1.e-6)
@@ -91,7 +93,7 @@
 
       if(rays.hit(i, t, getMaterial(), this, getTexCoordMapper()))
         rays.scratchpad<Point>(i) = Point(a1, a2, 0);
-    }
+    } while(++i < rays.end());
   }
 }
 




  • [MANTA] r806 - branches/vertical/Model/Primitives, sparker, 12/27/2005

Archive powered by MHonArc 2.6.16.

Top of page