Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cubical complex functions #1390

Merged
Merged
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
the exterior. (Jacques-Olivier Lachaud,
[#1377](https://github.com/DGtal-team/DGtal/pull/1377))

- This PR fixes two issues related to CubicalComplexFunctions:
issue [#1362](https://github.com/DGtal-team/DGtal/issues/1362) and
issue [#1381](https://github.com/DGtal-team/DGtal/issues/1381) for
programs testCubicalComplex, testVoxelComplex and
testParDirCollapse. (Jacques-Olivier Lachaud,
[#1390](https://github.com/DGtal-team/DGtal/pull/1390))

- *Miscellaneous*
- Fix Small bug in Integral Invariant Volume Estimator in 2D
(Thomas Caissard, [#1316](https://github.com/DGtal-team/DGtal/pull/1316))
Expand Down
1 change: 0 additions & 1 deletion examples/topology/cubical-complex-collapse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/topology/KhalimskySpaceND.h"
#include "DGtal/topology/CubicalComplex.h"
#include "DGtal/topology/CubicalComplexFunctions.h"

///////////////////////////////////////////////////////////////////////////////

Expand Down
1 change: 0 additions & 1 deletion examples/topology/cubical-complex-illustrations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

#include "DGtal/topology/KhalimskySpaceND.h"
#include "DGtal/topology/CubicalComplex.h"
#include "DGtal/topology/CubicalComplexFunctions.h"
#include "DGtal/io/boards/Board2D.h"

///////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/DGtal/io/viewers/Viewer3D.ih
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ void DGtal::Viewer3D<TSpace, TKSpace>::init()
#if !defined (QGLVIEWER_VERSION) || QGLVIEWER_VERSION < 0x020500
setMouseBindingDescription((Qt::ControlModifier|Qt::ShiftModifier) + Qt::LeftButton, "move light source position defined in the main coordinate system (an x-axis (resp. y-axis) mouse move changes the azimuth (resp. inclination) angle of the light source). Note that light source is always looking at the center point (0,0,0).");
#else
setMouseBindingDescription(Qt::ControlModifier|Qt::ShiftModifier, Qt::LeftButton, "move light source position defined in the main coordinate system (an x-axis (resp. y-axis) mouse move changes the azimuth (resp. inclination) angle of the light source). Note that light source is always looking at the center point (0,0,0).");
setMouseBindingDescription(Qt::KeyboardModifiers( Qt::ControlModifier|Qt::ShiftModifier ), Qt::LeftButton, "move light source position defined in the main coordinate system (an x-axis (resp. y-axis) mouse move changes the azimuth (resp. inclination) angle of the light source). Note that light source is always looking at the center point (0,0,0).");
#endif


Expand Down
146 changes: 72 additions & 74 deletions src/DGtal/topology/CubicalComplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,64 +83,62 @@ namespace DGtal
template < typename TKSpace, typename TCellContainer >
class CubicalComplex;

namespace functions {
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >&
operator|=( CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >&
operator&=( CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >&
operator^=( CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >&
operator-=( CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator| ( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator& ( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator^ ( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator- ( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );

template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator~ ( const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator* ( const CubicalComplex< TKSpace, TCellContainer >& );

template < typename TKSpace, typename TCellContainer >
bool
operator==( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
bool
operator!=( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
bool
operator<=( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
bool
operator>=( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
} // namespace functions
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >&
operator|=( CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >&
operator&=( CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >&
operator^=( CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >&
operator-=( CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator| ( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator& ( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator^ ( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator- ( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );

template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator~ ( const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
CubicalComplex< TKSpace, TCellContainer >
operator* ( const CubicalComplex< TKSpace, TCellContainer >& );

template < typename TKSpace, typename TCellContainer >
bool
operator==( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
bool
operator!=( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
bool
operator<=( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );
template < typename TKSpace, typename TCellContainer >
bool
operator>=( const CubicalComplex< TKSpace, TCellContainer >&,
const CubicalComplex< TKSpace, TCellContainer >& );


/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -189,20 +187,20 @@ namespace DGtal
// BOOST_CONCEPT_ASSERT(( boost::PairAssociativeContainer< TCellContainer > ));
BOOST_CONCEPT_ASSERT(( concepts::CSTLAssociativeContainer< TCellContainer > ));

friend Self& DGtal::functions::operator|=<>( Self&, const Self& );
friend Self& DGtal::functions::operator&=<>( Self&, const Self& );
friend Self& DGtal::functions::operator^=<>( Self&, const Self& );
friend Self& DGtal::functions::operator-=<>( Self&, const Self& );
friend Self DGtal::functions::operator| <>( const Self&, const Self& );
friend Self DGtal::functions::operator& <>( const Self&, const Self& );
friend Self DGtal::functions::operator^ <>( const Self&, const Self& );
friend Self DGtal::functions::operator- <>( const Self&, const Self& );
friend Self DGtal::functions::operator~ <>( const Self& );
friend Self DGtal::functions::operator* <>( const Self& );
friend bool DGtal::functions::operator==<>( const Self&, const Self& );
friend bool DGtal::functions::operator!=<>( const Self&, const Self& );
friend bool DGtal::functions::operator<=<>( const Self&, const Self& );
friend bool DGtal::functions::operator>=<>( const Self&, const Self& );
friend Self& DGtal::operator|=<>( Self&, const Self& );
friend Self& DGtal::operator&=<>( Self&, const Self& );
friend Self& DGtal::operator^=<>( Self&, const Self& );
friend Self& DGtal::operator-=<>( Self&, const Self& );
friend Self DGtal::operator| <>( const Self&, const Self& );
friend Self DGtal::operator& <>( const Self&, const Self& );
friend Self DGtal::operator^ <>( const Self&, const Self& );
friend Self DGtal::operator- <>( const Self&, const Self& );
friend Self DGtal::operator~ <>( const Self& );
friend Self DGtal::operator* <>( const Self& );
friend bool DGtal::operator==<>( const Self&, const Self& );
friend bool DGtal::operator!=<>( const Self&, const Self& );
friend bool DGtal::operator<=<>( const Self&, const Self& );
friend bool DGtal::operator>=<>( const Self&, const Self& );

typedef TKSpace KSpace; ///< Type of the cellular grid space.
typedef TCellContainer CellContainer; ///< Type for storing cells, an associative container Cell -> Data
Expand Down Expand Up @@ -1208,7 +1206,7 @@ namespace DGtal
public:

/**
* Close the whole complex (see also DGtal::functions::operator~).
* Close the whole complex (see also DGtal::operator~).
*/
void close();

Expand All @@ -1219,7 +1217,7 @@ namespace DGtal
void close( Dimension k );

/**
* Open the whole complex (see also DGtal::functions::operator*).
* Open the whole complex (see also DGtal::operator*).
*/
void open();

Expand Down
14 changes: 7 additions & 7 deletions src/DGtal/topology/CubicalComplex.ih
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <cstdlib>
#include <queue>
#include "DGtal/base/SetFunctions.h"
#include "DGtal/topology/CubicalComplexFunctions.h"
JacquesOlivierLachaud marked this conversation as resolved.
Show resolved Hide resolved
//////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1058,7 +1059,6 @@ typename DGtal::CubicalComplex<TKSpace, TCellContainer>
DGtal::CubicalComplex<TKSpace, TCellContainer>::
link( const CubicalComplex& S, bool hintClosed, bool hintOpen ) const
{
using namespace ::DGtal::functions;
CubicalComplex cl_star_S = closure( star ( S, hintOpen ), hintClosed );
CubicalComplex star_cl_S = star ( closure( S, hintClosed ), hintOpen );

Expand Down Expand Up @@ -1089,11 +1089,11 @@ computeCellType( const Cell& c, CellMapIterator& it_cell_up, Dimension n )
uint32_t& data = (*it)->second.data;
if ( ! ( data & COLLAPSIBLE ) ) return Any;
if ( ! ( data & REMOVED ) )
{
++nb;
if ( nb > 1 ) return Any;
it_cell_up = *it;
}
{
++nb;
if ( nb > 1 ) return Any;
it_cell_up = *it;
}
}
return ( nb != 0 ) ? Free : Maximal ;
}
Expand Down Expand Up @@ -1148,7 +1148,7 @@ template <typename TKSpace, typename TCellContainer>
inline
std::ostream&
DGtal::operator<< ( std::ostream & out,
const CubicalComplex<TKSpace, TCellContainer> & object )
const CubicalComplex<TKSpace, TCellContainer> & object )
{
object.selfDisplay( out );
return out;
Expand Down
Loading