Bug correction : Superposition of images & 2D triangulation.Inside_Outside seems to be working correctly

/!\ Notice /!\ 
We used Simple Cartesian Kernel to boost the execution time.
This commit is contained in:
Nader Salman 2008-03-25 17:38:41 +00:00
parent b93323ae40
commit d1a94aa828
8 changed files with 2702 additions and 100 deletions

2
.gitattributes vendored
View File

@ -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

View File

@ -7,12 +7,14 @@
// CGAL
#include <CGAL/basic.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
//#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Simple_cartesian.h>
// kernel
struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
//struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
struct K : CGAL::Simple_cartesian<double> {};
typedef K::FT FT;
typedef K::Point_2 Point_2;
typedef K::Point_3 Point_3;

View File

@ -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();

View File

@ -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 <CGAL/Exact_predicates_inexact_constructions_kernel.h>
// Delaunay triangulation 3 && Intersections
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
@ -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<Cell_handle> incident_c;
incident_cells(static_cast<Vertex_handle>(fv),back_inserter(incident_c));
incident_cells(fv, back_inserter(incident_c));
// create an iterator for these cells
typename std::list<Cell_handle>::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();

View File

@ -21,17 +21,17 @@
Name="VCCLCompilerTool"
AdditionalOptions="/Zm900"
Optimization="0"
AdditionalIncludeDirectories="include;..\..\..\include;..\..\..\..\..\trunk\Principal_component_analysis\include;..\..\..\..\..\trunk\Jet_fitting_3\include;&quot;$(CGALROOT)\include\CGAL\config\msvc&quot;;&quot;$(CGALROOT)\include&quot;;&quot;$(CGALROOT)\auxiliary\gmp\include&quot;;&quot;$(CGALROOT)\auxiliary\taucs\include&quot;;&quot;$(BOOSTROOT)&quot;;&quot;$(CIMGROOT)&quot;"
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;&quot;$(CGALROOT)\include\CGAL\config\msvc&quot;;&quot;$(CGALROOT)\include&quot;;&quot;$(CGALROOT)\auxiliary\gmp\include&quot;;&quot;$(CGALROOT)\auxiliary\taucs\include&quot;;&quot;$(BOOSTROOT)&quot;"
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"/>
<Tool
@ -84,16 +84,16 @@
AdditionalOptions="/Zm900"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="include;..\..\..\include;..\..\..\..\..\trunk\Principal_component_analysis\include;..\..\..\..\..\trunk\Jet_fitting_3\include;&quot;$(CGALROOT)\include\CGAL\config\msvc&quot;;&quot;$(CGALROOT)\include&quot;;&quot;$(CGALROOT)\auxiliary\gmp\include&quot;;&quot;$(CGALROOT)\auxiliary\taucs\include&quot;;&quot;$(BOOSTROOT)&quot;;&quot;$(CIMGROOT)&quot;"
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;&quot;$(CGALROOT)\include\CGAL\config\msvc&quot;;&quot;$(CGALROOT)\include&quot;;&quot;$(CGALROOT)\auxiliary\gmp\include&quot;;&quot;$(CGALROOT)\auxiliary\taucs\include&quot;;&quot;$(BOOSTROOT)&quot;"
PreprocessorDefinitions="WIN32;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;CGAL_USE_GMP;CGAL_USE_TAUCS"
MinimalRebuild="FALSE"
BasicRuntimeChecks="0"
RuntimeLibrary="0"
TreatWChar_tAsBuiltInType="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
UsePrecompiledHeader="2"
WarningLevel="2"
Detect64BitPortabilityProblems="FALSE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
DisableSpecificWarnings="4267;4311;4800;4503"/>
<Tool
@ -147,9 +147,6 @@
<File
RelativePath=".\ChildFrm.cpp">
</File>
<File
RelativePath=".\DialogOptions_2.cpp">
</File>
<File
RelativePath=".\DialogOptions_3.cpp">
</File>
@ -157,23 +154,17 @@
RelativePath=".\include\Director.cpp">
</File>
<File
RelativePath=".\Gyroviz.cpp">
RelativePath=".\MainFrm.cpp">
</File>
<File
RelativePath=".\GyrovizDoc_2.cpp">
RelativePath=".\Gyroviz.cpp">
</File>
<File
RelativePath=".\GyrovizDoc_3.cpp">
</File>
<File
RelativePath=".\GyrovizView_2.cpp">
</File>
<File
RelativePath=".\GyrovizView_3.cpp">
</File>
<File
RelativePath=".\MainFrm.cpp">
</File>
<File
RelativePath=".\stdafx.cpp">
<FileConfiguration
@ -200,9 +191,6 @@
<File
RelativePath=".\ChildFrm.h">
</File>
<File
RelativePath=".\DialogOptions_2.h">
</File>
<File
RelativePath=".\DialogOptions_3.h">
</File>
@ -213,47 +201,26 @@
RelativePath=".\include\eigen_t.h">
</File>
<File
RelativePath=".\Gyroviz.h">
RelativePath=".\include\enriched_polyhedron.h">
</File>
<File
RelativePath=".\Gyroviz_cdt2.h">
RelativePath=".\MainFrm.h">
</File>
<File
RelativePath=".\include\oracle.h">
</File>
<File
RelativePath=".\Gyroviz.h">
</File>
<File
RelativePath=".\include\Gyroviz_dt2.h">
</File>
<File
RelativePath=".\Gyroviz_dt3.h">
</File>
<File
RelativePath=".\Gyroviz_info_for_cdt2.h">
</File>
<File
RelativePath=".\Gyroviz_info_for_dt2.h">
</File>
<File
RelativePath=".\Gyroviz_info_for_dt3.h">
</File>
<File
RelativePath=".\Gyroviz_segmentation2.h">
</File>
<File
RelativePath=".\GyrovizDoc_2.h">
</File>
<File
RelativePath=".\GyrovizDoc_3.h">
</File>
<File
RelativePath=".\GyrovizKernel.h">
</File>
<File
RelativePath=".\GyrovizView_2.h">
</File>
<File
RelativePath=".\GyrovizView_3.h">
</File>
<File
RelativePath=".\MainFrm.h">
</File>
<File
RelativePath=".\Resource.h">
</File>
@ -306,7 +273,7 @@
RelativePath="..\..\..\include\CGAL\Point_with_normal_spatial_sort_traits.h">
</File>
<File
RelativePath="..\..\..\include\CGAL\Implicit_fct_delaunay_triangulation_3.h">
RelativePath="..\..\..\include\CGAL\Poisson_delaunay_triangulation_3.h">
</File>
<File
RelativePath="..\..\..\include\CGAL\Poisson_implicit_function.h">
@ -321,6 +288,25 @@
RelativePath="..\..\..\include\CGAL\taucs_solver.h">
</File>
</Filter>
<Filter
Name="Concepts"
Filter="">
<File
RelativePath="..\..\..\doc\concepts\PointWithNormal_3.h">
</File>
<File
RelativePath="..\..\..\doc\concepts\GyrovizDelaunayTriangulation_3.h">
</File>
<File
RelativePath="..\..\..\doc\concepts\GyrovizDelaunayTriangulationCellBase_3.h">
</File>
<File
RelativePath="..\..\..\doc\concepts\GyrovizDelaunayTriangulationVertexBase_3.h">
</File>
<File
RelativePath="..\..\..\doc\concepts\ReconstructionImplicitFunction.h">
</File>
</Filter>
<File
RelativePath=".\res\Gyroviz.manifest">
</File>

