Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
8b0944a
new branch for reconstruction of parallel slices
sloriot Jun 19, 2012
1744171
move from experimental-packages to feature-branch
sloriot Jun 19, 2012
39065af
add package info
sloriot Jun 19, 2012
5ccdbf7
move cpp to examples
sloriot Jun 19, 2012
8df1286
forgot to reproject the point in that case
sloriot Jun 20, 2012
d615f7b
wrong location
sloriot Jun 27, 2012
69c3891
merge from next
sloriot Jul 31, 2012
3fb409b
bad comment
sloriot Aug 2, 2012
adefbfc
hide warnings
sloriot Aug 2, 2012
5f6bdac
writer clear polyhedron before reading it
sloriot Aug 2, 2012
67dda1b
update writer to be more generic
sloriot Aug 2, 2012
623b22a
first version of reconstruction plugin
sloriot Aug 2, 2012
1bf277f
merge from next
sloriot Aug 2, 2012
76c687f
only clear it once
sloriot Aug 2, 2012
cdb0285
forgot I already had a debug macro
sloriot Aug 2, 2012
9cecf13
the index of vertices in cdt is compulsary and must not be done only …
sloriot Aug 2, 2012
0deb4cd
add a visitor inside the slice writer to indicate when a layer is ready
sloriot Aug 3, 2012
5db2a21
add a visitor to update the display while reconstructing the model
sloriot Aug 3, 2012
cc74355
merge from next
sloriot Aug 3, 2012
0c69835
static const double cannot be init in class
sloriot Aug 4, 2012
e77dff0
merge from next
sloriot Sep 12, 2012
54b94d2
remove a todo but add another one
sloriot Oct 12, 2012
3cc494b
fix elevation
sloriot Oct 12, 2012
d2240d8
add todo
sloriot Nov 26, 2012
081c3b6
adding some data files
sloriot Nov 27, 2012
0cc221a
add a script for testing code on a set of input
sloriot Nov 27, 2012
08fbf66
create res dir
sloriot Nov 27, 2012
bc2699a
Merge branch 'hot-fixes-for-Git' into Reconstruction_parallel_slices-…
sloriot Dec 13, 2012
844256a
crlf to lf eol recoding
sloriot Dec 13, 2012
c809127
remove unused int
sloriot May 15, 2013
1a893b2
add todos
sloriot May 15, 2013
fc4d8f7
apply the third pass filtration only to cells in the volume
sloriot May 15, 2013
3a0272c
remove warnings and typo bugs
sloriot Jun 7, 2013
0e72fbd
max() -> (max)()
afabri Jun 10, 2013
377111a
Merge branch 'Reconstruction_parallel_slices-new_package-sloriot-old'…
sloriot Jun 10, 2013
ce57d9f
add data and todo
sloriot Jun 20, 2013
d9de1c4
Merge branch 'Reconstruction_parallel_slices-new_package-sloriot-old'…
sloriot Jul 11, 2013
6bd6c61
work around for a bug in g++-4.1.2
sloriot Nov 21, 2013
35d61d1
Add a repair function that deals with overlapping consecutive edges
afabri Dec 18, 2013
daae27e
treat self-intersection of 3 consecutive edges
afabri Dec 18, 2013
d50ec5e
treat intersection of curves in a point which is not an endpoint
afabri Dec 18, 2013
58fd2de
base for review
afabri Dec 19, 2013
afeaadd
add return in case of a segment
afabri Dec 19, 2013
daa5504
Start at a vertex that will not removed
afabri Dec 19, 2013
ea72843
detect curves touching or intersecting in a vertex
afabri Dec 19, 2013
8c81b80
deal with shared points where the curves intersect or just touch
afabri Dec 19, 2013
1db93de
fix typo
afabri Dec 19, 2013
f18c080
Add a tool to extract the i'th contour
afabri Dec 20, 2013
046fb6b
be more permissive for the input (allow a contour to be "open")
sloriot Dec 20, 2013
a660206
preliminary version of a contour provider that can also check and fix…
sloriot Dec 20, 2013
3dfa684
fix the checker
sloriot Dec 23, 2013
367208e
allow to select the constant coordinate
sloriot Dec 23, 2013
c520bea
the checking program now uses the checking class
sloriot Dec 23, 2013
99aed30
remove unused code
sloriot Dec 23, 2013
670f4aa
add a verbose mode to indicate fixes applied
sloriot Dec 23, 2013
c248da4
Deal with overlapping segments
afabri Dec 23, 2013
4dda170
Do not duplicate the second point
afabri Dec 23, 2013
f618b7e
cleanup
afabri Dec 23, 2013
9515863
rename enum
sloriot Jan 15, 2014
af7219d
add todo
sloriot Jan 15, 2014
d4faf74
using a point property map
sloriot Jan 15, 2014
207e780
fix warning
sloriot Jan 15, 2014
6cf0301
move functions to fix consecutive overlapping segments into an includ…
sloriot Jan 15, 2014
9b78c1f
forgot to use point property map for find
sloriot Jan 15, 2014
b47752a
remove trailing whitespaces
sloriot Jan 16, 2014
0a2cb32
plug the fix of collinear consecutive overlapping segments in the che…
sloriot Jan 16, 2014
bd2edcd
make checker more verbose
sloriot Jan 16, 2014
d9764ec
return a boolean to indicate if the self-intersection could be fixed
sloriot Jan 16, 2014
8ca7bd1
move fix_self_intersections to a header file
sloriot Jan 16, 2014
c4633d9
forgot to update the vector of 3D points after the fix
sloriot Jan 16, 2014
3c20430
detects polygon make only of collinear points
sloriot Jan 16, 2014
c23e393
add function to request the fix of self intersections
sloriot Jan 16, 2014
71992ba
add function to access the last polygon added
sloriot Jan 16, 2014
9002e2d
rename function
sloriot Jan 16, 2014
3bc315d
add missing return failure
sloriot Jan 16, 2014
d480fc1
add todos
sloriot Jan 16, 2014
545bc6c
add functions to access intersection in the last slice
sloriot Jan 16, 2014
e189b24
extra check to make sure that the self-intersection fix make the poly…
sloriot Jan 17, 2014
4214a56
fix size_of_contour when no slices have been created
sloriot Jan 22, 2014
73e4857
return an empty contour when none are present
sloriot Jan 22, 2014
dc080be
bugfix: check for intersection when there are more than 1 polygon
sloriot Jan 24, 2014
d3896af
dump intersecting polygons too
sloriot Jan 24, 2014
02ceaa5
fix incorrect initialization of index
sloriot Feb 3, 2014
262d84b
add some code to detect self-intersection of 3D polygons
sloriot Feb 20, 2014
7ed5c45
add a flag to avoid closing the polyhedron by meshing the top and bot…
sloriot Feb 20, 2014
28a41ad
Fix compilation errors with recent libQGLViewer
lrineau Mar 4, 2014
227915a
Merge branch 'Reconstruction_parallel_slices-new_package-sloriot-old'…
sloriot Jul 10, 2014
52adaa1
Merge branch 'Reconstruction_parallel_slices-new_package-sloriot-old'…
sloriot Aug 12, 2014
5830fed
Merge branch 'old/Reconstruction_parallel_slices-new_package-sloriot'…
sloriot Jun 15, 2015
3de7b9f
accomodate changes in polyhedron demo
sloriot Jun 15, 2015
d94bfd8
Merge branch 'old/Reconstruction_parallel_slices-new_package-sloriot'…
sloriot Aug 7, 2015
03c53f6
adapt plugin for qt5
sloriot Aug 7, 2015
71a4ac6
skip isolated points in contour providers
sloriot Aug 7, 2015
8ba1575
Merge branch 'old/Reconstruction_parallel_slices-new_package-sloriot'…
sloriot Oct 29, 2015
b38d1b8
accomodate updates in the demo framework
sloriot Oct 29, 2015
763cbc6
remove function now in upstream branch
sloriot Nov 6, 2015
b180a2f
Merge 'old/Reconstruction_parallel_slices-new_package-sloriot' into R…
sloriot Jul 21, 2016
4746209
adapt the plugin to modifications in the demo
sloriot Jul 21, 2016
629a44f
fix warnings
sloriot Jul 21, 2016
1bc52c5
Merge remote-tracking branch 'GF/Reconstruction_parallel_slices-new_p…
sloriot Apr 10, 2021
962e40b
update plugin with update of the demo to Surface_mesh
sloriot Apr 11, 2021
8f6e4df
update license header and cosmetic
sloriot Apr 11, 2021
5bba4ff
add license checking
sloriot Apr 11, 2021
210d4c7
remove original input from Andreas
sloriot Apr 11, 2021
9c9b7d3
remove no longer needed script (functionality included in the demo now)
sloriot Apr 11, 2021
d7d3445
renaming forgotten
sloriot Apr 11, 2021
e2cc624
please checking script
sloriot Apr 11, 2021
e75bd93
Restore drawing during layer processing
maxGimeno Apr 12, 2021
1c52c8a
Merge remote-tracking branch 'cgal/master' into Reconstruction_from_p…
sloriot Sep 9, 2021
7e203b0
NULL -> nullptr
sloriot Sep 9, 2021
9fe31d8
write polyhedron before doing any check
sloriot Sep 9, 2021
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (c) 2016 GeometryFactory SARL (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Andreas Fabri
//
// Warning: this file is generated, see include/CGAL/licence/README.md

#ifndef CGAL_LICENSE_RECONSTRUCTION_PARALLEL_SLICES_3_H
#define CGAL_LICENSE_RECONSTRUCTION_PARALLEL_SLICES_3_H

#include <CGAL/config.h>
#include <CGAL/license.h>

#ifdef CGAL_RECONSTRUCTION_PARALLEL_SLICES_3_COMMERCIAL_LICENSE

# if CGAL_RECONSTRUCTION_PARALLEL_SLICES_3_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE

# if defined(CGAL_LICENSE_WARNING)

CGAL_pragma_warning("Your commercial license for CGAL does not cover "
"this release of the Reconstruction from 3D Parallel Slices package.")
# endif

# ifdef CGAL_LICENSE_ERROR
# error "Your commercial license for CGAL does not cover this release \
of the Reconstruction from 3D Parallel Slices package. \
You get this error, as you defined CGAL_LICENSE_ERROR."
# endif // CGAL_LICENSE_ERROR

# endif // CGAL_RECONSTRUCTION_PARALLEL_SLICES_3_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE

#else // no CGAL_RECONSTRUCTION_PARALLEL_SLICES_3_COMMERCIAL_LICENSE

# if defined(CGAL_LICENSE_WARNING)
CGAL_pragma_warning("\nThe macro CGAL_RECONSTRUCTION_PARALLEL_SLICES_3_COMMERCIAL_LICENSE is not defined."
"\nYou use the CGAL Reconstruction from 3D Parallel Slices package under "
"the terms of the GPLv3+.")
# endif // CGAL_LICENSE_WARNING

# ifdef CGAL_LICENSE_ERROR
# error "The macro CGAL_RECONSTRUCTION_PARALLEL_SLICES_3_COMMERCIAL_LICENSE is not defined.\
You use the CGAL Reconstruction from 3D Parallel Slices package under the terms of \
the GPLv3+. You get this error, as you defined CGAL_LICENSE_ERROR."
# endif // CGAL_LICENSE_ERROR

#endif // no CGAL_RECONSTRUCTION_PARALLEL_SLICES_3_COMMERCIAL_LICENSE

#endif // CGAL_LICENSE_RECONSTRUCTION_PARALLEL_SLICES_3_H
1 change: 1 addition & 0 deletions Installation/include/CGAL/license/gpl_package_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Polyline_simplification_2 2D Polyline Simplification
Polytope_distance_d Optimal Distances
Principal_component_analysis Principal Component Analysis
QP_solver Linear and Quadratic Programming Solver
Reconstruction_parallel_slices_3 Reconstruction from 3D Parallel Slices
Ridges_3 Approximation of Ridges and Umbilics on Triangulated Surface Meshes
Scale_space_reconstruction_3 Scale-Space Surface Reconstruction
SearchStructures dD Range and Segment Trees
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include( polyhedron_demo_macros )

polyhedron_demo_plugin(reconstruction_parallel_slices_plugin Reconstruction_parallel_slices_plugin)
target_link_libraries(reconstruction_parallel_slices_plugin PUBLIC scene_surface_mesh_item scene_polylines_item)
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
#include <QElapsedTimer>
#include <QApplication>
#include <QAction>
#include <QStringList>
#include <QMainWindow>
#include <QtPlugin>
#include <QMessageBox>


#include "Scene_surface_mesh_item.h"
#include "Scene_polylines_item.h"

#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>

#include <CGAL/Reconstruction_from_parallel_slices_3.h>
#include <CGAL/Reconstruction_from_parallel_slices_3/contour_providers.h>


using namespace CGAL::Three;
class Polyhedron_demo_reconstruction_parallel_slices_plugin :
public QObject,
public Polyhedron_demo_plugin_interface
{
Q_OBJECT
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
QList<QAction*> _actions;
Scene_interface* scene;
QMainWindow* mw;
int detect_constant_coordinate(Scene_polylines_item* polylines_item);

public:
void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
QAction* actionReconstructionParallelSlices = new QAction(tr("Reconstruction from parallel slices"), mainWindow);
actionReconstructionParallelSlices->setObjectName("actionReconstructionParallelSlices");
connect(actionReconstructionParallelSlices, SIGNAL(triggered()), this, SLOT(on_actionReconstructionParallelSlices_triggered()));
_actions << actionReconstructionParallelSlices;
scene = scene_interface;
mw=mainWindow;
}

QList<QAction*> actions()const {return _actions;}

// used by Polyhedron_demo_plugin_helper
QStringList actionsNames() const {
return QStringList() << "actionReconstructionParallelSlices";
}

bool applicable(QAction*) const {
return qobject_cast<Scene_polylines_item*>(scene->item(scene->mainSelectionIndex()));
}

public Q_SLOTS:
void on_actionReconstructionParallelSlices_triggered();

}; // end Polyhedron_demo_reconstruction_parallel_slices_plugin


