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

Voxelization #1209

Merged
merged 48 commits into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3103dbb
basic voxelization
hadjiszs Sep 29, 2016
eb27240
minor change
hadjiszs Sep 29, 2016
4e9663c
Update MeshVoxelizer.h
hadjiszs Sep 30, 2016
67c1b67
fix debug warn
hadjiszs Sep 30, 2016
6215672
Merge branch 'voxelization' of https://github.com/hadjiszs/DGtal into…
hadjiszs Sep 30, 2016
bbc3cca
fix doxygen warn
hadjiszs Oct 6, 2016
d2edf68
Refactoring the code
dcoeurjo Oct 8, 2016
1d9e75a
Refactoring again
dcoeurjo Oct 8, 2016
cc50654
minor rename and fix doxygen warn
hadjiszs Oct 9, 2016
db41176
minor edits
dcoeurjo Oct 12, 2016
9326508
Changing interface
dcoeurjo Oct 19, 2016
5c46393
fixing BBOX computation
dcoeurjo Oct 19, 2016
0fcb6c9
Merge branch 'masterDGTal' into voxelization
dcoeurjo Nov 4, 2016
d0565f1
Lambda exp. fix
dcoeurjo Nov 7, 2016
67e0fe5
class doc
dcoeurjo Nov 12, 2016
1109f99
minor edits
dcoeurjo Nov 12, 2016
9cdeeda
preparing doc
dcoeurjo Nov 12, 2016
cddf5be
refactoring
dcoeurjo Nov 12, 2016
1b50074
Debugging
dcoeurjo Nov 12, 2016
c6db84d
Debugging
dcoeurjo Nov 12, 2016
cabd95a
Merge branch 'masterDGTal' into voxelization
dcoeurjo Nov 18, 2016
aa7bfe9
Merge remote-tracking branch 'upstream/master' into voxelization
hadjiszs May 21, 2017
30c6981
for 26 sep, adding approach with projections only to avoid intersecti…
hadjiszs Jun 5, 2017
753213b
Merge remote-tracking branch 'upstream/master' into voxelization
hadjiszs Jun 5, 2017
16b4941
fix error on e2 vector base expression
hadjiszs Jun 7, 2017
614c5e2
minor change
hadjiszs Jun 7, 2017
86a39ea
take off outputSet export to off files on tests
hadjiszs Jun 7, 2017
d3f6b01
refactoring construction and usage of intersection target
hadjiszs Jun 10, 2017
04c0d51
separation of intersection target implementation
hadjiszs Jun 11, 2017
d2711ff
Update Shapes.cpp
dcoeurjo Sep 5, 2017
92c1b8e
unit test + naive triangulation
dcoeurjo Oct 31, 2017
366098f
Merge branch 'voxelization' of github.com:hadjiszs/DGtal into voxeliz…
dcoeurjo Oct 31, 2017
01ab2a8
box26 test
dcoeurjo Oct 31, 2017
4fcd2d3
Minor fix about omp race condition and shadowed declaration
hadjiszs Nov 3, 2017
71cf9c4
Fix wrong predicate order on pointIsInside2DTriangle
hadjiszs Nov 7, 2017
74944c4
Merge branch 'masterDGTal' into voxelization
dcoeurjo Nov 9, 2017
67c8b42
Merge branch 'masterDGTal' into voxelization
dcoeurjo Nov 16, 2017
d6621b9
doc
dcoeurjo Nov 16, 2017
f05777a
changelog
dcoeurjo Nov 16, 2017
15379e7
Fixing build issue
dcoeurjo Nov 17, 2017
3cb479f
Fixing build issue
dcoeurjo Nov 17, 2017
371a927
merge
dcoeurjo Nov 18, 2017
8bb1d2d
Merge branch 'voxelization' of github.com:hadjiszs/DGtal into voxeliz…
dcoeurjo Nov 18, 2017
da49226
Fixing issues
dcoeurjo Nov 20, 2017
7f2c4ff
Merge branch 'voxelization' of github.com:hadjiszs/DGtal into voxeliz…
dcoeurjo Nov 20, 2017
b8bdc0a
Figs
dcoeurjo Nov 24, 2017
adba706
typo
dcoeurjo Dec 2, 2017
5b1b71d
Minor typo on README.md
hadjiszs Dec 2, 2017
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
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## New Features / Critical Changes