View File

@ -436,7 +436,7 @@
>
</File>
<File
RelativePath="..\..\..\include\CGAL\Implicit_fct_delaunay_triangulation_3.h"
RelativePath="..\..\..\include\CGAL\Poisson_delaunay_triangulation_3.h"
>
</File>
<File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
CamOFF
30 13
-0.45723 4.20982 -3.43912
-0.45283 4.21252 -3.42721
-0.45047 4.21798 -3.43084
10.34944 14.24396 133.50793
10.35201 54.27734 80.49450
10.35289 14.27821 133.48725
-0.45463 4.22009 -3.45917
-0.45935 4.22045 -3.49653
-0.45376 4.22441 -3.50687
-0.46083 4.22584 -3.49763
-0.47203 4.23225 -3.49095
-0.48296 4.23351 -3.46703
-0.46777 4.23688 -3.45471
-0.45325 4.23882 -3.44306
-0.44590 4.23467 -3.44292
-0.43231 4.23360 -3.44477
-0.41632 4.23049 -3.44642
-0.40087 4.22572 -3.44661
-0.38051 4.22430 -3.44770
-0.36313 4.22098 -3.45169
-0.34665 4.22337 -3.43800
-0.35097 4.23052 -3.45074
-0.35446 4.22365 -3.44960
-0.35870 4.22607 -3.44754
-0.35157 4.21740 -3.47102
-0.34793 4.21417 -3.47160
-0.34403 4.22689 -3.48989
-0.34344 4.23397 -3.50183
-0.34382 4.23031 -3.50690
-0.34674 4.23200 -3.50906
-0.34944 4.24396 -3.50793
-0.35201 4.27734 -3.49450
-0.35289 4.27821 -3.48725
1.632993 0.000000 1.154701 5
0.000000 1.632993 1.154701 5
-1.632993 0.000000 1.154701 5
-0.000000 -1.632993 1.154701 5
1.632993 -0.000000 -1.154701 8
0.000000 1.632993 -1.154701 9
-1.632993 0.000000 -1.154701 10
-0.000000 -1.632993 -1.154701 11