OverviewOutlinesTool.cpp

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00022 #include <GL/glew.h>
00023 #ifdef __WXMAC__
00024 #include <OpenGL/gl.h>
00025 #include <OpenGL/glu.h>
00026 #else
00027 #include <GL/gl.h>
00028 #include <GL/glu.h>
00029 #endif
00030 #ifdef __APPLE__
00031   #include <GLUT/glut.h>
00032 #endif
00033 
00034 #include "OverviewOutlinesTool.h"
00035 #include "GLViewer.h"
00036 
00037 #include "GreatCircles.h"
00038 #include <cfloat>
00039 
00040 const double OverviewOutlinesTool::res=10;
00041 const double OverviewOutlinesTool::mindist=2;
00042 
00043 OverviewOutlinesTool::OverviewOutlinesTool(ToolHelper * helper, GLViewer * viewer) : thelper(helper),
00044     dirty_meshes(true), preview(viewer),
00045     display_list_number_canvas(glGenLists(1)),
00046     display_list_number_crop(glGenLists(1)),
00047     display_list_number_canvas_outline(glGenLists(1)),
00048     display_list_number_crop_outline(glGenLists(1))
00049 {
00050     thelper->GetPanoramaPtr()->addObserver(this);
00051 }
00052 
00053 OverviewOutlinesTool::~OverviewOutlinesTool()
00054 {
00055 }
00056 
00057 void OverviewOutlinesTool::panoramaChanged(HuginBase::Panorama &pano)
00058 {
00059 
00060     dirty_meshes = true;
00061     thelper->GetVisualizationStatePtr()->ForceRequireRedraw();
00062     
00063 }
00064 
00065 
00066 struct Rec {
00067     Rec(double left, double top, double right, double bottom) : left(left), top(top), right(right), bottom(bottom) {}
00068     Rec() : left(0), top(0), right(0), bottom(0) {}
00069     double left;
00070     double top;
00071     double right;
00072     double bottom;
00073 };
00074 
00075 //#define WIREFRAME
00076 
00077 void PanosphereOverviewOutlinesTool::Activate()
00078 {
00079     static_cast<PanosphereOverviewToolHelper*>(helper)->NotifyMe(PanosphereOverviewToolHelper::DRAW_OVER_IMAGES_FRONT, this);
00080     static_cast<PanosphereOverviewToolHelper*>(helper)->NotifyMe(PanosphereOverviewToolHelper::DRAW_OVER_IMAGES_BACK, this);
00081 //    helper->NotifyMe(ToolHelper::DRAW_OVER_IMAGES, this);
00082     helper->NotifyMe(ToolHelper::MARK_DIRTY, this);
00083 }
00084 
00085 
00086 void PlaneOverviewOutlinesTool::Activate()
00087 {
00088     (helper)->NotifyMe(ToolHelper::DRAW_OVER_IMAGES, this);
00089     helper->NotifyMe(ToolHelper::MARK_DIRTY, this);
00090 }
00091 
00092 void PlaneOverviewOutlinesTool::AfterDrawImagesEvent()
00093 {
00094     draw();
00095 }
00096 
00097 void PanosphereOverviewOutlinesTool::AfterDrawImagesBackEvent()
00098 {
00099     draw();
00100 }
00101 
00102 void PanosphereOverviewOutlinesTool::AfterDrawImagesFrontEvent()
00103 {
00104     draw();
00105 }
00106 
00107 void PanosphereOverviewOutlinesTool::drawBackground()
00108 {
00109 
00110     double radius = static_cast<PanosphereOverviewVisualizationState*>(helper->GetVisualizationStatePtr())->getSphereRadius();
00111     GLUquadric* grid = gluNewQuadric();
00112     gluSphere(grid, radius+1,40,20);
00113 
00114 }
00115 
00116 void PanosphereOverviewOutlinesTool::MarkDirty()
00117 {
00118     dirty_meshes = true;
00119 }
00120 
00121 void PlaneOverviewOutlinesTool::drawBackground()
00122 {
00123 
00124     glBegin(GL_QUADS);
00125 
00126     double end = 1000000;
00127 
00128     glVertex3f(-end, end, 0);
00129     glVertex3f( end, end, 0);
00130     glVertex3f( end,-end, 0);
00131     glVertex3f(-end,-end, 0);
00132 
00133     glEnd();
00134 
00135 }
00136 
00137 void PlaneOverviewOutlinesTool::MarkDirty()
00138 {
00139     dirty_meshes = true;
00140 }
00141 
00142 void OverviewOutlinesTool::draw()
00143 {
00144 
00145     if (!(preview->m_visualization_state)) {
00146         return;
00147     }
00148 
00149 
00150     if (dirty_meshes) {
00151 
00152 //    std::cout << "outlines after draw images\n";
00153 //        vigra::Rect2D trect = preview->m_visualization_state->GetVisibleArea();
00154 //        double hscale, wscale;
00155 //        hscale = (float) thelper->GetVisualizationStatePtr()->GetOptions()->getHeight() / (float) preview->m_visualization_state->GetOptions()->getHeight();
00156 //        wscale =  (float) thelper->GetVisualizationStatePtr()->GetOptions()->getWidth() / (float) preview->m_visualization_state->GetOptions()->getWidth();
00157 //        std::cerr << "outlines " << hscale << " " << wscale << std::endl;
00158 //        std::cerr << "outlines " << trect.left() << " " << trect.top() << " " << trect.right() << " " << trect.bottom() << std::endl;
00159 //        vigra::Rect2D rect(trect.left() * wscale, trect.top() * hscale, trect.right() * wscale, trect.bottom() * hscale);
00160 //        std::cerr << "outlines " << rect.left() << " " << rect.top() << " " << rect.right() << " " << rect.bottom() << std::endl;
00161 
00162         vigra::Rect2D rect = preview->m_visualization_state->GetVisibleArea();
00163 
00164         glNewList(display_list_number_canvas,GL_COMPILE);
00165         DrawRect(rect.left(), rect.top(), rect.right(), rect.bottom(),false);
00166         glEndList();
00167         glNewList(display_list_number_canvas_outline,GL_COMPILE);
00168         DrawRect(rect.left(), rect.top(), rect.right(), rect.bottom(),true, 4.0);
00169         glEndList();
00170 
00171         vigra::Rect2D roi = thelper->GetViewStatePtr()->GetOptions()->getROI();
00172         glNewList(display_list_number_crop,GL_COMPILE);
00173         DrawRect(roi.left(), roi.top(), roi.right(), roi.bottom(),false);
00174         glEndList();
00175         glNewList(display_list_number_crop_outline,GL_COMPILE);
00176         DrawRect(roi.left(), roi.top(), roi.right(), roi.bottom(),true, 2.0);
00177         glEndList();
00178 
00179         dirty_meshes = false;
00180         
00181 //    std::cout << "outlines adi " << rect.left() << " " << rect.top() << " " << rect.right() << " " << rect.bottom() << std::endl;
00182 //    std::cout << "outlines adi " << roi.left() << " " << roi.top() << " " << roi.right() << " " << roi.bottom() << std::endl;
00183     }
00184 
00185     if (thelper->GetVisualizationStatePtr()->RequireRecalculateViewport()) {
00186 
00187         vigra::Rect2D rect = preview->m_visualization_state->GetVisibleArea();
00188         glNewList(display_list_number_canvas_outline,GL_COMPILE);
00189         DrawRect(rect.left(), rect.top(), rect.right(), rect.bottom(),true, 4.0);
00190         glEndList();
00191 
00192         vigra::Rect2D roi = thelper->GetViewStatePtr()->GetOptions()->getROI();
00193         glNewList(display_list_number_crop_outline,GL_COMPILE);
00194         DrawRect(roi.left(), roi.top(), roi.right(), roi.bottom(),true, 2.0);
00195         glEndList();
00196 
00197     }
00198 
00199 
00200     glDisable(GL_TEXTURE_2D);
00201 
00202     glEnable(GL_BLEND);
00203     glColor4f(0, 0, 0, 0.50f);
00204     glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
00205     drawBackground();
00206 
00207 
00208     glColor4f(1.0f, 1.0f, 1.0f, 0.20f);
00209     glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
00210     glCallList(display_list_number_canvas);
00211 
00212 //    std::cout << "outlines " << roi.left() << " " << roi.top() << " " << roi.right() << " " << roi.bottom() << std::endl;
00213 
00214     glColor4f(1.0f, 1.0f, 1.0f, 0.66f);
00215     glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
00216     glCallList(display_list_number_crop);
00217 
00218     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00219     glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
00220     glCallList(display_list_number_canvas_outline);
00221     glColor4f(0.8f, 0.8f, 0.8f, 0.6f);
00222     glCallList(display_list_number_crop_outline);
00223 
00224     glEnable(GL_TEXTURE_2D);
00225     glDisable(GL_BLEND);
00226     glColor4f(1,1,1,1);
00227 
00228 }
00229 
00230 void OverviewOutlinesTool::DrawRect(double left, double top, double right, double bottom, bool outline, double line_width)
00231 {
00232 
00233     vigra::Size2D size = thelper->GetVisualizationStatePtr()->GetOptions()->getSize();
00234     double mlength = (size->y > size->x) ? size->y : size->x;
00235 
00236     double fov = thelper->GetVisualizationStatePtr()->GetOptions()->getHFOV();
00237     
00238     //since res was initially estimated for size of 360x100;
00239     //TODO make res scale dependent
00240     double tres = res * mlength / fov;
00241     double tmindist = mindist * mlength / fov;
00242 
00243 //    std::cerr << "outlines " << mlength << std::endl;
00244 //    std::cerr << "outlines " << right << std::endl;
00245 
00246     double safety = 1;
00247     left += safety;
00248     top += safety;
00249     right -= safety;
00250     bottom -= safety;
00251 
00252     HuginBase::PTools::Transform transform;
00253     HuginBase::SrcPanoImage image;
00254 //    image.setSize(vigra::Size2D(360,180));
00255     image.setSize(size);
00256     image.setHFOV(fov);
00257     switch(thelper->GetVisualizationStatePtr()->GetOptions()->getProjection()) {
00258         case HuginBase::PanoramaOptions::EQUIRECTANGULAR:
00259             image.setProjection(HuginBase::BaseSrcPanoImage::EQUIRECTANGULAR);
00260             break;
00261         case HuginBase::PanoramaOptions::RECTILINEAR:
00262             image.setProjection(HuginBase::BaseSrcPanoImage::RECTILINEAR);
00263             break;
00264         default:
00265             DEBUG_ERROR("OverviewOutlinesTools: unknown projection")
00266             break;
00267     }
00268     
00269     transform.createTransform(image, *(preview->m_visualization_state->GetOptions()));
00270 
00271     HuginBase::PanoramaOptions::ProjectionFormat proj = thelper->GetViewStatePtr()->GetOptions()->getProjection();
00272 
00273     switch(proj) {
00274 
00275         case HuginBase::PanoramaOptions::SINUSOIDAL:
00276         case HuginBase::PanoramaOptions::LAMBERT:
00277         case HuginBase::PanoramaOptions::LAMBERT_AZIMUTHAL:
00278         case HuginBase::PanoramaOptions::HAMMER_AITOFF:
00279         case HuginBase::PanoramaOptions::FULL_FRAME_FISHEYE:
00280         case HuginBase::PanoramaOptions::ALBERS_EQUAL_AREA_CONIC:
00281         case HuginBase::PanoramaOptions::ORTHOGRAPHIC:
00282         case HuginBase::PanoramaOptions::EQUISOLID:
00283         case HuginBase::PanoramaOptions::THOBY_PROJECTION:
00284 
00285             {
00286 
00287             //in this case just the divide the base rectangle by a certain amount of steps
00288 
00289             float steps = 40;
00290 
00291             double wstep = (float)(right - left) / steps;
00292             double hstep = (float)(bottom - top) / steps;
00293             
00294             for(int w = 0 ; w < steps ; w++) {
00295             for(int h = 0 ; h < steps ; h++) {
00296 
00297                 //if outline is needed just consider edge cases
00298                 if (outline) {
00299                     if (!(w == 0 || h == 0 || w == steps - 1 || steps - 1)) {
00300                         continue;
00301                     }
00302                 }
00303 
00304                 Rect rec(left + w * wstep, top + h * hstep, left + (w+1) * wstep, top + (h+1)* hstep);
00305                 Rect tr = rec.transformImgCoord(&transform);
00306 
00307                //this section should be added to avoid certain problems with these projections 
00308                //(just disregard edges with lengths larger than some value with respect to the radius of the sphere)
00309                //TODO this was commented when support for mosaic plane was added, make this work again
00310                 // double edge1 = (tr.val[0][0]-tr.val[1][0])*(tr.val[0][0]-tr.val[1][0]) + (tr.val[0][1]-tr.val[1][1])*(tr.val[0][1]-tr.val[1][1]);
00311                 // double edge2 = (tr.val[1][0]-tr.val[2][0])*(tr.val[1][0]-tr.val[2][0]) + (tr.val[1][1]-tr.val[2][1])*(tr.val[1][1]-tr.val[2][1]);
00312                 // double edge3 = (tr.val[2][0]-tr.val[3][0])*(tr.val[2][0]-tr.val[3][0]) + (tr.val[2][1]-tr.val[3][1])*(tr.val[2][1]-tr.val[3][1]);
00313                 // double edge4 = (tr.val[3][0]-tr.val[0][0])*(tr.val[3][0]-tr.val[0][0]) + (tr.val[3][1]-tr.val[0][1])*(tr.val[3][1]-tr.val[0][1]);
00314 
00315 //                double maxlimit = (radius/2.0)*(radius/2.0);
00316 //                if (
00317 //                        proj == HuginBase::PanoramaOptions::SINUSOIDAL ||
00318 //                        proj == HuginBase::PanoramaOptions::ALBERS_EQUAL_AREA_CONIC
00319 //                    )
00320 //                if (edge1 > maxlimit || edge2 > maxlimit || edge3 > maxlimit || edge4 > maxlimit) {
00321 //                    continue;
00322 //                }
00323 
00324                 if (outline) {
00325 
00326 //                    glBegin(GL_LINES);
00327                     bool edges[4] = {false,false,false,false};
00328                     if (w == 0) {
00329                         edges[0] = true;
00330                     }
00331                     if (w == steps - 1) {
00332                         edges[2] = true;
00333                     }
00334                     if (h == 0) {
00335                         edges[3] = true;
00336                     }
00337                     if (h == steps - 1) {
00338                         edges[1] = true;
00339                     }
00340                     for (int i = 0 ; i < 4 ; i++) {
00341                         if (edges[i]) {
00342 
00343 
00344                             //draw a line with the help of the GreatCircles class so that a mesh is drawn instead of just a line
00345                             int plus = i+1;
00346                             if (plus == 4) plus = 0;
00347                             hugin_utils::FDiff2D cd1(tr.val[i][0], tr.val[i][1]);
00348                             hugin_utils::FDiff2D cd2(tr.val[plus][0], tr.val[plus][1]);
00349                             GreatCircleArc::LineSegment line;
00350                             line.vertices[0] = cd1;
00351                             line.vertices[1] = cd2;
00352                             line.doGL(line_width, thelper->GetVisualizationStatePtr());
00353 
00354 
00355 //                            for (int j = 0 ; j < 2 ; j++) {
00356 //                                int plus = i+j;
00357 //                                if (plus == 4) plus = 0;
00358 //                                double x,y,z;
00359 //                                double tx,ty;
00360 //                                tx = tr.val[plus][0];
00361 //                                ty = tr.val[plus][1];
00367 //                                hugin_utils::FDiff2D cd(tx,ty);
00368 //                                MeshManager::MeshInfo::Coord3D coord = thelper->GetVisualizationStatePtr()->GetMeshManager()->GetCoord3D(cd);
00369 //                                glVertex3f(coord.x,coord.y,coord.z);
00370 //                            }
00371 
00372                         }
00373                     }
00374 //                    glEnd();
00375                        
00376                 } else {
00377 
00378                     //in this case draw the mesh
00379 
00380                     #ifdef WIREFRAME
00381                     glBegin(GL_LINE_LOOP);
00382                     #else
00383                     glBegin(GL_POLYGON);
00384                     #endif
00385                     for (int s = 0 ; s < 4 ; s++) {
00386                         double tx,ty;
00387                         tx = tr.val[s][0];
00388                         ty = tr.val[s][1];
00389 //                        ty = ty - 90;
00390 //                        tx = tx - 180;
00391 //                        ty *= -1;
00392                         hugin_utils::FDiff2D cd(tx,ty);
00393                         MeshManager::MeshInfo::Coord3D coord = thelper->GetVisualizationStatePtr()->GetMeshManager()->GetCoord3D(cd);
00394                         glVertex3f(coord.x,coord.y,coord.z);
00395                     }
00396                     glEnd();
00397 
00398                 }
00399 
00400             }
00401             }
00402 
00403             }
00404 
00405         break;
00406 
00407         case HuginBase::PanoramaOptions::RECTILINEAR:
00408         case HuginBase::PanoramaOptions::EQUIRECTANGULAR:
00409         case HuginBase::PanoramaOptions::CYLINDRICAL:
00410         case HuginBase::PanoramaOptions::STEREOGRAPHIC:
00411         case HuginBase::PanoramaOptions::MERCATOR:
00412         case HuginBase::PanoramaOptions::TRANSVERSE_MERCATOR:
00413         case HuginBase::PanoramaOptions::MILLER_CYLINDRICAL:
00414         case HuginBase::PanoramaOptions::PANINI:
00415         case HuginBase::PanoramaOptions::EQUI_PANINI:
00416         case HuginBase::PanoramaOptions::BIPLANE:
00417         case HuginBase::PanoramaOptions::TRIPLANE:
00418         case HuginBase::PanoramaOptions::GENERAL_PANINI:
00419         case HuginBase::PanoramaOptions::ARCHITECTURAL:
00420 
00421             //stack to keep the rectangles to be divided
00422             std::vector<Rec> stack;
00423 
00424             stack.push_back(Rec(left,top,right,bottom));
00425             //if outline needs to be obtained, after each rectangle another rectangle is pushed back 
00426             if (outline) {
00427                 stack.push_back(Rec(true, true, true, true));
00428             }
00429             
00430             while(stack.size() > 0) {
00431 
00432                 Rec edge;
00433                 if (outline) {
00434                     edge = stack[stack.size() - 1];
00435                     stack.pop_back();
00436                 }
00437 
00438                 Rec top_rec = stack[stack.size() - 1];
00439                 stack.pop_back();
00440 
00441                 if (outline) {
00442                     if (!(edge.left || edge.top || edge.right || edge.bottom )) {
00443                         continue;
00444                     }
00445                 }
00446 
00447                 Rect rect(top_rec.left, top_rec.top, top_rec.right, top_rec.bottom);
00448 
00449                 Rect tr = rect.transformImgCoord(&transform);
00450 
00451                 double edge1 = (tr.val[0][0]-tr.val[1][0])*(tr.val[0][0]-tr.val[1][0]) + (tr.val[0][1]-tr.val[1][1])*(tr.val[0][1]-tr.val[1][1]);
00452                 double edge2 = (tr.val[1][0]-tr.val[2][0])*(tr.val[1][0]-tr.val[2][0]) + (tr.val[1][1]-tr.val[2][1])*(tr.val[1][1]-tr.val[2][1]);
00453                 double edge3 = (tr.val[2][0]-tr.val[3][0])*(tr.val[2][0]-tr.val[3][0]) + (tr.val[2][1]-tr.val[3][1])*(tr.val[2][1]-tr.val[3][1]);
00454                 double edge4 = (tr.val[3][0]-tr.val[0][0])*(tr.val[3][0]-tr.val[0][0]) + (tr.val[3][1]-tr.val[0][1])*(tr.val[3][1]-tr.val[0][1]);
00455 
00456 //                std::cout << "outlines  " << top_rec.left << " " << top_rec.top << " " << top_rec.right << " " << top_rec.bottom << std::endl;
00457 //                std::cout << "outlines  " << edge1 << " " << edge2 << " " << edge3 << " " << edge4 << std::endl;
00458 
00459 //                std::cout << "outlines  " << tr.val[0][0] << " " << tr.val[0][1] << std::endl;
00460 //                std::cout << "outlines  " << tr.val[1][0] << " " << tr.val[1][1] << std::endl;
00461 //                std::cout << "outlines  " << tr.val[2][0] << " " << tr.val[2][1] << std::endl;
00462 //                std::cout << "outlines  " << tr.val[3][0] << " " << tr.val[3][1] << std::endl;
00463 
00464                 double ressq = tres * tres;
00465 
00466                 bool divide_ver = false;
00467                 bool divide_hor = false;
00468 
00469                 //decide whether to divide the current rectangle
00470                 if (
00471                         (edge1 > ressq || edge3 > ressq) 
00472                             && 
00473                         std::abs(top_rec.top - top_rec.bottom) > tmindist
00474                     ) {
00475 
00476                         divide_ver = true;
00477 
00478                 } else if (
00479                             (edge2 > ressq || edge4 > ressq) 
00480                                 && 
00481                             std::abs(top_rec.left - top_rec.right) > tmindist
00482                         ) {
00483 
00484                         divide_hor = true;
00485 
00486                 }
00487 
00488                 if (divide_ver) {
00489 
00490                     stack.push_back(Rec(top_rec.left,top_rec.top,top_rec.right,(top_rec.top+top_rec.bottom)/2.0));
00491                     if (outline) {
00492                         stack.push_back(Rec(edge.left, edge.top, edge.right, false));
00493                     }
00494                     stack.push_back(Rec(top_rec.left,(top_rec.top+top_rec.bottom)/2.0,top_rec.right,top_rec.bottom));
00495                     if (outline) {
00496                         stack.push_back(Rec(edge.left, false, edge.right, edge.bottom));
00497                     }
00498                 }
00499 
00500                 if (divide_hor) {
00501 
00502                     stack.push_back(Rec(top_rec.left,top_rec.top,(top_rec.left+top_rec.right)/2.0,top_rec.bottom));
00503                     if (outline) {
00504                         stack.push_back(Rec(edge.left, edge.top, false, edge.bottom));
00505                     }
00506                     stack.push_back(Rec((top_rec.left+top_rec.right)/2.0,top_rec.top,top_rec.right,top_rec.bottom));
00507                     if (outline) {
00508                         stack.push_back(Rec(false, edge.top, edge.right, edge.bottom));
00509                     }
00510                 
00511                 } 
00512 
00513                 if (!(divide_ver || divide_hor)) {
00514 
00515                     //draw it
00516                     
00517                     if (outline) {
00518 //                        glBegin(GL_LINES);
00519                         bool edges[4];
00520                         edges[0] = edge.left!=0;
00521                         edges[1] = edge.bottom!=0;
00522                         edges[2] = edge.right!=0;
00523                         edges[3] = edge.top!=0;
00524                         for (int i = 0 ; i < 4 ; i++) {
00525                             if (edges[i]) {
00526 //                            std::cout << "outlines line!!" << i << "\n";
00527 //                            std::cout << "outlines  " << top_rec.left << " " << top_rec.top << " " << top_rec.right << " " << top_rec.bottom << std::endl;
00528 
00529                             int plus = i+1;
00530                             if (plus == 4) plus = 0;
00531                             hugin_utils::FDiff2D cd1(tr.val[i][0], tr.val[i][1]);
00532                             hugin_utils::FDiff2D cd2(tr.val[plus][0], tr.val[plus][1]);
00533                             GreatCircleArc::LineSegment line;
00534                             line.vertices[0] = cd1;
00535                             line.vertices[1] = cd2;
00536                             line.doGL(line_width, thelper->GetVisualizationStatePtr());
00537                             
00538 //                            MeshManager::MeshInfo::Coord3D coord1 = thelper->GetVisualizationStatePtr()->GetMeshManager()->GetCoord3D(cd1);
00539 //                            MeshManager::MeshInfo::Coord3D coord2 = thelper->GetVisualizationStatePtr()->GetMeshManager()->GetCoord3D(cd2);
00540 //                            glVertex3f(coord1.x,coord1.y,coord1.z);
00541 //                            glVertex3f(coord2.x,coord2.y,coord2.z);
00542 
00543             
00544 //                            for (int j = 0 ; j < 2 ; j++) {
00545 //                                int plus = i+j;
00546 //                                if (plus == 4) plus = 0;
00547 //                                double x,y,z;
00548 //                                double tx,ty;
00549 //                                tx = tr.val[plus][0];
00550 //                                ty = tr.val[plus][1];
00554 
00555 //                                
00556 //                                hugin_utils::FDiff2D cd(tx,ty);
00557 //                                MeshManager::MeshInfo::Coord3D coord = thelper->GetVisualizationStatePtr()->GetMeshManager()->GetCoord3D(cd);
00558 //                                glVertex3f(coord.x,coord.y,coord.z);
00559 //                            }
00560                             }
00561                         }
00562 //                        glEnd();
00563                     } else {
00564                         #ifdef WIREFRAME
00565                         glBegin(GL_LINE_LOOP);
00566                         #else
00567                         glBegin(GL_POLYGON);
00568                         #endif
00569                         for (int s = 0 ; s < 4 ; s++) {
00570                             double tx,ty;
00571                             tx = tr.val[s][0];
00572                             ty = tr.val[s][1];
00573 //                            ty = ty - 90;
00574 //                            tx = tx - 180;
00575 //                            ty *= -1;
00576                             hugin_utils::FDiff2D cd(tx,ty);
00577                             MeshManager::MeshInfo::Coord3D coord = thelper->GetVisualizationStatePtr()->GetMeshManager()->GetCoord3D(cd);
00578                             glVertex3f(coord.x,coord.y,coord.z);
00579                         }
00580                         glEnd();
00581                     }
00582                 }
00583 
00584             }
00585 
00586         break;
00587 
00588     }
00589 
00590 }
00591 
00592 
00593 

Generated on 27 Sep 2016 for Hugintrunk by  doxygen 1.4.7