summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-15 14:23:19 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-15 14:23:19 +0000
commita28d3c6ba5ab9687626992cc0402c4399c76ecaf (patch)
tree7770fbefefed16469dc0e508245ed1f46d6d2c9f /src/common
parent50d0b9006eaefa4aa41eba336206afd5ad700324 (diff)
In Delaunay_triangulation_off_io.h, constructing the Triangulation from a vector of Points is a more efficient way (instead of inserting points on the fly).
As consequence, the documentation needs to be rewritten as the points index are changed. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@1046 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: bdb0196b61418a983cfaf7f6781a3a2906e8b136
Diffstat (limited to 'src/common')
-rw-r--r--src/common/example/CMakeLists.txt6
-rw-r--r--src/common/example/dtoffrw_alphashapedoc_result.off18
-rw-r--r--src/common/include/gudhi/Delaunay_triangulation_off_io.h26
-rw-r--r--src/common/test/CMakeLists.txt4
-rw-r--r--src/common/test/dtoffrw_alphashapedoc_result.off18
5 files changed, 44 insertions, 28 deletions
diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt
index 6c2e7669..91e78ea2 100644
--- a/src/common/example/CMakeLists.txt
+++ b/src/common/example/CMakeLists.txt
@@ -13,6 +13,12 @@ if(CGAL_FOUND)
target_link_libraries(dtoffrw ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
add_test(dtoffrw ${CMAKE_CURRENT_BINARY_DIR}/dtoffrw ${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off ${CMAKE_CURRENT_BINARY_DIR}/result.off)
+ if (DIFF_PATH)
+ # Do not forget to copy test results files in current binary dir
+ file(COPY "dtoffrw_alphashapedoc_result.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+ add_test(dtoffrw_result_off_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/dtoffrw_alphashapedoc_result.off ${CMAKE_CURRENT_BINARY_DIR}/result.off)
+ endif()
+
else()
message(WARNING "Eigen3 not found. Version 3.1.0 is required for Alpha shapes feature.")
endif()
diff --git a/src/common/example/dtoffrw_alphashapedoc_result.off b/src/common/example/dtoffrw_alphashapedoc_result.off
index 03b7ca75..d1839a43 100644
--- a/src/common/example/dtoffrw_alphashapedoc_result.off
+++ b/src/common/example/dtoffrw_alphashapedoc_result.off
@@ -1,15 +1,15 @@
nOFF
2 7 6 0
+9 17
+0 14
1 1
-7 0
+2 19
4 6
9 6
-0 14
-2 19
-9 17
-3 0 1 2
-3 3 2 1
-3 4 0 2
-3 4 2 6
-3 6 2 3
+7 0
+3 5 0 4
+3 0 1 4
+3 3 1 0
+3 4 1 2
3 5 4 6
+3 6 4 2
diff --git a/src/common/include/gudhi/Delaunay_triangulation_off_io.h b/src/common/include/gudhi/Delaunay_triangulation_off_io.h
index b3f4a299..529774f0 100644
--- a/src/common/include/gudhi/Delaunay_triangulation_off_io.h
+++ b/src/common/include/gudhi/Delaunay_triangulation_off_io.h
@@ -31,7 +31,9 @@
namespace Gudhi {
-/** \brief OFF file visitor implementation according to Off_reader in order to construct a CGAL Delaunay triangulation.
+/**
+ * \class Delaunay_triangulation_off_visitor_reader Delaunay_triangulation_off_io.h gudhi/Delaunay_triangulation_off_io.h
+ * \brief OFF file visitor implementation according to Off_reader in order to construct a CGAL Delaunay triangulation.
*
* For more informations on CGAL Delaunay triangulation, please refer to the corresponding chapter in page
* http://doc.cgal.org/latest/Triangulation/
@@ -41,7 +43,7 @@ class Delaunay_triangulation_off_visitor_reader {
private:
Complex* complex_;
typedef typename Complex::Point Point;
-
+ std::vector<Point> point_cloud;
public:
// TODO(VR) : Pass a Complex as a parameter is required, even if not used. Otherwise, compilation is KO.
@@ -95,7 +97,9 @@ class Delaunay_triangulation_off_visitor_reader {
}
std::cout << std::endl;
#endif // DEBUG_TRACES
- complex_->insert(Point(point.size(), point.begin(), point.end()));
+ // Fill the point cloud
+ // VR: complex_->insert(Point(point.size(), point.begin(), point.end()));
+ point_cloud.push_back(Point(point.size(), point.begin(), point.end()));
}
// Off_reader visitor maximal_face implementation - not used
@@ -103,9 +107,11 @@ class Delaunay_triangulation_off_visitor_reader {
// For Delaunay Triangulation, only points are read
}
- // Off_reader visitor done implementation - not used
+ // Off_reader visitor done implementation
void done() {
- // Nothing to be done on end of OFF file read
+ // It is advised to insert all the points at a time in a Delaunay Triangulation because points are sorted at the
+ // beginning of the insertion
+ complex_->insert(point_cloud.begin(), point_cloud.end());
}
/** \brief Returns the constructed Delaunay triangulation.
@@ -119,7 +125,9 @@ class Delaunay_triangulation_off_visitor_reader {
}
};
-/** \brief OFF file reader implementation in order to construct a Delaunay triangulation.
+/**
+ * \class Delaunay_triangulation_off_reader Delaunay_triangulation_off_io.h gudhi/Delaunay_triangulation_off_io.h
+ * \brief OFF file reader implementation in order to construct a Delaunay triangulation.
*
* This class is using the Delaunay_triangulation_off_visitor_reader to visit the OFF file according to Off_reader.
*
@@ -135,7 +143,7 @@ class Delaunay_triangulation_off_visitor_reader {
*
* When launching:
*
- * \code $> ./dtoffrw ../../data/points/alphacomplexdoc triangulated.off
+ * \code $> ./dtoffrw ../../data/points/alphacomplexdoc.off triangulated.off
* \endcode
*
* the program output is:
@@ -203,7 +211,9 @@ class Delaunay_triangulation_off_reader {
Complex* complex_;
};
-/** \brief OFF file writer from a Delaunay triangulation.
+/**
+ * \class Delaunay_triangulation_off_writer Delaunay_triangulation_off_io.h gudhi/Delaunay_triangulation_off_io.h
+ * \brief OFF file writer from a Delaunay triangulation.
*
* This class constructs the OFF file header according to http://www.geomview.org/docs/html/OFF.html
*
diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt
index 50655a93..12eecda8 100644
--- a/src/common/test/CMakeLists.txt
+++ b/src/common/test/CMakeLists.txt
@@ -22,8 +22,6 @@ if(CGAL_FOUND)
target_link_libraries(dtoffrw_UT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
# Do not forget to copy test files in current binary dir
- file(COPY "dtoffrw_alphashapedoc_result.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- # Do not forget to copy test files in current binary dir
file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
# Unitary tests
@@ -32,6 +30,8 @@ if(CGAL_FOUND)
--log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/dtoffrw_UT.xml --log_level=test_suite --report_level=no)
if (DIFF_PATH)
+ # Do not forget to copy test result files in current binary dir
+ file(COPY "dtoffrw_alphashapedoc_result.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
add_test(dtoffrw_diff_files_UT ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/UT.off ${CMAKE_CURRENT_BINARY_DIR}/dtoffrw_alphashapedoc_result.off)
endif()
diff --git a/src/common/test/dtoffrw_alphashapedoc_result.off b/src/common/test/dtoffrw_alphashapedoc_result.off
index 03b7ca75..d1839a43 100644
--- a/src/common/test/dtoffrw_alphashapedoc_result.off
+++ b/src/common/test/dtoffrw_alphashapedoc_result.off
@@ -1,15 +1,15 @@
nOFF
2 7 6 0
+9 17
+0 14
1 1
-7 0
+2 19
4 6
9 6
-0 14
-2 19
-9 17
-3 0 1 2
-3 3 2 1
-3 4 0 2
-3 4 2 6
-3 6 2 3
+7 0
+3 5 0 4
+3 0 1 4
+3 3 1 0
+3 4 1 2
3 5 4 6
+3 6 4 2