diff --git a/.gitattributes b/.gitattributes index f4942b285ab..0b163d55fc7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4129,6 +4129,8 @@ Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc80.sln Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc80.vcproj -text Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/MainFrm.cpp -text Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/MainFrm.h -text +Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/data/Isidor_50.pwc -text +Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/data/TestCube.pwc -text Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/include/arcball.h -text Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/include/director.cpp -text Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/include/director.h -text diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizKernel.h b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizKernel.h index cc46b16524f..67017a87314 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizKernel.h +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizKernel.h @@ -7,12 +7,14 @@ // CGAL #include -#include +//#include +#include // kernel -struct K : CGAL::Exact_predicates_inexact_constructions_kernel {}; +//struct K : CGAL::Exact_predicates_inexact_constructions_kernel {}; +struct K : CGAL::Simple_cartesian {}; typedef K::FT FT; typedef K::Point_2 Point_2; typedef K::Point_3 Point_3; diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizView_3.cpp b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizView_3.cpp index 24b0ce8343e..41de1ee5560 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizView_3.cpp +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizView_3.cpp @@ -303,7 +303,7 @@ void CGyrovizView_3::OnPaint() pDoc->get_dt2().gl_draw_soup_vertices(0,0,0, pDoc->get_point_size()); } else - pDoc->get_dt3().gl_draw_3D_vertices(0,0,255,pDoc->get_point_size()); + pDoc->get_dt3().gl_draw_3D_vertices(0,255,0,pDoc->get_point_size()); } // draw Delaunay edges @@ -333,11 +333,22 @@ void CGyrovizView_3::OnPaint() if(m_view_coff_inside) { - static GLfloat grey[4] = {0.9f, 0.9f, 0.9f, 0.0f }; - ::glEnable(GL_LIGHTING); - ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); - ::glColor3ub(255,255,255); - pDoc->get_dt3().gl_draw_3D_inside_tetrahedrons(138,43,226); + //::glEnable(GL_LIGHTING); + ::glDisable(GL_LIGHTING); + ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + //::glColor3ub(100,100,255); + ::glEnable(GL_POLYGON_OFFSET_FILL); + ::glPolygonOffset(3.0f,-3.0f); + pDoc->get_dt3().gl_draw_3D_inside_tetrahedrons(138,43,226); /* purple */ + + ::glDisable(GL_LIGHTING); + ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); + //::glColor3ub(0,0,0); + ::glDisable(GL_POLYGON_OFFSET_FILL); + pDoc->get_dt3().gl_draw_3D_inside_tetrahedrons(255,255,0 /* yellow */); + + //::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + //pDoc->get_dt3().gl_draw_3D_inside_tetrahedrons(138,43,226); } glPopMatrix(); diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_dt3.h b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_dt3.h index b9f1fd75ba3..861407d9e03 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_dt3.h +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_dt3.h @@ -8,9 +8,6 @@ // 3 columns corresponding to the 3D coordinates of a track followed by the // list of the images in which he has been "seen". -// Kernel -#include - // Delaunay triangulation 3 && Intersections #include #include @@ -80,8 +77,8 @@ public: // tetrahedron type static const unsigned char UNKNOWN = -1; - static const unsigned char OUTSIDE = 0; - static const unsigned char INSIDE = 1; + static const unsigned char VIDE = 0; + static const unsigned char PLEIN = 1; // Data members private: @@ -200,6 +197,10 @@ public: // Read 3D points + camera indices on next lines else { + //// TEMPORARY: skip part of file + //if (lineNumber % 4 != 0) + // continue; + std::istringstream iss(pLine); Point_3 position; @@ -231,8 +232,8 @@ public: //Cell_handle cell; //cell = vh->cell(); - //if(!is_infinite(cell)){cell->info() = INSIDE;} - //else cell->info() = OUTSIDE; + //if(!is_infinite(cell)){cell->info() = PLEIN;} + //else cell->info() = VIDE; gpts.push_back(Gyroviz_point_dt3(position,list_of_cameras.begin(), list_of_cameras.end())); } @@ -472,13 +473,19 @@ public: void inside_outside() { - // lets initialize all the cells to INSIDE - for (Cell_iterator cell = cells_begin(); cell != cells_end(); cell++) + // lets initialize all the cells to PLEIN + for (Cell_iterator cell = this->cells_begin(); cell != this->cells_end(); cell++) { // TEST Each cell corresponding to the current vertex is flagged as "UNKNOWN" - if(!is_infinite(cell)){cell->info() = INSIDE;} - else cell->info() = OUTSIDE; + //(1) //cell->info() = PLEIN; + //(2) //if(!is_infinite(cell)){cell->info() = PLEIN;} + //(3) //if(!is_infinite(cell)){cell->info() = UNKNOWN;} + //(2,3) //else cell->info() = VIDE; + //(4) //cell->info() = UNKNOWN; + //(5) //if(!is_infinite(cell)){cell->info() = PLEIN;} + //(5) //else cell->info() = UNKNOWN; + cell->info() = PLEIN; } // TEST @@ -507,18 +514,16 @@ public: int in_i = -1, in_j = -1; ///////////////////////////////// - // TODO : Opposite tetra must be labbelled as INSIDE! - std::list incident_c; - incident_cells(static_cast(fv),back_inserter(incident_c)); + incident_cells(fv, back_inserter(incident_c)); // create an iterator for these cells typename std::list::iterator cell_it = incident_c.begin(); //// TEST - //Cell_handle INSIDE_cell, OUTSIDE_cell; - // + Cell_handle INSIDE_cell, OUTSIDE_cell; + //for( ; cell_it != incident_c.end(); ++cell_it) //{ // if(is_infinite(*cell_it)) continue; @@ -528,14 +533,18 @@ public: // { // // opposite facet to the input vertex(index) // Triangle_3 opposite_cell_facet = this->triangle(*cell_it,index_in_cell_it); - - // if(do_intersect(opposite_cell_facet,segment.opposite())) + // + // // reverse segment + // Point_3 reverse_extremity(fv->point() - Vector_3(fv->point(),list_of_cams[j])); + // Segment_3 reverse_segment (fv->point(), reverse_extremity); + // + // if(do_intersect(opposite_cell_facet,reverse_segment) && (*cell_it)->info() != VIDE ) // { - // - // (*cell_it)->info() = INSIDE; + // //assert((*cell_it)->info() != VIDE); + // (*cell_it)->info() = PLEIN; // // // TEST - // TRACE("INSIDE Cell : %x\n",&*cell_it); + // TRACE("PLEIN Cell : %x\n",&**cell_it); // INSIDE_cell = *cell_it; // // break; @@ -543,11 +552,9 @@ public: // } //} - cell_it = incident_c.begin(); - - // lets find the first Cell - - for( ; cell_it != incident_c.end(); ++cell_it) + // is the segment outside of the triangulation? + bool segment_outside_T3 = true; + for(cell_it = incident_c.begin() ; cell_it != incident_c.end(); ++cell_it) { int index_in_cell_it; if((*cell_it)->has_vertex(fv,index_in_cell_it)) @@ -556,16 +563,54 @@ public: if(in_type != NOTHING) { - in_Tetra = (*cell_it); - - ////TEST - //TRACE("OUTSIDE Cell : %x\n",&in_Tetra); - //OUTSIDE_cell = in_Tetra; - + segment_outside_T3 = false; break; } } } + TRACE("segment_outside_T3: %s\n",segment_outside_T3 ? "true" : "false"); + + // lets find the first Cell + if (segment_outside_T3) + { + // mark infinite cells as empty + for(cell_it = incident_c.begin() ; cell_it != incident_c.end(); ++cell_it) + { + int index_in_cell_it; + if((*cell_it)->has_vertex(fv,index_in_cell_it)) + { + if(is_infinite(*cell_it)) + { + TRACE("VIDE infinite cell : %x\n",&**cell_it); + (*cell_it)->info() = VIDE; + } + } + } + + // skip next loop + in_type = NOTHING; + } + else + { + // find tet crossed by segment + for(cell_it = incident_c.begin() ; cell_it != incident_c.end(); ++cell_it) + { + int index_in_cell_it; + if((*cell_it)->has_vertex(fv,index_in_cell_it)) + { + do_intersect_from_vertex(*cell_it, index_in_cell_it, segment, in_type, in_i, in_j); + + if(in_type != NOTHING) + { + in_Tetra = (*cell_it); + in_type = VERTEX; + in_i = index_in_cell_it; + TRACE("first Cell : %x\n",&*in_Tetra); + break; + } + } + } + } ////TEST //assert(&OUTSIDE_cell != &INSIDE_cell); @@ -612,8 +657,12 @@ public: // the camera center of one of these views should be labbelled as outside. // Exception : segment is tangent to the tetrahedra - //TRACE("OUTSIDE\n"); - in_Tetra->info() = OUTSIDE; + //assert(in_Tetra->info() != PLEIN); + //if (in_Tetra->info() != PLEIN) + //{ + TRACE("VIDE Cell : %x\n",&*in_Tetra); + in_Tetra->info() = VIDE; + //} // compute the next (in_Tetra, in_type, in_i, in_j) variables in_type = out_type; @@ -840,20 +889,30 @@ public: { // Draw 3D delaunay triangulation - ::glColor3ub(r,g,b); ::glBegin(GL_TRIANGLES); - Facet_iterator ff = this->facets_begin(); - for(; ff != this->facets_end(); ++ff) + Finite_facets_iterator ff = this->finite_facets_begin(); + for(; ff != this->finite_facets_end(); ++ff) { Cell_handle c = ff->first; int index_in_c = ff->second; Cell_handle neighbor_c = c->neighbor(index_in_c); - if(!is_infinite(c)&& !is_infinite(neighbor_c) && c->info() == INSIDE && neighbor_c->info() == OUTSIDE - || !is_infinite(c) && !is_infinite(neighbor_c) && c->info() == OUTSIDE && neighbor_c->info() == INSIDE) + if(/*!is_infinite(c)&& !is_infinite(neighbor_c) &&*/ c->info() == PLEIN && neighbor_c->info() == VIDE + || /*!is_infinite(c) && !is_infinite(neighbor_c) &&*/ c->info() == VIDE && neighbor_c->info() == PLEIN + /*!is_infinite(c)&& !is_infinite(neighbor_c) && (c->info() == VIDE || neighbor_c->info() == VIDE)*/) { + //assert(!is_infinite(*ff)); + if (is_infinite(*ff)) + TRACE("BUG! Infinite facet (%x, %d)\n", &*ff->first, (int)ff->second); + + // TEMPORARY: paint facets on convex hull in blue + if (is_infinite(c) || is_infinite(neighbor_c)) + ::glColor3ub(0,0,255); + else + ::glColor3ub(r,g,b); + int k = ff->second; Point_3 p1 = c->vertex( (k+1)&3 )->point(); Point_3 p2 = c->vertex( (k+2)&3 )->point(); diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc71.vcproj b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc71.vcproj index b74527adf2f..6d80b5f521c 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc71.vcproj +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc71.vcproj @@ -21,17 +21,17 @@ Name="VCCLCompilerTool" AdditionalOptions="/Zm900" Optimization="0" - AdditionalIncludeDirectories="include;..\..\..\include;..\..\..\..\..\trunk\Principal_component_analysis\include;..\..\..\..\..\trunk\Jet_fitting_3\include;"$(CGALROOT)\include\CGAL\config\msvc";"$(CGALROOT)\include";"$(CGALROOT)\auxiliary\gmp\include";"$(CGALROOT)\auxiliary\taucs\include";"$(BOOSTROOT)";"$(CIMGROOT)"" - PreprocessorDefinitions="WIN32;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;CGAL_USE_GMP;CGAL_USE_TAUCS;_WIN32_WINNT= 0x0500" + AdditionalIncludeDirectories="include;..\..\..\include;..\..\..\..\..\trunk\Principal_component_analysis\include;..\..\..\..\..\trunk\Jet_fitting_3\include;"$(CGALROOT)\include\CGAL\config\msvc";"$(CGALROOT)\include";"$(CGALROOT)\auxiliary\gmp\include";"$(CGALROOT)\auxiliary\taucs\include";"$(BOOSTROOT)"" + PreprocessorDefinitions="WIN32;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;CGAL_USE_GMP;CGAL_USE_TAUCS" MinimalRebuild="TRUE" BasicRuntimeChecks="0" RuntimeLibrary="0" TreatWChar_tAsBuiltInType="TRUE" RuntimeTypeInfo="TRUE" - UsePrecompiledHeader="0" + UsePrecompiledHeader="2" BrowseInformation="1" WarningLevel="2" - Detect64BitPortabilityProblems="FALSE" + Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3" DisableSpecificWarnings="4267;4311;4800;4503"/> - - @@ -157,23 +154,17 @@ RelativePath=".\include\Director.cpp"> + RelativePath=".\MainFrm.cpp"> + RelativePath=".\Gyroviz.cpp"> - - - - - - @@ -213,47 +201,26 @@ RelativePath=".\include\eigen_t.h"> + RelativePath=".\include\enriched_polyhedron.h"> + RelativePath=".\MainFrm.h"> + + + + - - - - - - - - - - - - - - - - - - @@ -306,7 +273,7 @@ RelativePath="..\..\..\include\CGAL\Point_with_normal_spatial_sort_traits.h"> + RelativePath="..\..\..\include\CGAL\Poisson_delaunay_triangulation_3.h"> @@ -321,6 +288,25 @@ RelativePath="..\..\..\include\CGAL\taucs_solver.h"> + + + + + + + + + + + + diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc80.vcproj b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc80.vcproj index e7f80ce7d95..202e64c048c 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc80.vcproj +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vc80.vcproj @@ -436,7 +436,7 @@ >