Skip to content

Commit

Permalink
Merge pull request #1086 from rolanddenis/dev_periodicKhalimsky
Browse files Browse the repository at this point in the history
Periodic Khalimsky space and pre-Khalimsky space.
  • Loading branch information
JacquesOlivierLachaud committed Jun 5, 2016
2 parents 014d3ba + 9d4d633 commit 640bd86
Show file tree
Hide file tree
Showing 37 changed files with 7,161 additions and 2,852 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
voting (Boulc'h & Marlet, SGP 2012).
(David Coeurjolly, [#1149](https://github.com/DGtal-team/DGtal/pull/1149))

- *Topology Package*
- Adding periodic closure for KhalimskySpaceND and per-dimension closure
specification.
(Roland Denis, [#1086](https://github.com/DGtal-team/DGtal/pull/1086))
- Adding CPreCellularGridSpaceND concept and KhalimskyPreSpaceND model
to manipulate unbounded Khalimsky space and cells.
KhalimskySpaceND now checks that all given cells are within the bounds.
(Roland Denis, [#1086](https://github.com/DGtal-team/DGtal/pull/1086))

## Changes
- *Configuration/General*
- Travis Continuous integration will check that doxygen raises no warnings
Expand Down
6 changes: 3 additions & 3 deletions examples/dec/exampleDiscreteExteriorCalculusSolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void solve2d_dual_decomposition()
Calculus::DualVectorField input_vector_field(calculus);
for (Calculus::Index ii=0; ii<input_vector_field.length(); ii++)
{
const Z2i::RealPoint cell_center = Z2i::RealPoint(input_vector_field.getSCell(ii).myCoordinates)/2.;
const Z2i::RealPoint cell_center = Z2i::RealPoint(input_vector_field.getSCell(ii).preCell().coordinates)/2.;
input_vector_field.myCoordinates(ii, 0) = cos(-.5*cell_center[0]+ .3*cell_center[1]);
input_vector_field.myCoordinates(ii, 1) = cos(.4*cell_center[0]+ .8*cell_center[1]);
}
Expand Down Expand Up @@ -341,7 +341,7 @@ void solve2d_primal_decomposition()
Calculus::PrimalVectorField input_vector_field(calculus);
for (Calculus::Index ii=0; ii<input_vector_field.length(); ii++)
{
const Z2i::RealPoint cell_center = Z2i::RealPoint(input_vector_field.getSCell(ii).myCoordinates)/2.;
const Z2i::RealPoint cell_center = Z2i::RealPoint(input_vector_field.getSCell(ii).preCell().coordinates)/2.;
input_vector_field.myCoordinates(ii, 0) = cos(-.5*cell_center[0]+ .3*cell_center[1]);
input_vector_field.myCoordinates(ii, 1) = cos(.4*cell_center[0]+ .8*cell_center[1]);
}
Expand Down Expand Up @@ -857,7 +857,7 @@ void solve3d_decomposition()
Calculus::PrimalVectorField input_vector_field(calculus);
for (Calculus::Index ii=0; ii<input_vector_field.length(); ii++)
{
const Z3i::RealPoint cell_center = Z3i::RealPoint(input_vector_field.getSCell(ii).myCoordinates)/2.;
const Z3i::RealPoint cell_center = Z3i::RealPoint(input_vector_field.getSCell(ii).preCell().coordinates)/2.;
input_vector_field.myCoordinates(ii, 0) = -cos(-.3*cell_center[0] + .6*cell_center[1] + .8*cell_center[2]);
input_vector_field.myCoordinates(ii, 1) = sin(.8*cell_center[0] + .3*cell_center[1] - .4*cell_center[2]);
input_vector_field.myCoordinates(ii, 2) = -cos(cell_center[2]*.5);
Expand Down
2 changes: 1 addition & 1 deletion examples/io/boards/dgtalBoard3DTo2D-KSCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int main()
SCell linelC = K.sCell(Point(1,2 ,2), false);
board << linelA << linelB << linelC;

Cell center(Point(5,5,5));
Cell center = K.uCell(Point(5,5,5));

// Testing display of oriented surfels:
SCell ssurfelXZ = K.sCell( Point( 5, 6, 5 ), false );
Expand Down
4 changes: 2 additions & 2 deletions examples/io/viewDualSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,15 @@ int main( int argc, char** argv )
fillCfg( f, offset + Vector( 1, 1, 1 ), cfg );
Domain domain( offset + Vector( 0, 0, 0), offset + Vector( 2, 2, 2 ) );
KSpace K;
K.init( offset + Vector( 0, 0, 0), offset + Vector( 2, 2, 2 ), true );
K.init( Vector( 0, 0, 0), Vector( 2, 2, 2 ), true );
ConfigPointPredicate<Vector> cpp( f, offset );
CellSet aBoundary;
Surfaces<KSpace>::uMakeBoundary( aBoundary, K, cpp, Vector( 0, 0, 0), Vector( 1, 1, 1 ) );
for ( CellSet::const_iterator it = aBoundary.begin(), itE = aBoundary.end();
it != itE; ++it )
{
viewer << CustomColors3D( surfelColor, surfelColor );
viewer << K.uTranslation( *it, offset/2 );
viewer << KS.uTranslation( *it, offset/2 );
}
for ( Domain::ConstIterator it = domain.begin(), itE = domain.end();
it != itE; ++it )
Expand Down
39 changes: 21 additions & 18 deletions examples/topology/khalimskySpaceScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,27 @@ int main( int argc, char** argv )

// Other way to scan Khalimsky space by controlling axis order
Z2i::Vector shiftq;
Z2i::KSpace::Cell precq=q;
bool firstq=true;
for (q = K.uGetMax(q, 0); K.uIsInside(q,0); q = K.uGetDecr(q, 0))
for ( q = K.uGetMin(q, 1); K.uIsInside(q,1); q = K.uGetIncr(q, 1))
{
boardScan2 << q;
if(firstq){
firstq=false;
precq=q;
continue;
}
// Drawing the scan arrows
shiftq = K.uCoords(q)-K.uCoords(precq);
boardScan2.setPenColor( Color( 30, 30, 200 ));
Display2DFactory::draw(boardScan2, shiftq, K.uCoords(precq));
precq=q;
}

Z2i::KSpace::Cell precq = q;
bool firstq = true;
using KPS = Z2i::KPreSpace;
for ( KPS::Cell qq = K.uGetMax(q, 0); K.uIsInside(qq, 0); qq = KPS::uGetDecr(qq, 0) )
{
for ( KPS::uSetKCoord( qq, K.uFirst( qq, 1 ), 1 ); K.uIsInside(qq, 1); qq = KPS::uGetIncr(qq, 1) )
{
q = K.uCell( qq );
boardScan2 << q;
if(firstq){
firstq = false;
precq = q;
continue;
}
// Drawing the scan arrows
shiftq = K.uCoords(q) - K.uCoords(precq);
boardScan2.setPenColor( Color( 30, 30, 200 ));
Display2DFactory::draw(boardScan2, shiftq, K.uCoords(precq));
precq = q;
}
}

boardScan1.saveSVG("khalimskySpaceScanner1.svg");
boardScan1.saveFIG("khalimskySpaceScanner1.fig");
Expand Down
2 changes: 1 addition & 1 deletion src/DGtal/dec/DiscreteExteriorCalculus.ih
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ template <DGtal::Dimension dim, typename TInteger>
size_t
DGtal::hash_value(const DGtal::KhalimskyCell<dim, TInteger>& cell)
{
return boost::hash_range(cell.myCoordinates.begin(), cell.myCoordinates.end());
return boost::hash_range( cell.preCell().coordinates.begin(), cell.preCell().coordinates.end());
}

///////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit 640bd86

Please sign in to comment.