int Polyhedron_demo_reconstruction_parallel_slices_plugin::detect_constant_coordinate(Scene_polylines_item* polylines_item)
{
typedef Scene_polylines_item::Point_3 Point_3;
typedef std::vector<Point_3> Polyline;
typedef std::list<Polyline> Polylines_container;
Polylines_container& polylines=polylines_item->polylines;

Polylines_container::size_type nb_polylines=polylines.size();

switch (nb_polylines)
{
case 0:
case 1:
QMessageBox::warning(mw, tr("Error"),
tr("The selected polylines item must contains at least two contours."));
return -1;
default:
{
Polylines_container::iterator it_poly=polylines.begin();
std::vector<int> const_coords;
const_coords.reserve(3);
const_coords.push_back(0);
const_coords.push_back(1);
const_coords.push_back(2);

while(it_poly!=polylines.end())
{
Polyline& polyline = *it_poly++;
if ( polyline.size()==1 ) continue;

Point_3 pt=polyline[0];

for (Polyline::iterator it_pt=CGAL::cpp11::next( polyline.begin() );it_pt!=polyline.end();++it_pt)
{
std::vector<int> to_keep;
std::vector<int>::size_type nc=const_coords.size();
for (std::vector<int>::size_type i=0;i<nc;++i)
if ( pt[ const_coords[i] ] == (*it_pt)[ const_coords[i] ] ) to_keep.push_back( const_coords[i] );
switch( to_keep.size() )
{
case 0:
QMessageBox::warning(mw, tr("Error"),
tr("The selected polylines item are not contained in parallel slices."));
return -1;
case 1:
return to_keep[0];
default:
const_coords=to_keep;
}
}
}
QMessageBox::warning(mw, tr("Error"),
tr("The selected polylines item are not contained in parallel slices."));
return -1;
}
}
}

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K> Polyhedron;

