libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd/cvd camera.h gl_helpers.h


From: Gerhard Reitmayr
Subject: [libcvd-members] libcvd/cvd camera.h gl_helpers.h
Date: Tue, 04 Nov 2008 12:52:15 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Gerhard Reitmayr <gerhard>      08/11/04 12:52:15

Modified files:
        cvd            : camera.h gl_helpers.h 

Log message:
        constness fixes for Camera::Linear and near, far plane for glOrtho

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/camera.h?cvsroot=libcvd&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/gl_helpers.h?cvsroot=libcvd&r1=1.39&r2=1.40

Patches:
Index: camera.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/camera.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- camera.h    29 Aug 2008 20:29:40 -0000      1.21
+++ camera.h    4 Nov 2008 12:52:15 -0000       1.22
@@ -49,15 +49,15 @@
     inline void save(std::ostream& os); 
 
     /// Fast linear projection for working out what's there
-    inline TooN::Vector<2> linearproject(const TooN::Vector<2>& camframe, 
double scale=1);
+    inline TooN::Vector<2> linearproject(const TooN::Vector<2>& camframe, 
double scale=1) const;
        /// Project from Euclidean camera frame to image plane
-    inline TooN::Vector<2> project(const TooN::Vector<2>& camframe); 
+    inline TooN::Vector<2> project(const TooN::Vector<2>& camframe) const;
        /// Project from image plane to a Euclidean camera
-    inline TooN::Vector<2> unproject(const TooN::Vector<2>& imframe); 
+    inline TooN::Vector<2> unproject(const TooN::Vector<2>& imframe) const;
     
     /// Get the derivative of image frame wrt camera frame at the last 
computed projection
     /// in the form \f$ \begin{bmatrix} \frac{\partial \text{im1}}{\partial 
\text{cam1}} & \frac{\partial \text{im1}}{\partial \text{cam2}} \\ 
\frac{\partial \text{im2}}{\partial \text{cam1}} & \frac{\partial 
\text{im2}}{\partial \text{cam2}} \end{bmatrix} \f$
-    inline TooN::Matrix<2,2> get_derivative();
+    inline TooN::Matrix<2,2> get_derivative() const;
 
     /// Get the motion of a point with respect to each of the internal camera 
parameters
     inline TooN::Matrix<num_parameters,2> get_parameter_derivs() const ;
@@ -75,10 +75,11 @@
        /// Returns the vector of camera parameters in the format
        /// \f$ \begin{pmatrix}f_u & f_v & u_0 & v_0 \end{pmatrix} \f$
     inline TooN::Vector<num_parameters>& get_parameters() {return 
my_camera_parameters;}
+    inline const TooN::Vector<num_parameters>& get_parameters() const {return 
my_camera_parameters;}
 
   private:
     TooN::Vector<num_parameters> my_camera_parameters; 
-    TooN::Vector<2> my_last_camframe;
+    mutable TooN::Vector<2> my_last_camframe;
   };
 
 
@@ -521,22 +522,22 @@
   os << my_camera_parameters;
 }
 
-inline TooN::Vector<2> Camera::Linear::linearproject(const TooN::Vector<2>& 
camframe, double scale){
+inline TooN::Vector<2> Camera::Linear::linearproject(const TooN::Vector<2>& 
camframe, double scale) const {
   return TooN::Vector<2>(scale * diagmult(camframe, 
my_camera_parameters.slice<0,2>()) + my_camera_parameters.slice<2,2>());
 }
 
-inline TooN::Vector<2> Camera::Linear::project(const TooN::Vector<2>& 
camframe){
+inline TooN::Vector<2> Camera::Linear::project(const TooN::Vector<2>& 
camframe) const {
   my_last_camframe = camframe;
   return TooN::Vector<2>(diagmult(camframe, my_camera_parameters.slice<0,2>()) 
+ my_camera_parameters.slice<2,2>());
 }
 
-inline TooN::Vector<2> Camera::Linear::unproject(const TooN::Vector<2>& 
imframe){
+inline TooN::Vector<2> Camera::Linear::unproject(const TooN::Vector<2>& 
imframe) const {
   my_last_camframe[0] = 
(imframe[0]-my_camera_parameters[2])/my_camera_parameters[0];
   my_last_camframe[1] = 
(imframe[1]-my_camera_parameters[3])/my_camera_parameters[1];
   return my_last_camframe;
 }
 
-TooN::Matrix<2,2> Camera::Linear::get_derivative(){
+TooN::Matrix<2,2> Camera::Linear::get_derivative() const {
   TooN::Matrix<2,2> result;
   result(0,0) = my_camera_parameters[0];
   result(1,1) = my_camera_parameters[1];

Index: gl_helpers.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/gl_helpers.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- gl_helpers.h        21 Jul 2008 12:56:21 -0000      1.39
+++ gl_helpers.h        4 Nov 2008 12:52:15 -0000       1.40
@@ -326,9 +326,9 @@
         /// n.b. You first need to set up the matrix environment yourself,
        /// e.g. glMatrixMode(GL_PROJECTION); glLoadIdentity();
        /// @param size ImageRef containing the size of the GL window.
-       inline void glOrtho( const CVD::ImageRef & size)
+       inline void glOrtho( const CVD::ImageRef & size, const double near = 
-1.0, const double far = 1.0)
        {
-                ::glOrtho(-0.375, size.x - 0.375, size.y - 0.375, -0.375, 
-1.0, 1.0);
+                ::glOrtho(-0.375, size.x - 0.375, size.y - 0.375, -0.375, 
near, far);
        }
 
        /// Sets up an ortho projection from a simple Vector<6>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]