- *Shapes*

- Mesh Voxelizer using 6- or 26-separability templated
(DavidCoeurjolly, Monir Hadji,
[#1209](https://github.com/DGtal-team/DGtal/pull/1209))

- *Topology Package*
- Adding the half-edge data structure to represent arbitrary
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ More details are given in the [documentation pages](http://dgtal.org/download/).

```shell
git clone https://github.com/DGtal-team/DGtal.git
cd DGtal ; mkdir buid ; cd build
cd DGtal ; mkdir build ; cd build
cmake ..
make install
```
Expand Down
3 changes: 2 additions & 1 deletion examples/shapes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
SET(DGTAL_EXAMPLES_SRC
exampleEuclideanShapesDecorator
exampleEuclideanShapesDecorator
exampleMeshVoxelizer
)

FOREACH(FILE ${DGTAL_EXAMPLES_SRC})
Expand Down
109 changes: 109 additions & 0 deletions examples/shapes/exampleMeshVoxelizer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**/

/**
* @file exampleMeshVoxelizer.cpp
* @ingroup Examples
* @author David Coeurjolly (\c [email protected] )
* Laboratoire d'InfoRmatique en Image et Systemes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
*
* @date 2017/11/16
*
* An example file named exampleMeshVoxelizer
*
* This file is part of the DGtal library.
*/


/**
* \image html resultCube.png "Resulting digitization of a cube"
*
* \example shapes/exampleMeshVoxelizer.cpp
*/

///////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/shapes/Mesh.h"
//! [MeshVoxelizerInc]
#include "DGtal/shapes/MeshVoxelizer.h"
//! [MeshVoxelizerInc]
#include "DGtal/io/boards/Board3D.h"
#include "DGtal/io/writers/MeshWriter.h"
///////////////////////////////////////////////////////////////////////////////

using namespace std;
using namespace DGtal;

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

int main( )
{
trace.beginBlock ( "Example MeshVoxelizer" );


//! [MeshVoxelizerCreatingMesh]
using namespace Z3i;
Mesh<Point> aMesh;

trace.info()<<"Creating a cube"<<std::endl;
//Creating a cube
aMesh.addVertex(Point(0,0,0));
aMesh.addVertex(Point(1,0,0));
aMesh.addVertex(Point(1,1,0));
aMesh.addVertex(Point(0,1,0));
aMesh.addVertex(Point(0,1,1));
aMesh.addVertex(Point(1,1,1));
aMesh.addVertex(Point(1,0,1));
aMesh.addVertex(Point(0,0,1));

aMesh.addQuadFace(0,1,2,3);
aMesh.addQuadFace(1,2,5,6);
aMesh.addQuadFace(7,6,5,4);
aMesh.addQuadFace(3,2,5,4);
aMesh.addQuadFace(0,3,4,7);
aMesh.addQuadFace(0,1,6,7);
//! [MeshVoxelizerCreatingMesh]


//! [MeshVoxelizerDig]
Domain domain(Point(0,0,0), Point(128,128,128));
DigitalSet outputSet(domain);

MeshVoxelizer<DigitalSet, 6> voxelizer;

trace.info()<<"Digitization..."<<std::endl;
voxelizer.voxelize(outputSet, aMesh, 15.0);

trace.info()<<"Got "<< outputSet.size() << " voxels."<<std::endl;
//! [MeshVoxelizerDig]

//! [MeshVoxelizerExport]
Board3D<> board;
for(auto voxel : outputSet)
board << voxel;
board.saveOBJ("voxelizedCube.obj");
//! [MeshVoxelizerExport]



trace.endBlock();
return 0;
}
// //
///////////////////////////////////////////////////////////////////////////////
2 changes: 1 addition & 1 deletion examples/shapes/mesh3DConstructionAndVisualisation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int main( int argc, char** argv )
//! [MeshUseDisplay]
bool res = application.exec();
FATAL_ERROR(res);
return true;
return 0;
}
// //
///////////////////////////////////////////////////////////////////////////////
Expand Down
26 changes: 1 addition & 25 deletions src/Board/Shapes.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* -*- mode: c++ -*- */
/**
* @file Shapes.cpp
* @author Sebastien Fourey <http://www.greyc.ensicaen.fr/~seb>
Expand Down Expand Up @@ -2078,30 +2077,7 @@ Rectangle::flushTikZ( std::ostream & stream,
stream << "\\path[" << tikzProperties(transform) << "] ("
<< _path[0].x << ',' << _path[0].y << ')'
<< " rectangle ("
<< _path[1].x << ',' << _path[3].y << ");" << std::endl;
/*
if ( _path[0].y == _path[1].y ) {
stream << "<rect x=\"" << transform.mapX( _path[0].x ) << '"'
<< " y=\"" << transform.mapY( _path[0].y ) << '"'
<< " width=\"" << transform.scale( _path[1].x - _path[0].x ) << '"'
<< " height=\"" << transform.scale( _path[0].y - _path[3].y ) << '"'
<< svgProperties( transform )
<< " />" << std::endl;
} else {
Point v = _path[1] - _path[0];
v /= v.norm();
double angle = ( _path[1].y > _path[0].y ) ? acos( v * Point(1,0) ) : -acos( v * Point( 1, 0 ) );
angle = ( angle * 180 ) / M_PI;
stream << "<rect x=\"" << transform.mapX( _path[0].x ) << '"'
<< " y=\"" << transform.mapY( _path[0].y ) << '"'
<< " width=\"" << transform.scale( (_path[1] - _path[0]).norm() ) << '"'
<< " height=\"" << transform.scale( (_path[0] - _path[3]).norm() ) << '"'
<< svgProperties( transform ) << ' '
<< " transform=\"rotate(" << -angle << ", "
<< transform.mapX( _path[0].x ) << ", " << transform.mapY( _path[0].y ) << ") \" "
<< " />" << std::endl;
}
*/
<< _path[1].x << ',' << _path[3].y << "); ";
}

/*
Expand Down
39 changes: 38 additions & 1 deletion src/DGtal/doc/global.bib
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Misc

@book{KletteRosenfeld_book,
author = {Reinhard Klette and
Azriel Rosenfeld},
title = {Digital geometry - geometric methods for digital picture analysis},
publisher = {Morgan Kaufmann},
year = {2004},
isbn = {978-1-55860-861-0},
timestamp = {Thu, 14 Apr 2011 14:43:22 +0200},
biburl = {http://dblp.uni-trier.de/rec/bib/books/daglib/0013534},
bibsource = {dblp computer science bibliography, http://dblp.org}
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Images
%% Shapes Voxelization

@article{Laine13,
added-at = {2013-08-18T00:00:00.000+0200},
author = {Laine, Samuli},
biburl = {http://www.bibsonomy.org/bibtex/270e10190a2b8fc35721e7e3e58be920c/dblp},
ee = {http://dx.doi.org/10.1111/cgf.12153},
interhash = {9327ac1bf79fa410ea45865566098671},
intrahash = {70e10190a2b8fc35721e7e3e58be920c},
journal = {Comput. Graph. Forum},
keywords = {dblp},
number = 4,
pages = {77-86},
timestamp = {2013-08-20T11:34:58.000+0200},
title = {A Topological Approach to Voxelization.},
url = {http://dblp.uni-trier.de/db/journals/cgf/cgf32.html#Laine13},
volume = 32,
year = 2013
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Images


@Misc{belongieRot,
author = {Belongie, Serge},
Expand Down
6 changes: 1 addition & 5 deletions src/DGtal/shapes/GaussDigitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,8 @@ namespace DGtal
typedef HyperRectDomain<Space> Domain;
typedef RegularPointEmbedder<Space> PointEmbedder;

// JOL: GaussDigitizer do not need a bounded shape.
// BOOST_CONCEPT_ASSERT(( CEuclideanBoundedShape<TEuclideanShape> ));

BOOST_CONCEPT_ASSERT(( concepts::CEuclideanOrientedShape<TEuclideanShape> ));



/**
* Destructor.
*/
Expand Down
Loading