struct Visitor_update{
Scene_surface_mesh_item* m_item;
const Polyhedron& m_reconst; // TODO update code to directly use Surface mesh

Visitor_update(Scene_surface_mesh_item* item, const Polyhedron& reconst)
: m_item(item)
, m_reconst(reconst)
{}

void one_layer_is_finished() {
m_item->face_graph()->clear();
CGAL::copy_face_graph(m_reconst, *m_item->face_graph());

m_item->invalidateOpenGLBuffers();
m_item->redraw();
m_item->itemChanged();
QApplication::processEvents();
}
};

void Polyhedron_demo_reconstruction_parallel_slices_plugin::on_actionReconstructionParallelSlices_triggered()
{

typedef CGAL::Polygon_as_vector_of_Point_3_in_axis_aligned_planes<K,Scene_polylines_item::Polylines_container> Contour_reader;
typedef CGAL::Incremental_slice_writer_into_polyhedron<Polyhedron,K,Visitor_update> Slice_writer;

const Scene_interface::Item_id index = scene->mainSelectionIndex();

Scene_polylines_item* polylines_item =
qobject_cast<Scene_polylines_item*>(scene->item(index));

if(polylines_item)
{
// wait cursor
QApplication::setOverrideCursor(Qt::WaitCursor);

std::cout << "Analysing input...";
int cst_coord = detect_constant_coordinate(polylines_item);
if ( cst_coord == -1 ) return;

switch (cst_coord)
{
case 0:
std::cout << " Constant coordinate is X"<< std::endl;
break;
case 1:
std::cout << " Constant coordinate is Y"<< std::endl;
break;
case 2:
std::cout << " Constant coordinate is Z"<< std::endl;
break;
default:
std::cout << " Invalid input."<< std::endl;
break;
return;
}

QElapsedTimer time;
time.start();
std::cout << "Reconstructing ...";

// add a new polyhedron
Polyhedron reconst;

Scene_surface_mesh_item* new_item = new Scene_surface_mesh_item();
new_item->setName(tr("%1 (reconstruction)").arg(polylines_item->name()));
int item_index=scene->addItem(new_item);

Visitor_update vis_update(new_item, reconst);
//slice writer writing in a polyhedron
Slice_writer writer(reconst,vis_update);

Contour_reader reader(polylines_item->polylines, cst_coord);
CGAL::Reconstruction_from_parallel_slices_3<Slice_writer> reconstruction;
reconstruction.run(reader,writer,cst_coord);

new_item->invalidateOpenGLBuffers();
scene->itemChanged(item_index);

std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;

// default cursor
QApplication::restoreOverrideCursor();
}
}

#include "Reconstruction_parallel_slices_plugin.moc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.

cmake_minimum_required(VERSION 3.1...3.15)
project(Reconstruction_parallel_slices_3_Examples)

find_package(CGAL REQUIRED)

create_single_source_cgal_program( "conforming-Delaunay_3.cpp" )
create_single_source_cgal_program( "manifold_check.cpp" )
create_single_source_cgal_program( "check_valid_input.cpp" )
create_single_source_cgal_program( "edge_profile.cpp" )
create_single_source_cgal_program( "repair.cpp" )
create_single_source_cgal_program( "extract.cpp" )
create_single_source_cgal_program( "detect_intersecting_segments.cpp" )

Loading