minor addons in the code, not in the API

This commit is contained in:
Sylvain Brandel 2014-06-13 16:02:55 +02:00
parent ec61d7cdc0
commit d62a535fd7
5 changed files with 38 additions and 21 deletions

View File

@ -1160,7 +1160,7 @@ namespace CGAL {
} }
/// validate the map /// validate the map
void validate_scene() void validate_attributes()
{ {
std::vector<int> marks(dimension+1); std::vector<int> marks(dimension+1);
for ( int i=0; i<=dimension; ++i) for ( int i=0; i<=dimension; ++i)

View File

@ -29,6 +29,7 @@ namespace CGAL
/** Insert a vertex in a given edge. /** Insert a vertex in a given edge.
* @param amap the used combinatorial map. * @param amap the used combinatorial map.
* @param adart a dart of the edge (!=NULL && !=null_dart_handle). * @param adart a dart of the edge (!=NULL && !=null_dart_handle).
* @param update_attributes a boolean to update the enabled attributes
* @return a dart of the new vertex. * @return a dart of the new vertex.
*/ */
template<class CMap> template<class CMap>
@ -116,6 +117,7 @@ insert_cell_0_in_cell_1( CMap& amap, typename CMap::Dart_handle adart,
* once for each inital edge of the facet. * once for each inital edge of the facet.
* @param amap the used combinatorial map. * @param amap the used combinatorial map.
* @param adart a dart of the facet to triangulate. * @param adart a dart of the facet to triangulate.
* @param update_attributes a boolean to update the enabled attributes
* @return A dart incident to the new vertex. * @return A dart incident to the new vertex.
*/ */
template < class CMap > template < class CMap >
@ -259,8 +261,11 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
amap.unmark(amap.beta(*itd, dim), treated); amap.unmark(amap.beta(*itd, dim), treated);
} }
if ( *itd!=adart ) if ( *itd!=adart )
CGAL::internal::Degroup_attribute_functor_run<CMap, 2>:: if (update_attributes)
run(&amap, adart, *itd); {
CGAL::internal::Degroup_attribute_functor_run<CMap, 2>::
run(&amap, adart, *itd);
}
} }
CGAL_assertion(amap.is_whole_map_unmarked(treated)); CGAL_assertion(amap.is_whole_map_unmarked(treated));
@ -275,6 +280,7 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
/** Insert a dangling edge in a 2-cell between given by a dart. /** Insert a dangling edge in a 2-cell between given by a dart.
* @param amap the used combinatorial map. * @param amap the used combinatorial map.
* @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle). * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
* @param update_attributes a boolean to update the enabled attributes
* @return a dart of the new edge, not incident to the vertex of adart1. * @return a dart of the new edge, not incident to the vertex of adart1.
*/ */
template<class CMap> template<class CMap>
@ -398,6 +404,7 @@ bool is_insertable_cell_1_in_cell_2(const CMap& amap,
* @param amap the used combinatorial map. * @param amap the used combinatorial map.
* @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle). * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
* @param adart2 a second dart of the facet. If NULL insert a dangling edge. * @param adart2 a second dart of the facet. If NULL insert a dangling edge.
* @param update_attributes a boolean to update the enabled attributes
* @return a dart of the new edge, and not incident to the * @return a dart of the new edge, and not incident to the
* same vertex than adart1. * same vertex than adart1.
*/ */
@ -487,6 +494,7 @@ insert_cell_1_in_cell_2(CMap& amap,
{ {
CGAL::internal::Degroup_attribute_functor_run<CMap, 2>::run(&amap, d1, d2); CGAL::internal::Degroup_attribute_functor_run<CMap, 2>::run(&amap, d1, d2);
} }
amap.negate_mark(m1); amap.negate_mark(m1);
amap.negate_mark(m2); amap.negate_mark(m2);
it1.rewind(); it2.rewind(); it1.rewind(); it2.rewind();
@ -571,6 +579,7 @@ bool is_insertable_cell_2_in_cell_3(const CMap& amap,
* @param amap the used combinatorial map. * @param amap the used combinatorial map.
* @param afirst iterator on the begining of the path. * @param afirst iterator on the begining of the path.
* @param alast iterator on the end of the path. * @param alast iterator on the end of the path.
* @param update_attributes a boolean to update the enabled attributes
* @return a dart of the new 2-cell. * @return a dart of the new 2-cell.
*/ */
template<class CMap, class InputIterator> template<class CMap, class InputIterator>

View File

@ -331,6 +331,7 @@ namespace CGAL
/** Remove a vertex, and merge eventually both incident edges. /** Remove a vertex, and merge eventually both incident edges.
* @param amap the used combinatorial map. * @param amap the used combinatorial map.
* @param adart a dart of the vertex to remove. * @param adart a dart of the vertex to remove.
* @param update_attributes a boolean to update the enabled attributes
* @return the number of deleted darts. * @return the number of deleted darts.
*/ */
template<class CMap,unsigned int nmi> template<class CMap,unsigned int nmi>
@ -449,6 +450,7 @@ namespace CGAL
/** Remove an i-cell, 0<=i<=dimension. /** Remove an i-cell, 0<=i<=dimension.
* @param amap the used combinatorial map. * @param amap the used combinatorial map.
* @param adart a dart of the i-cell to remove. * @param adart a dart of the i-cell to remove.
* @param update_attributes a boolean to update the enabled attributes
* @return the number of deleted darts. * @return the number of deleted darts.
*/ */
template < class CMap, unsigned int i > template < class CMap, unsigned int i >

View File

@ -1279,7 +1279,7 @@ void MainWindow::onMengerInc()
} }
std::cout << "validate scene..." << std::endl; std::cout << "validate scene..." << std::endl;
scene.lcc->validate_scene(); scene.lcc->validate_attributes();
} }
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
@ -1701,7 +1701,7 @@ void MainWindow::onMengerDec()
if (!mengerUpdateAttributes) if (!mengerUpdateAttributes)
{ {
scene.lcc->validate_scene(); scene.lcc->validate_attributes();
} }
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
@ -1976,7 +1976,7 @@ void MainWindow::onSierpinskiCarpetInc()
std::cout << "BOOST_NO_VARIADIC_TEMPLATES" << " not defined" << std::endl; std::cout << "BOOST_NO_VARIADIC_TEMPLATES" << " not defined" << std::endl;
#endif #endif
scene.lcc->validate_scene(); scene.lcc->validate_attributes();
// maintenant que la scène est valide, on offre la possibilité de calculer une géométrie qui correspond à un tapis de Sierpinski // maintenant que la scène est valide, on offre la possibilité de calculer une géométrie qui correspond à un tapis de Sierpinski
if (isComputableGeometry) if (isComputableGeometry)
@ -2747,7 +2747,7 @@ void MainWindow::onSierpinskiCarpetDec()
if (!duringConstructionUpdateAttributes) if (!duringConstructionUpdateAttributes)
{ {
scene.lcc->validate_scene(); scene.lcc->validate_attributes();
} }
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
@ -2931,7 +2931,7 @@ void MainWindow::onSierpinskiTriangleInc()
update_volume_list_add(scene.lcc->attribute<3>(sierpinskiTriangleSurfaces[i])); update_volume_list_add(scene.lcc->attribute<3>(sierpinskiTriangleSurfaces[i]));
} }
scene.lcc->validate_scene(); scene.lcc->validate_attributes();
} }
// std::cout << removedTriangles.size() << std::endl; // std::cout << removedTriangles.size() << std::endl;
@ -3153,7 +3153,7 @@ void MainWindow::onSierpinskiTriangleDec()
if (!sierpinskiTriangleUpdateAttributes) if (!sierpinskiTriangleUpdateAttributes)
{ {
scene.lcc->validate_scene(); scene.lcc->validate_attributes();
} }
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO

