Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1409 - trunk/Core/Geometry


Chronological Thread 
  • From: boulos@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1409 - trunk/Core/Geometry
  • Date: Mon, 4 Jun 2007 21:54:22 -0600 (MDT)

Author: boulos
Date: Mon Jun  4 21:54:21 2007
New Revision: 1409

Modified:
   trunk/Core/Geometry/Vector.h
Log:
Using more robust Vector perpendicularTo... 
Manta probably needs to support real coordinate
frames.


Modified: trunk/Core/Geometry/Vector.h
==============================================================================
--- trunk/Core/Geometry/Vector.h        (original)
+++ trunk/Core/Geometry/Vector.h        Mon Jun  4 21:54:21 2007
@@ -267,7 +267,7 @@
       data[2] *= scalar;
       return *this;
     }
-    
+
     // / operator
     Vector operator/(const Vector& v) const {
       Vector result;
@@ -417,6 +417,7 @@
       float a0 = SCIRun::Abs(data[0]);
       float a1 = SCIRun::Abs(data[1]);
       float a2 = SCIRun::Abs(data[2]);
+#if 0
       if(a0 < a1){
         if(a0 < a2){
           // 0 smallest
@@ -442,6 +443,20 @@
           result.data[2] = 0;
         }
       }
+#else
+      ComponentType d_2sqr = data[2] * data[2];
+      ComponentType d_1sqr = data[1] * data[1];
+      if ( d_2sqr + d_1sqr < ComponentType(1e-4)) {
+         // use d_0
+         result.data[0] = -data[2];
+         result.data[1] = 0;
+         result.data[2] = data[0];
+      } else {
+         result.data[0] = 0;
+         result.data[1] = data[2];
+         result.data[2] = -data[1];
+      }
+#endif
       return result;
     }
 
@@ -459,7 +474,7 @@
     friend Vector Max(const Vector& v1, const Vector& v2);
     friend Vector Interpolate(const Vector& v1, const Vector& v2, Real 
weight);
 #endif
-    
+
     //private:
     Real data[3];
 
@@ -552,7 +567,7 @@
                   Interpolate(v1.data[2], v2.data[2], weight[2]));
     return result;
   }
-  
+
   std::ostream& operator<< (std::ostream& os, const Vector& v);
   std::istream& operator>> (std::istream& is,       Vector& v);
 }




  • [MANTA] r1409 - trunk/Core/Geometry, boulos, 06/04/2007

Archive powered by MHonArc 2.6.16.

Top of page