Manta Interactive Ray Tracer Development Mailing List

Text archives Help


Re: [Manta] r1833 - trunk/Model/Cameras


Chronological Thread 
  • From: Roni Choudhury <roni@cs.utah.edu>
  • To: "'manta@sci.utah.edu'" <manta@sci.utah.edu>
  • Subject: Re: [Manta] r1833 - trunk/Model/Cameras
  • Date: Wed, 07 Nov 2007 16:29:52 -0700

Does anyone want the Keep::Horizontal mode? It's kind of dumb. In real life when we enlarge film to be wider, we expect to see more scene on the left and right, not less of it on the top and bottom. And it might be simpler to give users just one option here- to do something about aspect ratio or not.

If someone confirms my feelings on this, I'll reduce the clutter in the code by eliminating the KeepHorizontal option and renaming everything appropriately.

roni

roni@sci.utah.edu wrote:
Author: roni
Date: Wed Nov  7 16:18:59 2007
New Revision: 1833

Modified:
   trunk/Model/Cameras/PinholeCamera.cc
Log:
Model/Cameras/PinholeCamera.cc

        Added "none" option to -maintainAspectRatio for completeness.

        Fixed problem with Camera::KeepHorizontal mode- it requires
        the inverse of the ratio used in the KeepVertical case.

        Replaced manual degree-to-radian conversion with utility
        function call.


Modified: trunk/Model/Cameras/PinholeCamera.cc
==============================================================================
--- trunk/Model/Cameras/PinholeCamera.cc        (original)
+++ trunk/Model/Cameras/PinholeCamera.cc        Wed Nov  7 16:18:59 2007
@@ -87,6 +87,8 @@
         aspectRatioMode = Camera::KeepHorizontal;
       else if(keep == "vertical")
         aspectRatioMode = Camera::KeepVertical;
+      else if(keep == "none")
+        aspectRatioMode = Camera::KeepNone;
       else
         throw IllegalArgument("PinholeCamera -maintainAspectRatio", i, args);
     } else {
@@ -130,12 +132,15 @@
   // This method modifies the "variable" fov to correctly reflect the
   // aspect ratio passed in.
+ float realRatio = ratio;
+
   const Real *inputAngle = 0;
   Real *outputAngle = 0;
   switch(aspectRatioMode){
   case Camera::KeepHorizontal:
     inputAngle = &hfov;
     outputAngle = &vfov;
+    realRatio = 1./ratio;
     break;
case Camera::KeepVertical:
@@ -148,7 +153,7 @@
     break;
   }
- *outputAngle = RtoD(2*atan(ratio*tan(DtoR(0.5*(*inputAngle)))));
+  *outputAngle = RtoD(2*atan(realRatio*tan(DtoR(0.5*(*inputAngle)))));
   setup();
// Choudhury: This is a hack to solve the initially non-square image
@@ -187,11 +192,11 @@
   u=Cross(v, direction);
   u.normalize();
- height=nearZ*tan(vfov*(Real)(0.5*M_PI/180.0));
+  height=nearZ*tan(DtoR(0.5*vfov));
   u*=height;
-  width=nearZ*tan(hfov*(Real)(0.5*M_PI/180.0));
-  v*=width;
+ width=nearZ*tan(DtoR(0.5*hfov));
+  v*=width;
 }
void PinholeCamera::makeRays(const RenderContext& context, RayPacket& rays) const





Archive powered by MHonArc 2.6.16.

Top of page