mirror of https://github.com/CGAL/cgal
LCC demo with index ok
This commit is contained in:
parent
282d5e8c7b
commit
7370aa54ef
|
|
@ -66,6 +66,8 @@ else()
|
|||
Linear_cell_complex_pqq_subdivision.cpp
|
||||
typedefs.h
|
||||
import_moka.h
|
||||
MainWindow.h
|
||||
Viewer.h
|
||||
${uis}
|
||||
${CGAL_Qt5_RESOURCE_FILES}
|
||||
${CGAL_Qt5_MOC_FILES})
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
}
|
||||
|
||||
if (open)
|
||||
return make_pair(v.point(), d);
|
||||
{ return std::make_pair(v.point(), d); }
|
||||
|
||||
LCC::FT alpha = (4.0f - 2.0f *
|
||||
(LCC::FT) cos (2.0f * PI / (LCC::FT) degree)) / 9.0f;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ public:
|
|||
|
||||
// Old points aren't concerned.
|
||||
if (mlcc.is_marked(d, old))
|
||||
{
|
||||
return make_pair(v.point(), d);
|
||||
}
|
||||
{ return std::make_pair(v.point(), d); }
|
||||
|
||||
std::vector<LCC::Point> facetsPoints;
|
||||
facetsPoints.resize(0);
|
||||
|
|
@ -46,9 +44,7 @@ public:
|
|||
{
|
||||
// If the vertex is on a border.
|
||||
if (mlcc.is_free(it,2))
|
||||
{
|
||||
return make_pair(v.point(), d);
|
||||
}
|
||||
{ return std::make_pair(v.point(), d); }
|
||||
// If we found barycenter of a facet.
|
||||
if (!mlcc.is_marked(mlcc.opposite(it), old))
|
||||
{
|
||||
|
|
@ -59,9 +55,7 @@ public:
|
|||
// If we found more than two points we are on a vertice barycenter of a facet.
|
||||
// They aren't concerned.
|
||||
if (facetsPoints.size() > 2 || facetsPoints.size() < 2)
|
||||
{
|
||||
return make_pair(v.point(), d);
|
||||
}
|
||||
{ return std::make_pair(v.point(), d); }
|
||||
|
||||
// Average.
|
||||
LCC::Vector averageFacetsV = LCC::Traits::Construct_vector()
|
||||
|
|
@ -113,9 +107,7 @@ public:
|
|||
|
||||
// Just old points are concerned.
|
||||
if (!mlcc.is_marked(d, old))
|
||||
{
|
||||
return make_pair(v.point(), d);
|
||||
}
|
||||
{ return std::make_pair(v.point(), d); }
|
||||
|
||||
unsigned int degree = 0;
|
||||
std::vector<LCC::Point> edgesPoints;
|
||||
|
|
@ -131,9 +123,7 @@ public:
|
|||
{
|
||||
// If the vertex is on a border
|
||||
if (mlcc.is_free(it,2))
|
||||
{
|
||||
return make_pair(v.point(), d);
|
||||
}
|
||||
{ return std::make_pair(v.point(), d); }
|
||||
// If incident isn't an old point, it's an edge point.
|
||||
if (!mlcc.is_marked(mlcc.opposite(it), old))
|
||||
{
|
||||
|
|
@ -147,9 +137,7 @@ public:
|
|||
CGAL_assertion (facetsPoints.size() != 0 && edgesPoints.size() != 0);
|
||||
|
||||
if (facetsPoints.size() < 3 || edgesPoints.size() < 3 )
|
||||
{
|
||||
return make_pair(v.point(), d);
|
||||
}
|
||||
{ return std::make_pair(v.point(), d); }
|
||||
|
||||
// Average of incidents "edge points".
|
||||
LCC::Vector averageEdgesV = LCC::Traits::Construct_vector()
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ void MainWindow::on_actionSubdivide_triggered ()
|
|||
timer.start();
|
||||
#endif
|
||||
|
||||
subdivide_lcc_3 (*(scene.lcc));
|
||||
subdivide_lcc_3(*(scene.lcc));
|
||||
|
||||
#ifdef CGAL_PROFILE_LCC_DEMO
|
||||
timer.stop();
|
||||
|
|
@ -1047,7 +1047,7 @@ void MainWindow::on_actionMerge_coplanar_faces_triggered()
|
|||
if ( scene.lcc->beta<0, 2>(*it)==*it || scene.lcc->beta<1, 2>(*it)==*it)
|
||||
{ // To process dangling edges
|
||||
|
||||
Dart_handle actu = *it, prev=nullptr;
|
||||
Dart_handle actu = *it, prev=LCC::null_handle;
|
||||
do
|
||||
{
|
||||
if ( scene.lcc->beta<0, 2>(actu)==actu ) prev = scene.lcc->beta<1>(actu);
|
||||
|
|
@ -1060,9 +1060,9 @@ void MainWindow::on_actionMerge_coplanar_faces_triggered()
|
|||
actu = prev;
|
||||
}
|
||||
else
|
||||
actu = nullptr;
|
||||
actu=LCC::null_handle;
|
||||
}
|
||||
while (actu!=nullptr && (scene.lcc->beta<0, 2>(actu)==actu || scene.lcc->beta<1, 2>(actu)==actu));
|
||||
while (actu!=LCC::null_handle && (scene.lcc->beta<0, 2>(actu)==actu || scene.lcc->beta<1, 2>(actu)==actu));
|
||||
}
|
||||
else if ( !CGAL::belong_to_same_cell<LCC, 2>(*scene.lcc, *it,
|
||||
scene.lcc->beta<2>(*it)) )
|
||||
|
|
@ -1176,19 +1176,18 @@ void constrained_delaunay_triangulation(LCC &lcc, Dart_handle d1)
|
|||
LCC::Dart_of_orbit_range<1>::iterator
|
||||
it(lcc.darts_of_orbit<1>(d1).begin());
|
||||
|
||||
CDT::Vertex_handle previous=LCC::null_handle, first=LCC::null_handle,
|
||||
vh=LCC::null_handle;
|
||||
CDT::Vertex_handle previous=nullptr, first=nullptr, vh=nullptr;
|
||||
|
||||
for (LCC::Dart_of_orbit_range<1>::iterator
|
||||
itend(lcc.darts_of_orbit<1>(d1).end()); it!=itend; ++it)
|
||||
{
|
||||
vh = cdt.insert(lcc.point(it));
|
||||
vh->info().dh=it;
|
||||
if( first==nullptr )
|
||||
if(first==nullptr)
|
||||
{
|
||||
first=vh;
|
||||
}
|
||||
if( previous!=nullptr)
|
||||
if(previous!=nullptr)
|
||||
{
|
||||
CGAL_assertion( previous !=vh );
|
||||
cdt.insert_constraint(previous,vh);
|
||||
|
|
@ -1211,7 +1210,7 @@ void constrained_delaunay_triangulation(LCC &lcc, Dart_handle d1)
|
|||
}
|
||||
|
||||
std::queue<CDT::Face_handle> face_queue;
|
||||
CDT::Face_handle face_internal = nullptr;
|
||||
CDT::Face_handle face_internal=nullptr;
|
||||
|
||||
face_queue.push(cdt.infinite_vertex()->face());
|
||||
while(! face_queue.empty() )
|
||||
|
|
@ -1234,7 +1233,7 @@ void constrained_delaunay_triangulation(LCC &lcc, Dart_handle d1)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( face_internal!=nullptr )
|
||||
if (face_internal!=nullptr)
|
||||
face_queue.push(face_internal);
|
||||
|
||||
while(! face_queue.empty() )
|
||||
|
|
@ -1294,17 +1293,17 @@ void constrained_delaunay_triangulation(LCC &lcc, Dart_handle d1)
|
|||
const CDT::Vertex_handle vb = fh->vertex(cdt.ccw(index));
|
||||
const CDT::Vertex_handle vc = fh->vertex(index);
|
||||
|
||||
Dart_handle dd1 = nullptr;
|
||||
Dart_handle dd1 = LCC::null_handle;
|
||||
for (LCC::Dart_of_cell_range<0, 2>::iterator it(lcc.darts_of_cell<0, 2>(va->info().dh).begin());
|
||||
dd1==nullptr && it.cont(); ++it)
|
||||
dd1==LCC::null_handle && it.cont(); ++it)
|
||||
{
|
||||
if (lcc.point(lcc.beta<1>(it))==vc->point())
|
||||
dd1=it;
|
||||
}
|
||||
|
||||
Dart_handle dd2 = nullptr;
|
||||
Dart_handle dd2 = LCC::null_handle;
|
||||
for (LCC::Dart_of_cell_range<0, 2>::iterator it(lcc.darts_of_cell<0, 2>(vb->info().dh).begin());
|
||||
dd2==nullptr && it.cont(); ++it)
|
||||
dd2==LCC::null_handle && it.cont(); ++it)
|
||||
{
|
||||
if (lcc.point(lcc.beta<0>(it))==vc->point())
|
||||
dd2=it;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ struct GDart
|
|||
Dart_handle dh;
|
||||
LCC::Vertex_attribute_handle vh;
|
||||
|
||||
GDart() : dh(nullptr), vh(nullptr)
|
||||
GDart() : dh(LCC::null_handle), vh(LCC::null_handle)
|
||||
{}
|
||||
|
||||
GDart(const GDart& adart) : dh(adart.dh),
|
||||
|
|
@ -97,9 +97,9 @@ bool import_from_moka(LCC& lcc, const char* filename)
|
|||
std::stack<unsigned int> totreat;
|
||||
for (unsigned int startingdart = 0; startingdart<nbLoaded; ++startingdart)
|
||||
{
|
||||
bool orient=(gdarts[startingdart].dh==nullptr);
|
||||
bool orient=(gdarts[startingdart].dh==LCC::null_handle);
|
||||
for (unsigned int dim=0; orient && dim<4; ++dim)
|
||||
if (gdarts[gdarts[startingdart].alpha[dim]].dh!=nullptr) orient=false;
|
||||
if (gdarts[gdarts[startingdart].alpha[dim]].dh!=LCC::null_handle) orient=false;
|
||||
|
||||
if ( orient )
|
||||
{
|
||||
|
|
@ -111,15 +111,15 @@ bool import_from_moka(LCC& lcc, const char* filename)
|
|||
unsigned int i=totreat.top();
|
||||
totreat.pop();
|
||||
|
||||
assert(gdarts[i].dh!=nullptr);
|
||||
assert(gdarts[i].dh!=LCC::null_handle);
|
||||
|
||||
for (unsigned int dim=1; dim<4; ++dim)
|
||||
{
|
||||
if (gdarts[i].alpha[dim]!=i &&
|
||||
gdarts[gdarts[i].alpha[dim]].vh!=nullptr)
|
||||
gdarts[gdarts[i].alpha[dim]].vh!=LCC::null_handle)
|
||||
{
|
||||
gdarts[i].vh = gdarts[gdarts[i].alpha[dim]].vh;
|
||||
gdarts[gdarts[i].alpha[dim]].vh = nullptr;
|
||||
gdarts[gdarts[i].alpha[dim]].vh = LCC::null_handle;
|
||||
}
|
||||
|
||||
unsigned int alpha0 = gdarts[i].alpha[0];
|
||||
|
|
@ -127,7 +127,7 @@ bool import_from_moka(LCC& lcc, const char* filename)
|
|||
|
||||
if (gdarts[alpha0].alpha[dim]!=alpha0)
|
||||
{
|
||||
if ( gdarts[gdarts[alpha0].alpha[dim]].dh==nullptr )
|
||||
if ( gdarts[gdarts[alpha0].alpha[dim]].dh==LCC::null_handle )
|
||||
{
|
||||
totreat.push(gdarts[alpha0].alpha[dim]);
|
||||
gdarts[gdarts[alpha0].alpha[dim]].dh = lcc.create_dart();
|
||||
|
|
@ -151,13 +151,13 @@ bool import_from_moka(LCC& lcc, const char* filename)
|
|||
bool orientable = true;
|
||||
for (unsigned int i = 0; i<nbLoaded; ++i)
|
||||
{
|
||||
if (gdarts[i].dh!=nullptr)
|
||||
if (gdarts[i].dh!=LCC::null_handle)
|
||||
{
|
||||
for (unsigned int dim=0; dim<4; ++dim)
|
||||
{
|
||||
if (orientable &&
|
||||
gdarts[i].alpha[dim]!=i &&
|
||||
gdarts[gdarts[i].alpha[dim]].dh!=nullptr)
|
||||
gdarts[gdarts[i].alpha[dim]].dh!=LCC::null_handle)
|
||||
{
|
||||
std::cout<<"Pb, the gmap is NOT orientable."<<std::endl;
|
||||
orientable=false;
|
||||
|
|
@ -165,12 +165,12 @@ bool import_from_moka(LCC& lcc, const char* filename)
|
|||
}
|
||||
}
|
||||
|
||||
if ( lcc.template attribute<3>(gdarts[i].dh) == nullptr )
|
||||
if ( lcc.template attribute<3>(gdarts[i].dh) == LCC::null_handle )
|
||||
{
|
||||
lcc.template set_attribute<3>(gdarts[i].dh, lcc.template create_attribute<3>());
|
||||
}
|
||||
}
|
||||
if (gdarts[i].vh!=nullptr)
|
||||
if (gdarts[i].vh!=LCC::null_handle)
|
||||
{
|
||||
lcc.set_vertex_attribute(gdarts[i].dh, gdarts[i].vh);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#define CMAP_WITH_INDEX 1
|
||||
// #define CMAP_WITH_INDEX 1
|
||||
|
||||
// Global random
|
||||
extern CGAL::Random myrandom;
|
||||
|
|
@ -106,8 +106,6 @@ private:
|
|||
typedef CGAL::Linear_cell_complex_traits
|
||||
<3,CGAL::Exact_predicates_inexact_constructions_kernel> Mytraits;
|
||||
|
||||
#ifndef CMAP_WITH_INDEX
|
||||
|
||||
namespace CGAL
|
||||
{
|
||||
|
||||
|
|
@ -133,7 +131,7 @@ inline void read_cmap_attribute_node<Volume_info>
|
|||
{}
|
||||
}
|
||||
|
||||
// Definition of function allowing to save custon information.
|
||||
// Definition of function allowing to save custom information.
|
||||
template<>
|
||||
inline void write_cmap_attribute_node<Volume_info>(boost::property_tree::ptree & node,
|
||||
const Volume_info& arg)
|
||||
|
|
@ -147,9 +145,13 @@ inline void write_cmap_attribute_node<Volume_info>(boost::property_tree::ptree &
|
|||
|
||||
}
|
||||
|
||||
class Myitems
|
||||
struct Myitems
|
||||
{
|
||||
public:
|
||||
#ifdef CMAP_WITH_INDEX
|
||||
using Use_index=CGAL::Tag_true;
|
||||
#endif // CMAP_WITH_INDEX
|
||||
|
||||
template < class Refs >
|
||||
struct Dart_wrapper
|
||||
{
|
||||
|
|
@ -161,28 +163,7 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
typedef CGAL::Linear_cell_complex<3,3,Mytraits,Myitems> LCC;
|
||||
|
||||
#else
|
||||
|
||||
class Myitems
|
||||
{
|
||||
public:
|
||||
template < class Refs >
|
||||
struct Dart_wrapper
|
||||
{
|
||||
typedef CGAL::Index::Cell_attribute_with_point< Refs > Vertex_attrib;
|
||||
typedef CGAL::Index::Cell_attribute< Refs, Volume_info> Volume_attrib;
|
||||
|
||||
typedef std::tuple<Vertex_attrib,void,void,
|
||||
Volume_attrib> Attributes;
|
||||
};
|
||||
};
|
||||
|
||||
typedef CGAL::Index::Linear_cell_complex_for_combinatorial_map<3,3,Mytraits,Myitems> LCC;
|
||||
|
||||
#endif
|
||||
|
||||
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3,3,Mytraits,Myitems> LCC;
|
||||
typedef LCC::Dart_handle Dart_handle;
|
||||
typedef LCC::Vertex_attribute Vertex;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue