mirror of https://github.com/CGAL/cgal
dh -> d into examples
This commit is contained in:
parent
f5e3ea281f
commit
036bdf7c71
|
|
@ -71,8 +71,8 @@ int main()
|
|||
CMap_3 cm;
|
||||
|
||||
// 0) Create 2 hexahedra.
|
||||
Dart_descriptor dh1 = cm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor dh2 = cm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d1 = cm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d2 = cm.make_combinatorial_hexahedron();
|
||||
|
||||
// 1) Create and initialize 2-attributes.
|
||||
for (CMap_3::One_dart_per_cell_range<2>::iterator
|
||||
|
|
@ -85,14 +85,14 @@ int main()
|
|||
cm.onmerge_functor<2>()=Merge_functor();
|
||||
|
||||
// 3) 3-Sew the two hexahedra along one face. This calls 1 onmerge.
|
||||
cm.sew<3>(dh1, dh2);
|
||||
cm.sew<3>(d1, d2);
|
||||
|
||||
// 4) Display all the values of 2-attributes.
|
||||
display_map_and_2attributes(cm);
|
||||
|
||||
// 5) Insert a vertex in the face between the two hexahedra.
|
||||
// This calls 3 onsplit.
|
||||
Dart_descriptor resdart=cm.insert_cell_0_in_cell_2(dh2);
|
||||
Dart_descriptor resdart=cm.insert_cell_0_in_cell_2(d2);
|
||||
|
||||
// 6) Display all the values of 2-attributes.
|
||||
display_map_and_2attributes(cm);
|
||||
|
|
|
|||
|
|
@ -23,21 +23,21 @@ int main()
|
|||
}
|
||||
|
||||
// 2) Create two tetrahedra.
|
||||
Dart_descriptor dh1 = cm.make_combinatorial_tetrahedron();
|
||||
Dart_descriptor dh2 = cm.make_combinatorial_tetrahedron();
|
||||
Dart_descriptor d1 = cm.make_combinatorial_tetrahedron();
|
||||
Dart_descriptor d2 = cm.make_combinatorial_tetrahedron();
|
||||
|
||||
// 3) 3-sew them.
|
||||
cm.sew<3>(dh1, dh2);
|
||||
cm.sew<3>(d1, d2);
|
||||
|
||||
// 4) Mark the darts belonging to the first tetrahedron.
|
||||
for (CMap_3::Dart_of_cell_range<3>::iterator
|
||||
it(cm.darts_of_cell<3>(dh1).begin()),
|
||||
itend(cm.darts_of_cell<3>(dh1).end()); it!=itend; ++it)
|
||||
it(cm.darts_of_cell<3>(d1).begin()),
|
||||
itend(cm.darts_of_cell<3>(d1).end()); it!=itend; ++it)
|
||||
cm.mark(it, amark);
|
||||
|
||||
// 4) Remove the common 2-cell between the two cubes:
|
||||
// the two tetrahedra are merged.
|
||||
cm.remove_cell<2>(dh1);
|
||||
cm.remove_cell<2>(d1);
|
||||
|
||||
// 5) Thanks to the mark, we know which darts come from the first tetrahedron.
|
||||
unsigned int res=0;
|
||||
|
|
|
|||
|
|
@ -11,35 +11,35 @@ int main()
|
|||
CMap_3 cm;
|
||||
|
||||
// Create one combinatorial hexahedron.
|
||||
Dart_descriptor dh1 = cm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d1 = cm.make_combinatorial_hexahedron();
|
||||
|
||||
// Add two edges along two opposite facets.
|
||||
assert( cm.is_insertable_cell_1_in_cell_2
|
||||
(cm.beta(dh1,1),cm.beta(dh1,0)) );
|
||||
(cm.beta(d1,1),cm.beta(d1,0)) );
|
||||
|
||||
cm.insert_cell_1_in_cell_2(cm.beta(dh1,1), cm.beta(dh1,0));
|
||||
cm.insert_cell_1_in_cell_2(cm.beta(d1,1), cm.beta(d1,0));
|
||||
assert( cm.is_valid() );
|
||||
|
||||
Dart_descriptor dh2=cm.beta(dh1,2,1,1,2);
|
||||
Dart_descriptor d2=cm.beta(d1,2,1,1,2);
|
||||
|
||||
assert( cm.is_insertable_cell_1_in_cell_2
|
||||
(dh2,cm.beta(dh2,1,1)) );
|
||||
(d2,cm.beta(d2,1,1)) );
|
||||
|
||||
cm.insert_cell_1_in_cell_2(dh2, cm.beta(dh2,1,1));
|
||||
cm.insert_cell_1_in_cell_2(d2, cm.beta(d2,1,1));
|
||||
assert( cm.is_valid() );
|
||||
|
||||
// Insert a facet along these two new edges plus two initial edges
|
||||
// of the hexahedron.
|
||||
std::vector<Dart_descriptor> path;
|
||||
path.push_back(cm.beta(dh1,1));
|
||||
path.push_back(cm.beta(dh1,0,2,1));
|
||||
path.push_back(cm.beta(dh2,0));
|
||||
path.push_back(cm.beta(dh2,2,1));
|
||||
path.push_back(cm.beta(d1,1));
|
||||
path.push_back(cm.beta(d1,0,2,1));
|
||||
path.push_back(cm.beta(d2,0));
|
||||
path.push_back(cm.beta(d2,2,1));
|
||||
|
||||
assert( (cm.is_insertable_cell_2_in_cell_3
|
||||
(path.begin(),path.end())) );
|
||||
|
||||
Dart_descriptor dh3=cm.insert_cell_2_in_cell_3(path.begin(),path.end());
|
||||
Dart_descriptor d3=cm.insert_cell_2_in_cell_3(path.begin(),path.end());
|
||||
assert( cm.is_valid() );
|
||||
|
||||
// Display the combinatorial map characteristics.
|
||||
|
|
@ -47,16 +47,16 @@ int main()
|
|||
cm.is_valid() << std::endl;
|
||||
|
||||
// We use the removal operations to get back to the initial hexahedron.
|
||||
assert( (cm.is_removable<2>(dh3)) );
|
||||
cm.remove_cell<2>(dh3);
|
||||
assert( (cm.is_removable<2>(d3)) );
|
||||
cm.remove_cell<2>(d3);
|
||||
assert( cm.is_valid() );
|
||||
|
||||
assert( (cm.is_removable<1>(cm.beta(dh1,1))) );
|
||||
cm.remove_cell<1>(cm.beta(dh1,1));
|
||||
assert( (cm.is_removable<1>(cm.beta(d1,1))) );
|
||||
cm.remove_cell<1>(cm.beta(d1,1));
|
||||
assert( cm.is_valid() );
|
||||
|
||||
assert( (cm.is_removable<1>(cm.beta(dh2,0))) );
|
||||
cm.remove_cell<1>(cm.beta(dh2,0));
|
||||
assert( (cm.is_removable<1>(cm.beta(d2,0))) );
|
||||
cm.remove_cell<1>(cm.beta(d2,0));
|
||||
assert( cm.is_valid() );
|
||||
|
||||
// Display the combinatorial map characteristics.
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ int main()
|
|||
CMap_3 cm;
|
||||
|
||||
// Create two tetrahedra.
|
||||
Dart_const_descriptor dh1 = cm.make_combinatorial_tetrahedron();
|
||||
Dart_const_descriptor dh2 = cm.make_combinatorial_tetrahedron();
|
||||
Dart_const_descriptor d1 = cm.make_combinatorial_tetrahedron();
|
||||
Dart_const_descriptor d2 = cm.make_combinatorial_tetrahedron();
|
||||
|
||||
// Display the combinatorial map characteristics.
|
||||
cm.display_characteristics(std::cout);
|
||||
|
|
@ -22,20 +22,20 @@ int main()
|
|||
// Note that CMap_3::Dart_of_orbit_range<1,2> in 3D is equivalent to
|
||||
// CMap_3::Dart_of_cell_range<3>.
|
||||
for (CMap_3::Dart_of_orbit_range<1,2>::const_iterator
|
||||
it(cm.darts_of_orbit<1,2>(dh1).begin()),
|
||||
itend(cm.darts_of_orbit<1,2>(dh1).end()); it!=itend; ++it)
|
||||
it(cm.darts_of_orbit<1,2>(d1).begin()),
|
||||
itend(cm.darts_of_orbit<1,2>(d1).end()); it!=itend; ++it)
|
||||
++res;
|
||||
|
||||
std::cout<<"Number of darts of the first tetrahedron: "<<res<<std::endl;
|
||||
|
||||
res = 0;
|
||||
// Iterate over all the darts of the facet containing dh2.
|
||||
// Iterate over all the darts of the facet containing d2.
|
||||
for (CMap_3::Dart_of_orbit_range<1>::const_iterator
|
||||
it(cm.darts_of_orbit<1>(dh2).begin()),
|
||||
itend(cm.darts_of_orbit<1>(dh2).end()); it!=itend; ++it)
|
||||
it(cm.darts_of_orbit<1>(d2).begin()),
|
||||
itend(cm.darts_of_orbit<1>(d2).end()); it!=itend; ++it)
|
||||
++res;
|
||||
|
||||
std::cout<<"Number of darts of the facet containing dh2: "<<res<<std::endl;
|
||||
std::cout<<"Number of darts of the facet containing d2: "<<res<<std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ int main()
|
|||
CMap_3 cm;
|
||||
|
||||
// Create 2 hexahedra.
|
||||
Dart_descriptor dh1 = cm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor dh2 = cm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d1 = cm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d2 = cm.make_combinatorial_hexahedron();
|
||||
|
||||
// 1) Create all 2-attributes and associated them to darts.
|
||||
for (CMap_3::Dart_range::iterator
|
||||
|
|
@ -53,18 +53,18 @@ int main()
|
|||
|
||||
// 2) Set the color of all facets of the first hexahedron to 7.
|
||||
for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
|
||||
it=cm.one_dart_per_incident_cell<2,3>(dh1).begin(),
|
||||
itend=cm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
|
||||
it=cm.one_dart_per_incident_cell<2,3>(d1).begin(),
|
||||
itend=cm.one_dart_per_incident_cell<2,3>(d1).end(); it!=itend; ++it)
|
||||
{ cm.info<2>(it)=7; }
|
||||
|
||||
// 3) Set the color of all facets of the second hexahedron to 13.
|
||||
for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
|
||||
cm.one_dart_per_incident_cell<2,3>(dh2).begin(),
|
||||
itend=cm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
|
||||
cm.one_dart_per_incident_cell<2,3>(d2).begin(),
|
||||
itend=cm.one_dart_per_incident_cell<2,3>(d2).end(); it!=itend; ++it)
|
||||
{ cm.info<2>(it)=13; }
|
||||
|
||||
// 4) 3-Sew the two hexahedra along one facet.
|
||||
cm.sew<3>(dh1, dh2);
|
||||
cm.sew<3>(d1, d2);
|
||||
|
||||
// 5) Display all the values of 2-attributes.
|
||||
for (CMap_3::Attribute_range<2>::type::iterator
|
||||
|
|
@ -76,7 +76,7 @@ int main()
|
|||
std::cout<<std::endl;
|
||||
|
||||
// 6) Insert a vertex in the facet between the two hexahedra.
|
||||
cm.insert_cell_0_in_cell_2(dh2);
|
||||
cm.insert_cell_0_in_cell_2(d2);
|
||||
|
||||
// 7) Display all the values of 2-attributes.
|
||||
for (CMap_3::Attribute_range<2>::type::iterator
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ typedef GMap_2::Dart_descriptor Dart_descriptor;
|
|||
int main()
|
||||
{
|
||||
GMap_2 gm;
|
||||
Dart_descriptor dh=gm.make_combinatorial_polygon(4);
|
||||
gm.sew<2>(dh, gm.alpha<1,0,1,0>(dh));
|
||||
Dart_descriptor d=gm.make_combinatorial_polygon(4);
|
||||
gm.sew<2>(d, gm.alpha<1,0,1,0>(d));
|
||||
|
||||
gm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<gm.is_valid()<<std::endl;
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ int main()
|
|||
GMap_3 gm;
|
||||
|
||||
// 0) Create 2 hexahedra.
|
||||
Dart_descriptor dh1 = gm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor dh2 = gm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d1 = gm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d2 = gm.make_combinatorial_hexahedron();
|
||||
|
||||
// 1) Create and initialize 2-attributes.
|
||||
for (GMap_3::One_dart_per_cell_range<2>::iterator
|
||||
|
|
@ -87,14 +87,14 @@ int main()
|
|||
gm.onmerge_functor<2>()=Merge_functor();
|
||||
|
||||
// 3) 3-Sew the two hexahedra along one face. This calls 1 onmerge.
|
||||
gm.sew<3>(dh1, dh2);
|
||||
gm.sew<3>(d1, d2);
|
||||
|
||||
// 4) Display all the values of 2-attributes.
|
||||
display_map_and_2attributes(gm);
|
||||
|
||||
// 5) Insert a vertex in the face between the two hexahedra.
|
||||
// This calls 3 onsplit.
|
||||
Dart_descriptor resdart=gm.insert_cell_0_in_cell_2(dh2);
|
||||
Dart_descriptor resdart=gm.insert_cell_0_in_cell_2(d2);
|
||||
|
||||
// 6) Display all the values of 2-attributes.
|
||||
display_map_and_2attributes(gm);
|
||||
|
|
|
|||
|
|
@ -24,27 +24,27 @@ int main()
|
|||
}
|
||||
|
||||
// 2) Create two tetrahedra.
|
||||
Dart_descriptor dh1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_descriptor dh2 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_descriptor d1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_descriptor d2 = gm.make_combinatorial_tetrahedron();
|
||||
|
||||
assert( gm.is_valid() );
|
||||
assert( gm.is_volume_combinatorial_tetrahedron(dh1) );
|
||||
assert( gm.is_volume_combinatorial_tetrahedron(dh2) );
|
||||
assert( gm.is_volume_combinatorial_tetrahedron(d1) );
|
||||
assert( gm.is_volume_combinatorial_tetrahedron(d2) );
|
||||
|
||||
// 3) 3-sew them.
|
||||
gm.sew<3>(dh1, dh2);
|
||||
gm.sew<3>(d1, d2);
|
||||
|
||||
// 4) Mark the darts belonging to the first tetrahedron.
|
||||
|
||||
// Mark the darts belonging to the first tetrahedron.
|
||||
for (GMap_3::Dart_of_cell_range<3>::iterator
|
||||
it(gm.darts_of_cell<3>(dh1).begin()),
|
||||
itend(gm.darts_of_cell<3>(dh1).end()); it!=itend; ++it)
|
||||
it(gm.darts_of_cell<3>(d1).begin()),
|
||||
itend(gm.darts_of_cell<3>(d1).end()); it!=itend; ++it)
|
||||
gm.mark(it, amark);
|
||||
|
||||
// 4) Remove the common 2-cell between the two cubes:
|
||||
// the two tetrahedra are merged.
|
||||
gm.remove_cell<2>(dh1);
|
||||
gm.remove_cell<2>(d1);
|
||||
|
||||
// 5) Thanks to the mark, we know which darts come from the first tetrahedron.
|
||||
unsigned int res=0;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ int main()
|
|||
GMap_3 gm;
|
||||
|
||||
// Create two tetrahedra.
|
||||
Dart_const_descriptor dh1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_const_descriptor dh2 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_const_descriptor d1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_const_descriptor d2 = gm.make_combinatorial_tetrahedron();
|
||||
|
||||
// Display the generalized map characteristics.
|
||||
gm.display_characteristics(std::cout);
|
||||
|
|
@ -22,20 +22,20 @@ int main()
|
|||
// Note that GMap_3::Dart_of_orbit_range<0,1,2> in 3D is equivalent to
|
||||
// GMap_3::Dart_of_cell_range<3>.
|
||||
for (GMap_3::Dart_of_orbit_range<0,1,2>::const_iterator
|
||||
it(gm.darts_of_orbit<0,1,2>(dh1).begin()),
|
||||
itend(gm.darts_of_orbit<0,1,2>(dh1).end()); it!=itend; ++it)
|
||||
it(gm.darts_of_orbit<0,1,2>(d1).begin()),
|
||||
itend(gm.darts_of_orbit<0,1,2>(d1).end()); it!=itend; ++it)
|
||||
++res;
|
||||
|
||||
std::cout<<"Number of darts of the first tetrahedron: "<<res<<std::endl;
|
||||
|
||||
res = 0;
|
||||
// Iterate through all the darts of the face incident to dh2.
|
||||
// Iterate through all the darts of the face incident to d2.
|
||||
for (GMap_3::Dart_of_orbit_range<0,1>::const_iterator
|
||||
it(gm.darts_of_orbit<0,1>(dh2).begin()),
|
||||
itend(gm.darts_of_orbit<0,1>(dh2).end()); it!=itend; ++it)
|
||||
it(gm.darts_of_orbit<0,1>(d2).begin()),
|
||||
itend(gm.darts_of_orbit<0,1>(d2).end()); it!=itend; ++it)
|
||||
++res;
|
||||
|
||||
std::cout<<"Number of darts of the face incident to dh2: "<<res<<std::endl;
|
||||
std::cout<<"Number of darts of the face incident to d2: "<<res<<std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ int main()
|
|||
GMap_3 gm;
|
||||
|
||||
// Create 2 hexahedra.
|
||||
Dart_descriptor dh1 = gm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor dh2 = gm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d1 = gm.make_combinatorial_hexahedron();
|
||||
Dart_descriptor d2 = gm.make_combinatorial_hexahedron();
|
||||
|
||||
// 1) Create all 2-attributes and associated them to darts.
|
||||
for (GMap_3::Dart_range::iterator
|
||||
|
|
@ -53,18 +53,18 @@ int main()
|
|||
|
||||
// 2) Set the color of all facets of the first hexahedron to 7.
|
||||
for (GMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
|
||||
it=gm.one_dart_per_incident_cell<2,3>(dh1).begin(),
|
||||
itend=gm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
|
||||
it=gm.one_dart_per_incident_cell<2,3>(d1).begin(),
|
||||
itend=gm.one_dart_per_incident_cell<2,3>(d1).end(); it!=itend; ++it)
|
||||
{ gm.info<2>(it)=7; }
|
||||
|
||||
// 3) Set the color of all facets of the second hexahedron to 13.
|
||||
for (GMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
|
||||
gm.one_dart_per_incident_cell<2,3>(dh2).begin(),
|
||||
itend=gm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
|
||||
gm.one_dart_per_incident_cell<2,3>(d2).begin(),
|
||||
itend=gm.one_dart_per_incident_cell<2,3>(d2).end(); it!=itend; ++it)
|
||||
{ gm.info<2>(it)=13; }
|
||||
|
||||
// 4) 3-Sew the two hexahedra along one facet.
|
||||
gm.sew<3>(dh1, dh2);
|
||||
gm.sew<3>(d1, d2);
|
||||
|
||||
// 5) Display all the values of 2-attributes.
|
||||
for (GMap_3::Attribute_range<2>::type::iterator
|
||||
|
|
@ -76,7 +76,7 @@ int main()
|
|||
std::cout<<std::endl;
|
||||
|
||||
// 6) Insert a vertex in the facet between the two hexahedra.
|
||||
gm.insert_cell_0_in_cell_2(dh2);
|
||||
gm.insert_cell_0_in_cell_2(d2);
|
||||
|
||||
// 7) Display all the values of 2-attributes.
|
||||
for (GMap_3::Attribute_range<2>::type::iterator
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@ typedef LCC::Point Point;
|
|||
int main()
|
||||
{
|
||||
LCC lcc;
|
||||
Dart_descriptor dh1=
|
||||
Dart_descriptor d1=
|
||||
lcc.make_hexahedron(Point(0,0,0), Point(5,0,0),
|
||||
Point(5,5,0), Point(0,5,0),
|
||||
Point(0,5,4), Point(0,0,4),
|
||||
Point(5,0,4), Point(5,5,4));
|
||||
Dart_descriptor dh2=
|
||||
Dart_descriptor d2=
|
||||
lcc.make_hexahedron(Point(5,0,0), Point(10,0,0),
|
||||
Point(10,5,0), Point(5,5,0),
|
||||
Point(5,5,4), Point(5,0,4),
|
||||
Point(10,0,4), Point(10,5,4));
|
||||
|
||||
lcc.sew<3>(lcc.beta(dh1, 1, 1, 2), lcc.beta(dh2, 2));
|
||||
lcc.sew<3>(lcc.beta(d1, 1, 1, 2), lcc.beta(d2, 2));
|
||||
|
||||
lcc.display_characteristics(std::cout)<<", valid="
|
||||
<<lcc.is_valid()<<std::endl;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ void load_and_simplify_off(LCC_3& lcc, const std::string& filename,
|
|||
{
|
||||
CGAL::load_off(lcc, ifile);
|
||||
CGAL::Timer timer;
|
||||
Dart_descriptor dh;
|
||||
Dart_descriptor d;
|
||||
std::size_t nb=(lcc.number_of_darts()*percent)/200;
|
||||
timer.start();
|
||||
|
||||
|
|
@ -25,9 +25,9 @@ void load_and_simplify_off(LCC_3& lcc, const std::string& filename,
|
|||
for (LCC_3::Dart_range::iterator it=lcc.darts().begin(),
|
||||
itend=lcc.darts().end(); it!=itend && nb>0; )
|
||||
{
|
||||
dh=it++;
|
||||
if ( it!=itend && it==lcc.beta<2>(dh) ) ++it;
|
||||
lcc.remove_cell<1>(dh);
|
||||
d=it++;
|
||||
if ( it!=itend && it==lcc.beta<2>(d) ) ++it;
|
||||
lcc.remove_cell<1>(d);
|
||||
--nb;
|
||||
}
|
||||
if ( !updateattribs ) lcc.set_automatic_attributes_management(true);
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ template<typename LCC,
|
|||
typename Map=typename LCC::Combinatorial_data_structure>
|
||||
struct Alpha1
|
||||
{
|
||||
static typename LCC::Dart_descriptor run(LCC&, typename LCC::Dart_descriptor dh)
|
||||
{ return dh; }
|
||||
static typename LCC::Dart_descriptor run(LCC&, typename LCC::Dart_descriptor d)
|
||||
{ return d; }
|
||||
};
|
||||
template<typename LCC>
|
||||
struct Alpha1<LCC, CGAL::Generalized_map_tag>
|
||||
{
|
||||
static typename LCC::Dart_descriptor run(LCC& lcc, typename LCC::Dart_descriptor dh)
|
||||
{ return lcc.template alpha<1>(dh); }
|
||||
static typename LCC::Dart_descriptor run(LCC& lcc, typename LCC::Dart_descriptor d)
|
||||
{ return lcc.template alpha<1>(d); }
|
||||
};
|
||||
|
||||
template<typename LCC>
|
||||
|
|
@ -27,40 +27,40 @@ void run_test()
|
|||
|
||||
LCC lcc;
|
||||
|
||||
Dart_descriptor dh1 = lcc.
|
||||
Dart_descriptor d1 = lcc.
|
||||
make_hexahedron(Point(0,0,0),Point(1,0,0),
|
||||
Point(1,2,0),Point(0,2,0),
|
||||
Point(0,3,4),Point(0,0,4),
|
||||
Point(6,0,4),Point(6,3,4));
|
||||
Dart_descriptor dh2 = lcc.
|
||||
Dart_descriptor d2 = lcc.
|
||||
make_hexahedron(Point(0,-5,0),Point(2,-5,0),
|
||||
Point(2,-2,0),Point(0,-2,0),
|
||||
Point(1,-1,5),Point(1,-2,5),
|
||||
Point(5,-2,5),Point(5,-2,5));
|
||||
Dart_descriptor dh3 = lcc.
|
||||
Dart_descriptor d3 = lcc.
|
||||
make_hexahedron(Point(1,0,5),Point(0,0,6),
|
||||
Point(0,2,5),Point(1,2,6),
|
||||
Point(1,3,8),Point(0,0,8),
|
||||
Point(5,0,9),Point(7,3,9));
|
||||
|
||||
lcc.template sew<3>(dh1,lcc.other_orientation
|
||||
lcc.template sew<3>(d1,lcc.other_orientation
|
||||
(lcc.template opposite<2>
|
||||
(lcc.next(lcc.next(lcc.template opposite<2>(dh2))))));
|
||||
lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)),
|
||||
lcc.other_orientation(lcc.template opposite<2>(lcc.previous(dh3))));
|
||||
(lcc.next(lcc.next(lcc.template opposite<2>(d2))))));
|
||||
lcc.template sew<3>(lcc.template opposite<2>(lcc.next(d1)),
|
||||
lcc.other_orientation(lcc.template opposite<2>(lcc.previous(d3))));
|
||||
|
||||
lcc.insert_cell_1_in_cell_2(lcc.next(dh1),
|
||||
Alpha1<LCC>::run(lcc, lcc.previous(dh1)));
|
||||
dh2=lcc.template opposite<2>(lcc.next(lcc.next
|
||||
(lcc.template opposite<2>(dh1))));
|
||||
lcc.insert_cell_1_in_cell_2(dh2, Alpha1<LCC>::run
|
||||
(lcc, lcc.next(lcc.next(dh2))));
|
||||
lcc.insert_cell_1_in_cell_2(lcc.next(d1),
|
||||
Alpha1<LCC>::run(lcc, lcc.previous(d1)));
|
||||
d2=lcc.template opposite<2>(lcc.next(lcc.next
|
||||
(lcc.template opposite<2>(d1))));
|
||||
lcc.insert_cell_1_in_cell_2(d2, Alpha1<LCC>::run
|
||||
(lcc, lcc.next(lcc.next(d2))));
|
||||
|
||||
std::vector<Dart_descriptor> path;
|
||||
path.push_back(lcc.next(dh1));
|
||||
path.push_back(lcc.next(lcc.template opposite<2>(lcc.previous(dh1))));
|
||||
path.push_back(lcc.previous(dh2));
|
||||
path.push_back(lcc.next(lcc.template opposite<2>(dh2)));
|
||||
path.push_back(lcc.next(d1));
|
||||
path.push_back(lcc.next(lcc.template opposite<2>(lcc.previous(d1))));
|
||||
path.push_back(lcc.previous(d2));
|
||||
path.push_back(lcc.next(lcc.template opposite<2>(d2)));
|
||||
lcc.insert_cell_2_in_cell_3(path.begin(),path.end());
|
||||
|
||||
lcc.display_characteristics(std::cout) << ", valid="
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ int main(int narg, char** argv)
|
|||
std::map<Triangulation::Face_handle,
|
||||
LCC_2::Dart_descriptor > face_to_dart;
|
||||
|
||||
Dart_descriptor dh=CGAL::import_from_triangulation_2<LCC_2, Triangulation>
|
||||
Dart_descriptor d=CGAL::import_from_triangulation_2<LCC_2, Triangulation>
|
||||
(lcc, T, &face_to_dart);
|
||||
assert(lcc.is_without_boundary());
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ int main(int narg, char** argv)
|
|||
|
||||
// 3) Compute the dual lcc.
|
||||
LCC_2 dual_lcc;
|
||||
Dart_descriptor ddh=lcc.dual(dual_lcc, dh);
|
||||
Dart_descriptor dd=lcc.dual(dual_lcc, d);
|
||||
// Here, dual_lcc is the 2D Voronoi diagram.
|
||||
assert(dual_lcc.is_without_boundary());
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ int main(int narg, char** argv)
|
|||
<< dual_lcc.is_valid()
|
||||
<< std::endl;
|
||||
|
||||
display_voronoi(dual_lcc, ddh);
|
||||
display_voronoi(dual_lcc, dd);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ int main(int narg, char** argv)
|
|||
std::map<Triangulation::Cell_handle,
|
||||
LCC_3::Dart_descriptor > vol_to_dart;
|
||||
|
||||
Dart_descriptor dh=CGAL::import_from_triangulation_3<LCC_3, Triangulation>
|
||||
Dart_descriptor d=CGAL::import_from_triangulation_3<LCC_3, Triangulation>
|
||||
(lcc, T, &vol_to_dart);
|
||||
|
||||
std::cout<<"Delaunay triangulation :"<<std::endl<<" ";
|
||||
|
|
@ -143,7 +143,7 @@ int main(int narg, char** argv)
|
|||
|
||||
// 3) Compute the dual lcc.
|
||||
LCC_3 dual_lcc;
|
||||
Dart_descriptor ddh=lcc.dual(dual_lcc, dh);
|
||||
Dart_descriptor dd=lcc.dual(dual_lcc, d);
|
||||
// Here, dual_lcc is the 3D Voronoi diagram.
|
||||
assert(dual_lcc.is_without_boundary());
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ int main(int narg, char** argv)
|
|||
dual_lcc.display_characteristics(std::cout) << ", valid="
|
||||
<< dual_lcc.is_valid()
|
||||
<< std::endl;
|
||||
display_voronoi(dual_lcc, ddh);
|
||||
display_voronoi(dual_lcc, dd);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue