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

Minor edit #3

Merged
merged 3 commits into from
Sep 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions src/DGtal/geometry/volumes/distance/VoronoiMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ namespace DGtal
* The method associates to each point satisfying the foreground predicate,
* the closest site for which the predicate is false. This algorithm is
* @f$ O(h.d.|domain size|)@f$ if the separable metric "hiddenBy"
* predicate is in @f$ O(h)$@f$.
* predicate is in @f$ O(h)@f$.
*
* @param aDomain a pointer to the (hyper-rectangular) domain on
* which the computation is performed.
Expand All @@ -206,7 +206,7 @@ namespace DGtal
* The method associates to each point satisfying the foreground predicate,
* the closest site for which the predicate is false. This algorithm is
* @f$ O(h.d.|domain size|)@f$ if the separable metric "hiddenBy"
* predicate is in @f$ O(h)$@f$.
* predicate is in @f$ O(h)@f$.
*
* @param aDomain a pointer to the (hyper-rectangular) domain on
* which the computation is performed.
Expand All @@ -229,6 +229,11 @@ namespace DGtal
*/
~VoronoiMap();

/**
* Disabling default constructor.
*/
VoronoiMap() = delete;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, C++ doesn't implicitly declare the default constructor if any other constructor is defined. So deleting it is not mandatory even if it is clearer.


public:
// ------------------- ConstImage model ------------------------

Expand Down Expand Up @@ -289,10 +294,10 @@ namespace DGtal

/** Periodicity specification along one dimensions.
*
* @param n the dimension index.
* @param [in] n the dimension index.
* @return \c true if the n-th dimension is periodic, \c false otherwise.
*/
bool isPeriodic( Dimension n ) const
bool isPeriodic( const Dimension n ) const
{
return myPeriodicitySpec[ n ];
}
Expand Down Expand Up @@ -334,16 +339,6 @@ namespace DGtal
void computeOtherStep1D (const Point &row,
const Dimension dim) const;

// ------------------- protected methods ------------------------
protected:

/**
* Default Constructor.
*
*/
VoronoiMap();


// ------------------- Private members ------------------------
private:

Expand Down
5 changes: 2 additions & 3 deletions src/DGtal/geometry/volumes/distance/VoronoiMap.ih
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ DGtal::VoronoiMap<S,P, TSep, TImage>::compute( )
myUpperBoundCopy = myDomainPtr->upperBound();

//Point outside the domain
//myInfinity = myDomainPtr->upperBound() + Point::diagonal(1);
for ( auto & coord : myInfinity )
coord = DGtal::NumberTraits< typename Point::Coordinate >::max();

Expand All @@ -109,7 +108,7 @@ void
DGtal::VoronoiMap<S,P, TSep, TImage>::computeOtherSteps ( const Dimension dim ) const
{
#ifdef VERBOSE
std::string title = "Voro dimension " + boost::lexical_cast<std::string>( dim ) ;
std::string title = "VoronoiMap dimension " + boost::lexical_cast<std::string>( dim ) ;
trace.beginBlock ( title );
#endif

Expand Down Expand Up @@ -170,7 +169,7 @@ DGtal::VoronoiMap<S,P,TSep, TImage>::computeOtherStep1D ( const Point &startingP
// Extent along current dimension.
const auto extent = myUpperBoundCopy[dim] - myLowerBoundCopy[dim] + 1;

// Sites storage.
// Site storage.
std::vector<Point> Sites;

// Reserve sites storage.
Expand Down
10 changes: 5 additions & 5 deletions tests/geometry/volumes/distance/testVoronoiMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ bool testCheckConcept()
* Example of a test. To be completed.
*
*/
bool testVoronoiMap( std::array<bool, 2> const& periodicity = { false, false } )
bool testVoronoiMap( std::array<bool, 2> const& periodicity = { {false, false} } )
{
unsigned int nbok = 0;
unsigned int nb = 0;
Expand Down Expand Up @@ -296,7 +296,7 @@ bool testVoronoiMap( std::array<bool, 2> const& periodicity = { false, false } )
template<typename Set>
bool testVoronoiMapFromSites2D( const Set &aSet,
const std::string &name,
std::array<bool, 2> const& periodicity = { false, false } )
std::array<bool, 2> const& periodicity = { {false, false} } )
{
unsigned int nbok = 0;
unsigned int nb = 0;
Expand Down Expand Up @@ -679,9 +679,9 @@ int main( int argc, char** argv )

bool res = testCheckConcept()
&& testVoronoiMap()
&& testVoronoiMap( { true, false } )
&& testVoronoiMap( { false, true } )
&& testVoronoiMap( { true, true } )
&& testVoronoiMap( { {true, false} } )
&& testVoronoiMap( { {false, true} } )
&& testVoronoiMap( { {true, true} } )
&& testSimple2D()
&& testSimpleRandom2D()
&& testSimple3D()
Expand Down