From 30c9628f43e8c2003c1871d56420013e48d85466 Mon Sep 17 00:00:00 2001 From: ganovelli Date: Thu, 7 Oct 2004 14:22:38 +0000 Subject: [PATCH] y axis reverse in projecting (!) --- vcg/math/camera.h | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/vcg/math/camera.h b/vcg/math/camera.h index 1d1a1028..0817b46c 100644 --- a/vcg/math/camera.h +++ b/vcg/math/camera.h @@ -23,6 +23,9 @@ /**************************************************************************** History $Log: not supported by cvs2svn $ +Revision 1.2 2004/10/05 19:04:25 ganovelli +version 5-10-2004 in progress + Revision 1.1 2004/09/15 22:58:05 ganovelli re-creation @@ -46,9 +49,6 @@ creation // opengl #include -// TMP -#include - namespace vcg{ template @@ -84,25 +84,13 @@ public: /// project a point from space 3d (in the reference system of the camera) to the camera's plane /// the result is in absolute coordinates inline vcg::Point2 Project(const vcg::Point3 & p); - - /// return the projection matrix for opengl -/// inline vcg::Matrix44 MatrixGL(S,vcg::Matrix44 &); - - /// apply opengl transformation -/// inline void TransformGL(S far) const; }; template vcg::Point2 Camera::Project(const vcg::Point3 & p){ - ::QMessageBox mb; - char t[200]; - sprintf(t,"%f %f %f",p[0],p[1],p[2]); - mb.setText(t); - mb.exec(); - S tx = p.X(); - S ty = -p.Y(); + S ty = p.Y(); S qx,qy; vcg::Point2 q; // nota: per le camere ortogonali viewportM vale 1 @@ -111,6 +99,8 @@ vcg::Point2 Camera::Project(const vcg::Point3 & p){ tx *= f/p.Z(); ty *= f/p.Z(); + qx = tx; + qy = ty; //undistorted_to_distorted_sensor_coord(tx,ty,qx,qy); q[0] = qx/s.X()+c.X(); @@ -121,10 +111,6 @@ vcg::Point2 Camera::Project(const vcg::Point3 & p){ q[0] = tx/(s.X()*viewportM)+c.X(); q[1] = ty/(s.Y()*viewportM)+c.Y(); } - - sprintf(t,"%f %f",q[0],q[1]); - mb.setText(t); - mb.exec(); return q; }