mirror of https://github.com/CGAL/cgal
* Re-add set_attribute method in CMap class (was removed by error).
* Make functors Is_removable_functor and Is_contractible_functor to avoid a warning.
This commit is contained in:
parent
450a07786b
commit
481908df1f
|
|
@ -985,6 +985,20 @@ namespace CGAL {
|
|||
(mattribute_containers).size();
|
||||
}
|
||||
|
||||
/** Set the i th attribute of all the darts of a given i-cell.
|
||||
* @param adart a dart of the i-cell.
|
||||
* @param ah the vertex to set.
|
||||
*/
|
||||
template<unsigned int i>
|
||||
void set_attribute(Dart_handle adart,
|
||||
typename Attribute_handle<i>::type ah)
|
||||
{
|
||||
CGAL_static_assertion(i<=dimension);
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"set_attribute<i> but i-attributes are disabled");
|
||||
Set_i_attribute_functor<Self,i>::run(this, adart, ah);
|
||||
}
|
||||
|
||||
/// @return a Attributes_range<i> (range through all the
|
||||
/// attributes<i> of the map).
|
||||
template<unsigned int i>
|
||||
|
|
|
|||
|
|
@ -126,10 +126,6 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
|||
while ( !first->template is_free<0>() && first->template beta<0>()!=adart )
|
||||
first = first->template beta<0>();
|
||||
|
||||
// Stack of couple of dart and dimension for which
|
||||
// we must call on_split functor
|
||||
std::deque<typename CMap::Dart_handle> modified_darts;
|
||||
|
||||
// Mark used to mark darts already treated.
|
||||
int treated = amap.get_new_mark();
|
||||
|
||||
|
|
@ -203,7 +199,6 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
|||
(nn1, prev->beta(dim));
|
||||
|
||||
amap.mark(cur->beta(dim), treated);
|
||||
tounmark.push_back(cur->beta(dim));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -240,7 +235,11 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
|||
itd=tounmark.begin(); itd!=tounmark.end(); ++itd )
|
||||
{
|
||||
amap.unmark(*itd, treated);
|
||||
|
||||
for (unsigned int dim=3; dim<=CMap::dimension; ++dim)
|
||||
{
|
||||
if ( !(*itd)->is_free(dim) )
|
||||
amap.unmark((*itd)->beta(dim), treated);
|
||||
}
|
||||
if ( *itd!=adart )
|
||||
CGAL::internal::Degroup_attribute_functor_run<CMap, 2>::
|
||||
run(&amap, adart, *itd);
|
||||
|
|
@ -300,9 +299,9 @@ insert_dangling_cell_1_in_cell_2( CMap& amap,
|
|||
if ( !it1->is_free(s1) )
|
||||
{
|
||||
if ( s1==0 )
|
||||
amap.template link_beta_1(it1->template beta<0>(), d2);
|
||||
amap.link_beta_1(it1->template beta<0>(), d2);
|
||||
else
|
||||
amap.template link_beta_0(it1->template beta<1>(), d2);
|
||||
amap.link_beta_0(it1->template beta<1>(), d2);
|
||||
}
|
||||
|
||||
if (s1==0)
|
||||
|
|
|
|||
|
|
@ -37,15 +37,11 @@ namespace CGAL
|
|||
* @param adart a dart of the i-cell.
|
||||
* @return true iff the i-cell can be removed.
|
||||
*/
|
||||
template < class CMap, unsigned int i >
|
||||
bool is_removable(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||
template <class CMap, unsigned int i, unsigned int nmi=CMap::dimension-i>
|
||||
struct Is_removable_functor
|
||||
{
|
||||
static bool run(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||
{
|
||||
CGAL_assertion( adart!=NULL );
|
||||
CGAL_static_assertion( 0<=i && i<=CMap::dimension );
|
||||
|
||||
if ( i==CMap::dimension ) return true;
|
||||
if ( i==CMap::dimension-1 ) return true;
|
||||
|
||||
// TODO? Optimisation for dim-2, and to not test all the darts of the cell?
|
||||
bool res = true;
|
||||
for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
|
||||
|
|
@ -57,6 +53,30 @@ namespace CGAL
|
|||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
// Specialization for i=CMap::dimension
|
||||
template <class CMap, unsigned int i>
|
||||
struct Is_removable_functor<CMap, i, 0>
|
||||
{
|
||||
static bool run(const CMap&, typename CMap::Dart_const_handle)
|
||||
{ return true; }
|
||||
};
|
||||
// Specialization for i=CMap::dimension-1
|
||||
template <class CMap, unsigned int i>
|
||||
struct Is_removable_functor<CMap, i, 1>
|
||||
{
|
||||
static bool run(const CMap&, typename CMap::Dart_const_handle)
|
||||
{ return true; }
|
||||
};
|
||||
/** Test if an i-cell can be removed.
|
||||
* An i-cell can be removed if i==CMap::dimension or i==CMap::dimension-1,
|
||||
* or if there are at most two (i+1)-cell incident to it.
|
||||
* @param adart a dart of the i-cell.
|
||||
* @return true iff the i-cell can be removed.
|
||||
*/
|
||||
template < class CMap, unsigned int i >
|
||||
bool is_removable(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||
{ return CGAL::Is_removable_functor<CMap, i>::run(amap,adart); }
|
||||
|
||||
/** Remove an i-cell, 0<i<dimension, and merge eventually both incident
|
||||
* (i+1)-cells.
|
||||
|
|
@ -432,14 +452,10 @@ namespace CGAL
|
|||
* @return true iff the i-cell can be contracted.
|
||||
*/
|
||||
template <class CMap, unsigned int i>
|
||||
bool is_contractible(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||
struct Is_contractible_functor
|
||||
{
|
||||
static bool run(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||
{
|
||||
CGAL_assertion(adart != NULL);
|
||||
CGAL_static_assertion(0<=i && i<=CMap::dimension);
|
||||
|
||||
if ( i==0 ) return false;
|
||||
if ( i==1 ) return true;
|
||||
|
||||
// TODO ? Optimisation possible to not test all the darts of the cell ?
|
||||
bool res = true;
|
||||
for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
|
||||
|
|
@ -451,6 +467,30 @@ namespace CGAL
|
|||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
// Specialization for i=0
|
||||
template <class CMap>
|
||||
struct Is_contractible_functor<CMap, 0>
|
||||
{
|
||||
static bool run(const CMap&, typename CMap::Dart_const_handle)
|
||||
{ return false; }
|
||||
};
|
||||
// Specialization for i=1
|
||||
template <class CMap>
|
||||
struct Is_contractible_functor<CMap, 1>
|
||||
{
|
||||
static bool run(const CMap&, typename CMap::Dart_const_handle)
|
||||
{ return true; }
|
||||
};
|
||||
/** Test if an i-cell can be contracted.
|
||||
* An i-cell can be contracted if i==1
|
||||
* or if there are at most two (i-1)-cell incident to it.
|
||||
* @param adart a dart of the i-cell.
|
||||
* @return true iff the i-cell can be contracted.
|
||||
*/
|
||||
template < class CMap, unsigned int i >
|
||||
bool is_contractible(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||
{ return CGAL::Is_contractible_functor<CMap, i>::run(amap,adart); }
|
||||
|
||||
/** Contract an i-cell, 1<i<=dimension, and merge eventually both incident
|
||||
* (i-1)-cells.
|
||||
|
|
|
|||
Loading…
Reference in New Issue