View File

@ -350,17 +350,17 @@ namespace CGAL {
/** validate the lcc /** validate the lcc
*/ */
void validate_scene() void validate_attributes()
{ {
Base::validate_scene(); Base::validate_attributes();
// On vérifie que chaque brin a un 0-plongement // Each dart needs to have a 0-embedding
for (typename Dart_range::iterator it(this->darts().begin()), for (typename Dart_range::iterator it(this->darts().begin()),
itend(this->darts().end()); it != itend; ++it) itend(this->darts().end()); it != itend; ++it)
{ {
if ( vertex_attribute(it)==null_handle ) if ( vertex_attribute(it)==null_handle )
{ {
// sinon on crée un point à l'origine // If a dart don't have a 0-attribute, we create a Point at the origin
set_vertex_attribute(it, create_vertex_attribute(CGAL::ORIGIN)); set_vertex_attribute(it, create_vertex_attribute(CGAL::ORIGIN));
} }
} }
@ -702,25 +702,27 @@ namespace CGAL {
/** Insert a point in a given 1-cell. /** Insert a point in a given 1-cell.
* @param dh a dart handle to the 1-cell * @param dh a dart handle to the 1-cell
* @param p the point to insert * @param p the point to insert
* @param update_attributes a boolean to update the enabled attributes
* @return a dart handle to the new vertex containing p. * @return a dart handle to the new vertex containing p.
*/ */
Dart_handle insert_point_in_cell_1(Dart_handle dh, const Point& p, bool update_attribute) Dart_handle insert_point_in_cell_1(Dart_handle dh, const Point& p, bool update_attributes)
{ {
return CGAL::insert_cell_0_in_cell_1(*this, dh, return CGAL::insert_cell_0_in_cell_1(*this, dh,
create_vertex_attribute(p), create_vertex_attribute(p),
update_attribute); update_attributes);
} }
/** Insert a point in a given 2-cell. /** Insert a point in a given 2-cell.
* @param dh a dart handle to the 2-cell * @param dh a dart handle to the 2-cell
* @param p the point to insert * @param p the point to insert
* @param update_attributes a boolean to update the enabled attributes
* @return a dart handle to the new vertex containing p. * @return a dart handle to the new vertex containing p.
*/ */
Dart_handle insert_point_in_cell_2(Dart_handle dh, const Point& p, bool update_attribute) Dart_handle insert_point_in_cell_2(Dart_handle dh, const Point& p, bool update_attributes)
{ {
Vertex_attribute_handle v = create_vertex_attribute(p); Vertex_attribute_handle v = create_vertex_attribute(p);
Dart_handle first = CGAL::insert_cell_0_in_cell_2(*this, dh, v, update_attribute); Dart_handle first = CGAL::insert_cell_0_in_cell_2(*this, dh, v, update_attributes);
if ( first==null_handle ) // If the triangulated facet was made of one dart if ( first==null_handle ) // If the triangulated facet was made of one dart
erase_vertex_attribute(v); erase_vertex_attribute(v);
@ -735,6 +737,7 @@ namespace CGAL {
/** Insert a point in a given i-cell. /** Insert a point in a given i-cell.
* @param dh a dart handle to the i-cell * @param dh a dart handle to the i-cell
* @param p the point to insert * @param p the point to insert
* @param update_attributes a boolean to update the enabled attributes
* @return a dart handle to the new vertex containing p. * @return a dart handle to the new vertex containing p.
*/ */
template <unsigned int i> template <unsigned int i>
@ -748,23 +751,26 @@ namespace CGAL {
/** Insert a dangling edge in a given facet. /** Insert a dangling edge in a given facet.
* @param dh a dart of the facet (!=NULL). * @param dh a dart of the facet (!=NULL).
* @param p the coordinates of the new vertex. * @param p the coordinates of the new vertex.
* @param update_attributes a boolean to update the enabled attributes
* @return a dart of the new edge, incident to the new vertex. * @return a dart of the new edge, incident to the new vertex.
*/ */
Dart_handle insert_dangling_cell_1_in_cell_2(Dart_handle dh, Dart_handle insert_dangling_cell_1_in_cell_2(Dart_handle dh,
const Point& p) const Point& p,
bool update_attributes = true)
{ {
return CGAL::insert_dangling_cell_1_in_cell_2 return CGAL::insert_dangling_cell_1_in_cell_2
(*this, dh, create_vertex_attribute(p)); (*this, dh, create_vertex_attribute(p), update_attributes);
} }
/** Insert a point in a given i-cell. /** Insert a point in a given i-cell.
* @param dh a dart handle to the i-cell * @param dh a dart handle to the i-cell
* @param p the point to insert * @param p the point to insert
* @param update_attributes a boolean to update the enabled attributes
* @return a dart handle to the new vertex containing p. * @return a dart handle to the new vertex containing p.
*/ */
template <unsigned int i> template <unsigned int i>
Dart_handle insert_barycenter_in_cell(Dart_handle dh) Dart_handle insert_barycenter_in_cell(Dart_handle dh, bool update_attributes = true)
{ return insert_point_in_cell<i>(dh, barycenter<i>(dh)); } { return insert_point_in_cell<i>(dh, barycenter<i>(dh), update_attributes); }
/** Compute the dual of a Linear_cell_complex. /** Compute the dual of a Linear_cell_complex.
* @param alcc the lcc in which we build the dual of this lcc. * @param alcc the lcc in which we build the dual of this lcc.