From 3344ff0909b4f978c6662a9d61aaa24c12cef104 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 24 Mar 2015 13:42:58 +0100 Subject: [PATCH 01/61] Add doc for package Solver_interface --- Documentation/doc/Documentation/Doxyfile.in | 1 + Documentation/doc/Documentation/dependencies | 1 + Documentation/doc/Documentation/packages.txt | 1 + Documentation/resources/how_to_cite_cgal.bib | 921 +++++++++++++++++ .../how_to_cite_cgal.bib.in.Polyline | 931 +++++++++++++++++ .../resources/how_to_cite_cgal.bib.in.master | 932 ++++++++++++++++++ .../doc/Solver_interface/Doxyfile.in | 6 + .../Solver_interface/PackageDescription.txt | 55 ++ .../doc/Solver_interface/Solver_interface.txt | 36 + .../doc/Solver_interface/dependencies | 5 + .../doc/Solver_interface/examples.txt | 16 + .../include/CGAL/Eigen_solver_traits.hpp | 187 ++++ 12 files changed, 3092 insertions(+) create mode 100755 Documentation/resources/how_to_cite_cgal.bib create mode 100755 Documentation/resources/how_to_cite_cgal.bib.in.Polyline create mode 100755 Documentation/resources/how_to_cite_cgal.bib.in.master create mode 100644 Solver_interface/doc/Solver_interface/Doxyfile.in create mode 100644 Solver_interface/doc/Solver_interface/PackageDescription.txt create mode 100644 Solver_interface/doc/Solver_interface/Solver_interface.txt create mode 100644 Solver_interface/doc/Solver_interface/dependencies create mode 100644 Solver_interface/doc/Solver_interface/examples.txt create mode 100644 Solver_interface/include/CGAL/Eigen_solver_traits.hpp diff --git a/Documentation/doc/Documentation/Doxyfile.in b/Documentation/doc/Documentation/Doxyfile.in index 65d38794f6c..64555ba7df8 100644 --- a/Documentation/doc/Documentation/Doxyfile.in +++ b/Documentation/doc/Documentation/Doxyfile.in @@ -58,6 +58,7 @@ IMAGE_PATH = ${CMAKE_SOURCE_DIR}/Documentation/doc/Documentation/fig \ ${CMAKE_SOURCE_DIR}/GraphicsView/doc/GraphicsView/fig \ ${CMAKE_SOURCE_DIR}/HalfedgeDS/doc/HalfedgeDS/fig \ ${CMAKE_SOURCE_DIR}/BGL/doc/BGL/fig \ + ${CMAKE_SOURCE_DIR}/BGL/doc/Solver_interface/fig \ ${CMAKE_SOURCE_DIR}/Combinatorial_map/doc/Combinatorial_map/fig \ ${CMAKE_SOURCE_DIR}/Linear_cell_complex/doc/Linear_cell_complex/fig \ ${CMAKE_SOURCE_DIR}/Interval_skip_list/doc/Interval_skip_list/fig \ diff --git a/Documentation/doc/Documentation/dependencies b/Documentation/doc/Documentation/dependencies index 940a5cbfbee..95503e8009c 100644 --- a/Documentation/doc/Documentation/dependencies +++ b/Documentation/doc/Documentation/dependencies @@ -22,6 +22,7 @@ Geomview GraphicsView HalfedgeDS BGL +Solver_interface Combinatorial_map Linear_cell_complex Interval_skip_list diff --git a/Documentation/doc/Documentation/packages.txt b/Documentation/doc/Documentation/packages.txt index 2e64aac02d2..5037a55134e 100644 --- a/Documentation/doc/Documentation/packages.txt +++ b/Documentation/doc/Documentation/packages.txt @@ -139,6 +139,7 @@ h1 { \package_listing{STL_Extension} \package_listing{BGL} +\package_listing{Solver_interface} \package_listing{Point_set_processing_3/Property_map} \package_listing{Circulator} \package_listing{Generator} diff --git a/Documentation/resources/how_to_cite_cgal.bib b/Documentation/resources/how_to_cite_cgal.bib new file mode 100755 index 00000000000..e269f5dfc03 --- /dev/null +++ b/Documentation/resources/how_to_cite_cgal.bib @@ -0,0 +1,921 @@ +% please dont't modify the "arobase" string commands +% they are used by the scripts to create the "How to cite CGAL" web page +% thanks - Monique + +@string{ author_create_page = 0 } +@string{ category_create_page = 0 } +@string{ reduced_year_create_page = 0 } +@string{ complete_year_create_page = 0 } + +@string{ index_file_title = "How to cite CGAL" } +@string{ index_page_title = "How to cite CGAL" } + +@string{ complete_biblio_file_title = "CGAL Publications sorted by year" } +@string{ complete_biblio_page_title = "CGAL Publications sorted by year" } +@string{ filename_complete_biblio = "how_to_cite_cgal" } + +@string{ head_tag.end = "layout.html" } +%@string{ header_of_contents = "header_of_contents" } + +@string{ keyword_build_initials_index = 0 } +@string{ keyword_put_initials_in_index = 0 } + +@string{ keyword_write_bibtex_abstract = 0 } +@string{ complete_biblio_write_bibtex_abstract = 0 } + +@string{ disclaimer_2 = ""} +@STRING{ default_header_of_body = "" } +@STRING{ default_footer_of_contents = ""} +@string{ index_write_author = 0 } +@string{ keyword_write_author = 0 } +@string{ complete_biblio_write_author = 0 } + +@string{ index_write_date = 0 } +@string{ keyword_write_date = 0 } +@string{ complete_biblio_write_date = 0 } + + + +@book{ cgal:eb-${CGAL_RELEASE_YEAR_ID} +, title = "{CGAL} User and Reference Manual" +, author = "{The CGAL Project}" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, year = ${CGAL_BUILD_YEAR4} +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html" +} + +%%% Arithmetic and Algebra %%% + +@incollection{cgal:h-af-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Algebraic Foundations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlgebraicFoundationsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hhkps-nt-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer and Susan Hert and Lutz Kettner and Sylvain Pion and Stefan Schirra" +, title = "Number Types" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNumberTypesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-ma-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Modular Arithmetic" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgModularArithmeticSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-p-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Polynomial" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolynomialSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:bht-ak-${CGAL_RELEASE_YEAR_ID} +, author = "Eric Berberich and Michael Hemmer and Michael Kerber and Sylvain Lazard and Luis Pe{\~n}aranda and Monique Teillaud" +, title = "Algebraic Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlgebraicKerneldSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Combinatorial Algorithms %%% + +@incollection{cgal:h-msms-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann" +, title = "Monotone and Sorted Matrix Search" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMatrixSearchSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fgsw-lqps-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Sven Sch{\"o}nherr and Frans Wessendorp" +, title = "Linear and Quadratic Programming Solver" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgQPSolverSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometry Kernels %%% + +@incollection{cgal:bfghhkps-lgk23-${CGAL_RELEASE_YEAR_ID} +, author = "Herv{\'e} Br{\"o}nnimann and Andreas Fabri and Geert-Jan Giezeman and Susan Hert and Michael Hoffmann and Lutz Kettner and Sylvain Pion and Stefan Schirra" +, title = "{2D} and {3D} Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKernel23Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:s-gkd-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Seel" +, title = "{dD} Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKernelDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cpt-cgk2-${CGAL_RELEASE_YEAR_ID} +, author = "Pedro Machado Manh{\~a}es de Castro and Sylvain Pion and Monique Teillaud" +, title = "{2D} Circular Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCircularKernel2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cclt-sgk3-${CGAL_RELEASE_YEAR_ID} +, author = "Pedro Machado Manh{\~a}es de Castro and Fr{\'e}d{\'e}ric Cazals and S{\'e}bastien Loriot and Monique Teillaud" +, title = "{3D} Spherical Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSphericalKernel3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Convex Hull Algorithms %%% + +@incollection{cgal:hs-chep2-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Stefan Schirra" +, title = "{2D} Convex Hulls and Extreme Points" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHull2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hs-ch3-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Stefan Schirra" +, title = "{3D} Convex Hulls" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHull3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hs-chdt3-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Michael Seel" +, title = "{dD} Convex Hulls and {Delaunay} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHullDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Polygons %%% + +@incollection{cgal:gw-p2-${CGAL_RELEASE_YEAR_ID} +, author = "Geert-Jan Giezeman and Wieger Wesselink" +, title = "{2D} Polygons" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolygon2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fwzh-rbso2-${CGAL_RELEASE_YEAR_ID} +, author = "Efi Fogel and Ron Wein and Baruch Zukerman and Dan Halperin" +, title = "{2D} Regularized {Boolean} Set-Operations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBooleanSetOperations2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:s-bonp2-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Seel" +, title = "{2D} {Boolean} Operations on {Nef} Polygons" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNef2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hk-bonpes2-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger and Lutz Kettner" +, title = "{2D} {Boolean} Operations on {Nef} Polygons Embedded on the Sphere" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNefS2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-pp2-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert" +, title = "{2D} Polygon Partitioning" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolygonPartitioning2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:c-sspo2-${CGAL_RELEASE_YEAR_ID} +, author = "Fernando Cacciola" +, title = "{2D} Straight Skeleton and Polygon Offsetting" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgStraightSkeleton2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:w-rms2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein" +, title = "{2D} {Minkowski} Sums" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMinkowskiSum2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Cell Complexes and Polyhedra %%% + +@incollection{cgal:k-ps-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner" +, title = "{3D} Polyhedral Surfaces" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolyhedronSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-hds-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner" +, title = "Halfedge Data Structures" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgHDSSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-cm-${CGAL_RELEASE_YEAR_ID} +, author = "Guillaume Damiand" +, title = "Combinatorial Maps" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCombinatorialMapsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-lcc-${CGAL_RELEASE_YEAR_ID} +, author = "Guillaume Damiand" +, title = "Linear Cell Complex" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgLinearCellComplexSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hk-bonp3-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger and Lutz Kettner" +, title = "{3D} {Boolean} Operations on {Nef} Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNef3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-emspe-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger" +, title = "Convex Decomposition of Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexDecomposition3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-msp3-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger" +, title = "{3D} {Minkowski} Sum of Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMinkowskiSum3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Arrangements %%% + +@incollection{cgal:wfzh-a2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein and Eric Berberich and Efi Fogel and Dan Halperin and Michael Hemmer and Oren Salzman and Baruch Zukerman" +, title = "{2D} Arrangements" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgArrangement2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:wfz-ic2-${CGAL_RELEASE_YEAR_ID} +, author = "Baruch Zukerman and Ron Wein and Efi Fogel" +, title = "{2D} Intersection of Curves" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIntersectionOfCurves2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:p-sr2-${CGAL_RELEASE_YEAR_ID} +, author = "Eli Packer" +, title = "{2D} Snap Rounding" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSnapRounding2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:w-e2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein" +, title = "{2D} Envelopes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgEnvelope2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:mwz-e3-${CGAL_RELEASE_YEAR_ID} +, author = "Michal Meyerovitch and Ron Wein and Baruch Zukerman" +, title = "{3D} Envelopes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgEnvelope3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Triangulations and Delaunay Triangulations %%% + +@incollection{cgal:y-t2-${CGAL_RELEASE_YEAR_ID} +, author = "Mariette Yvinec" +, title = "{2D} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulation2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:py-tds2-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Mariette Yvinec" +, title = "{2D} Triangulation Data Structure" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTDS2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-pt2-${CGAL_RELEASE_YEAR_ID} +, author = "Nico Kruithof" +, title = "{2D} Periodic Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPeriodic3Triangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pt-t3-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Monique Teillaud" +, title = "{3D} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pt-tds3-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Monique Teillaud" +, title = "{3D} Triangulation Data Structure" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTDS3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ct-pt3-${CGAL_RELEASE_YEAR_ID} +, author = "Manuel Caroli and Monique Teillaud" +, title = "{3D} Periodic Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPeriodic3Triangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hdj-t-${CGAL_RELEASE_YEAR_ID} +, author = "Samuel Hornus and Olivier Devillers and Clément Jamin" +, title = "Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulationsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-as2-${CGAL_RELEASE_YEAR_ID} +, author = "Tran Kai Frank Da" +, title = "{2D} Alpha Shapes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlphaShape2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dy-as3-${CGAL_RELEASE_YEAR_ID} +, author = "Tran Kai Frank Da and Mariette Yvinec" +, title = "{3D} Alpha Shapes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlphaShapes3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Voronoi Diagrams %%% + +@incollection{cgal:k-sdg2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas" +, title = "{2D} Segment {Delaunay} Graphs" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSegmentDelaunayGraph2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ky-ag2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas and Mariette Yvinec" +, title = "{2D} {Apollonius} Graphs ({Delaunay} Graphs of Disks)" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgApolloniusGraph2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-vda2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas" +, title = "{2D} {Voronoi} Diagram Adaptor" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgVoronoiDiagramAdaptor2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Mesh Generation %%% + +@incollection{cgal:r-ctm2-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Rineau" +, title = "{2D} Conforming Triangulations and Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMesh2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ry-smg-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Rineau and Mariette Yvinec" +, title = "{3D} Surface Mesh Generation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceMesher3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:asg-srps-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Saboret and Gael Guennebaud" +, title = "Surface Reconstruction from Point Sets" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceReconstructionFromPointSetsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-ssm3-${CGAL_RELEASE_YEAR_ID} +, author = "Nico Kruithof" +, title = "{3D} Skin Surface Meshing" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSkinSurface3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:rty-m3-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Rineau and St\'ephane Tayeb and Jane Tournois and Mariette Yvinec" +, title = "{3D} Mesh Generation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMesh_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometry Processing %%% + +@incollection{cgal:s-ssm2-${CGAL_RELEASE_YEAR_ID} +, author = "Le-Jeng Andy Shiue" +, title = "{3D} Surface Subdivision Methods" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceSubdivisionMethods3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:yl-tsms-${CGAL_RELEASE_YEAR_ID} +, author = "Ílker O. Yaz and S\'ebastien Loriot" +, title = "Triangulated Surface Mesh Segmentation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceSegmentationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:c-tsms-${CGAL_RELEASE_YEAR_ID} +, author = "Fernando Cacciola" +, title = "Triangulated Surface Mesh Simplification" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceMeshSimplificationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:lshxy-tsmd-${CGAL_RELEASE_YEAR_ID} +, author = "Sébastien Loriot, Olga Sorkine-Hornung, Yin Xu and Ilker %O. Yaz" +, title = "Triangulated Surface Mesh Deformation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceModelingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:sal-pptsm2-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Saboret and Pierre Alliez and Bruno L\'evy" +, title = "Planar Parameterization of Triangulated Surface Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceParameterizationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cp-arutsm-${CGAL_RELEASE_YEAR_ID} +, author = "Marc Pouget and Fr\'ed\'eric Cazals" +, title = "Approximation of Ridges and Umbilics on Triangulated Surface Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgRidges_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pc-eldp-${CGAL_RELEASE_YEAR_ID} +, author = "Marc Pouget and Fr\'ed\'eric Cazals" +, title = "Estimation of Local Differential Properties of Point-Sampled Surfaces" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgJet_fitting_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ass-psp-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Saboret and Nader Salman" +, title = "Point Set Processing" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPointSetProcessingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:m-ps-${CGAL_RELEASE_YEAR_ID} +, author = "Abdelkrim Mebarki" +, title = "{2D} Placement of Streamlines" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPlacementOfStreamlines2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Spatial Searching and Sorting %%% + +@incollection{cgal:b-ss2-${CGAL_RELEASE_YEAR_ID} +, author = "Matthias B{\"a}sken" +, title = "{2D} Range and Neighbor Search" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPointSet2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:f-isl-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri" +, title = "Interval Skip List" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIntervalSkipListSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:tf-ssd-${CGAL_RELEASE_YEAR_ID} +, author = "Hans Tangelder and Andreas Fabri" +, title = "{dD} Spatial Searching" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSpatialSearchingDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:n-rstd-${CGAL_RELEASE_YEAR_ID} +, author = "Gabriele Neyer" +, title = "{dD} Range and Segment Trees" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgRangeSegmentTreesDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:kmz-isiobd-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner and Andreas Meyer and Afra Zomorodian" +, title = "Intersecting Sequences of {dD} Iso-oriented Boxes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBoxIntersectionDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:atw-aabb-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and St\'ephane Tayeb and Camille Wormser" +, title = "{3D} Fast Intersection and Distance Computation (AABB Tree)" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAABB_treeSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dd-ss-${CGAL_RELEASE_YEAR_ID} +, author = "Christophe Delage and Olivier Devillers" +, title = "Spatial Sorting" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSpatialSortingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometric Optimization %%% + +@incollection{cgal:fghhs-bv-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Thomas Herrmann and Michael Hoffmann and Sven Sch{\"o}nherr" +, title = "Bounding Volumes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBoundingVolumesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hp-ia-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann and Eli Packer" +, title = "Inscribed Areas" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgInscribedAreasSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fghhs-od-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Thomas Herrmann and Michael Hoffmann + and Sven Sch{\"o}nherr" +, title = "Optimal Distances" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgOptimalDistancesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ap-pcad-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Sylvain Pion and Ankit Gupta" +, title = "Principal Component Analysis" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPrincipalComponentAnalysisDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Interpolation %%% + +@incollection{cgal:f-i-${CGAL_RELEASE_YEAR_ID} +, author = "Julia Fl{\"o}totto" +, title = "{2D} and Surface Function Interpolation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgInterpolation2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:abha-gbc-${CGAL_RELEASE_YEAR_ID} +, author = "Dmitry Anisimov and David Bommes and Kai Hormann and Pierre Alliez" +, title = "2D Generalized Barycentric Coordinates" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBarycentric_coordinates_2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Kinetic Data Structures %%% + +@incollection{cgal:r-kds-${CGAL_RELEASE_YEAR_ID} +, author = "Daniel Russel" +, title = "Kinetic Data Structures" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKdsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:r-kdsf-${CGAL_RELEASE_YEAR_ID} +, author = "Daniel Russel" +, title = "Kinetic Framework" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKdsFrameworkSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Support Library %%% + +@incollection{cgal:hkpw-se-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann and Lutz Kettner and Sylvain Pion and Ron Wein" +, title = "STL Extensions for {CGAL}" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgStlExtensionSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cfw-cbgl-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Fernando Cacciola and Ron Wein" +, title = "{CGAL} and the {Boost} Graph Library" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBGLSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fs-cbpm-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Laurent Saboret" +, title = "{CGAL} and {Boost} Property Maps" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgProperty_mapSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dksy-hc-${CGAL_RELEASE_YEAR_ID} +, author = "Olivier Devillers and Lutz Kettner and Michael Seel and Mariette Yvinec" +, title = "Handles and Circulators" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgHandlesAndCirculatorsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dhhk-gog-${CGAL_RELEASE_YEAR_ID} +, author = "Olivier Devillers and Susan Hert and Michael Hoffmann and Lutz Kettner and Sven Sch{\"o}nherr" +, title = "Geometric Object Generators" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGeneratorsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:kps-pthum-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner and Sylvain Pion and Michael Seel" +, title = "Profiling Tools Timers, Hash Map, Union-find, Modifiers" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgProfilingToolsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fgk-ios-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Geert-Jan Giezeman and Lutz Kettner" +, title = "IO Streams" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIOstreamsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Visualization %%% + +@incollection{cgal:fp-gv-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Sylvain Pion" +, title = "Geomview" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGeomviewSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fr-cqgvf-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Laurent Rineau" +, title = "{CGAL} and the Qt Graphics View Framework " +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGraphicsViewSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:lp-gi-${CGAL_RELEASE_YEAR_ID} +, author = "S\'ebastien Loriot and Sylvain Pion" +, title = "{CGAL} Ipelets " +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCGALIpeletsSummary" +, year = ${CGAL_BUILD_YEAR4} +} diff --git a/Documentation/resources/how_to_cite_cgal.bib.in.Polyline b/Documentation/resources/how_to_cite_cgal.bib.in.Polyline new file mode 100755 index 00000000000..cce13a4c3d0 --- /dev/null +++ b/Documentation/resources/how_to_cite_cgal.bib.in.Polyline @@ -0,0 +1,931 @@ +% please dont't modify the "arobase" string commands +% they are used by the scripts to create the "How to cite CGAL" web page +% thanks - Monique + +@string{ author_create_page = 0 } +@string{ category_create_page = 0 } +@string{ reduced_year_create_page = 0 } +@string{ complete_year_create_page = 0 } + +@string{ index_file_title = "How to cite CGAL" } +@string{ index_page_title = "How to cite CGAL" } + +@string{ complete_biblio_file_title = "CGAL Publications sorted by year" } +@string{ complete_biblio_page_title = "CGAL Publications sorted by year" } +@string{ filename_complete_biblio = "how_to_cite_cgal" } + +@string{ head_tag.end = "layout.html" } +%@string{ header_of_contents = "header_of_contents" } + +@string{ keyword_build_initials_index = 0 } +@string{ keyword_put_initials_in_index = 0 } + +@string{ keyword_write_bibtex_abstract = 0 } +@string{ complete_biblio_write_bibtex_abstract = 0 } + +@string{ disclaimer_2 = ""} +@STRING{ default_header_of_body = "" } +@STRING{ default_footer_of_contents = ""} +@string{ index_write_author = 0 } +@string{ keyword_write_author = 0 } +@string{ complete_biblio_write_author = 0 } + +@string{ index_write_date = 0 } +@string{ keyword_write_date = 0 } +@string{ complete_biblio_write_date = 0 } + + + +@book{ cgal:eb-${CGAL_RELEASE_YEAR_ID} +, title = "{CGAL} User and Reference Manual" +, author = "{The CGAL Project}" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, year = ${CGAL_BUILD_YEAR4} +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html" +} + +%%% Arithmetic and Algebra %%% + +@incollection{cgal:h-af-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Algebraic Foundations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlgebraicFoundationsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hhkps-nt-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer and Susan Hert and Lutz Kettner and Sylvain Pion and Stefan Schirra" +, title = "Number Types" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNumberTypesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-ma-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Modular Arithmetic" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgModularArithmeticSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-p-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Polynomial" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolynomialSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:bht-ak-${CGAL_RELEASE_YEAR_ID} +, author = "Eric Berberich and Michael Hemmer and Michael Kerber and Sylvain Lazard and Luis Pe{\~n}aranda and Monique Teillaud" +, title = "Algebraic Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlgebraicKerneldSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Combinatorial Algorithms %%% + +@incollection{cgal:h-msms-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann" +, title = "Monotone and Sorted Matrix Search" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMatrixSearchSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fgsw-lqps-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Sven Sch{\"o}nherr and Frans Wessendorp" +, title = "Linear and Quadratic Programming Solver" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgQPSolverSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometry Kernels %%% + +@incollection{cgal:bfghhkps-lgk23-${CGAL_RELEASE_YEAR_ID} +, author = "Herv{\'e} Br{\"o}nnimann and Andreas Fabri and Geert-Jan Giezeman and Susan Hert and Michael Hoffmann and Lutz Kettner and Sylvain Pion and Stefan Schirra" +, title = "{2D} and {3D} Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKernel23Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:s-gkd-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Seel" +, title = "{dD} Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKernelDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cpt-cgk2-${CGAL_RELEASE_YEAR_ID} +, author = "Pedro Machado Manh{\~a}es de Castro and Sylvain Pion and Monique Teillaud" +, title = "{2D} Circular Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCircularKernel2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cclt-sgk3-${CGAL_RELEASE_YEAR_ID} +, author = "Pedro Machado Manh{\~a}es de Castro and Fr{\'e}d{\'e}ric Cazals and S{\'e}bastien Loriot and Monique Teillaud" +, title = "{3D} Spherical Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSphericalKernel3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Convex Hull Algorithms %%% + +@incollection{cgal:hs-chep2-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Stefan Schirra" +, title = "{2D} Convex Hulls and Extreme Points" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHull2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hs-ch3-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Stefan Schirra" +, title = "{3D} Convex Hulls" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHull3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hs-chdt3-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Michael Seel" +, title = "{dD} Convex Hulls and {Delaunay} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHullDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Polygons %%% + +@incollection{cgal:gw-p2-${CGAL_RELEASE_YEAR_ID} +, author = "Geert-Jan Giezeman and Wieger Wesselink" +, title = "{2D} Polygons" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolygon2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fwzh-rbso2-${CGAL_RELEASE_YEAR_ID} +, author = "Efi Fogel and Ron Wein and Baruch Zukerman and Dan Halperin" +, title = "{2D} Regularized {Boolean} Set-Operations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBooleanSetOperations2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:s-bonp2-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Seel" +, title = "{2D} {Boolean} Operations on {Nef} Polygons" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNef2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hk-bonpes2-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger and Lutz Kettner" +, title = "{2D} {Boolean} Operations on {Nef} Polygons Embedded on the Sphere" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNefS2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-pp2-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert" +, title = "{2D} Polygon Partitioning" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolygonPartitioning2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:c-sspo2-${CGAL_RELEASE_YEAR_ID} +, author = "Fernando Cacciola" +, title = "{2D} Straight Skeleton and Polygon Offsetting" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgStraightSkeleton2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:w-rms2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein" +, title = "{2D} {Minkowski} Sums" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMinkowskiSum2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:f-ps2-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri" +, title = "{2D} Polyline Simplification" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolylineSimplification2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Cell Complexes and Polyhedra %%% + +@incollection{cgal:k-ps-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner" +, title = "{3D} Polyhedral Surfaces" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolyhedronSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-hds-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner" +, title = "Halfedge Data Structures" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgHDSSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-cm-${CGAL_RELEASE_YEAR_ID} +, author = "Guillaume Damiand" +, title = "Combinatorial Maps" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCombinatorialMapsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-lcc-${CGAL_RELEASE_YEAR_ID} +, author = "Guillaume Damiand" +, title = "Linear Cell Complex" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgLinearCellComplexSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hk-bonp3-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger and Lutz Kettner" +, title = "{3D} {Boolean} Operations on {Nef} Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNef3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-emspe-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger" +, title = "Convex Decomposition of Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexDecomposition3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-msp3-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger" +, title = "{3D} {Minkowski} Sum of Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMinkowskiSum3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Arrangements %%% + +@incollection{cgal:wfzh-a2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein and Eric Berberich and Efi Fogel and Dan Halperin and Michael Hemmer and Oren Salzman and Baruch Zukerman" +, title = "{2D} Arrangements" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgArrangement2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:wfz-ic2-${CGAL_RELEASE_YEAR_ID} +, author = "Baruch Zukerman and Ron Wein and Efi Fogel" +, title = "{2D} Intersection of Curves" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIntersectionOfCurves2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:p-sr2-${CGAL_RELEASE_YEAR_ID} +, author = "Eli Packer" +, title = "{2D} Snap Rounding" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSnapRounding2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:w-e2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein" +, title = "{2D} Envelopes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgEnvelope2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:mwz-e3-${CGAL_RELEASE_YEAR_ID} +, author = "Michal Meyerovitch and Ron Wein and Baruch Zukerman" +, title = "{3D} Envelopes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgEnvelope3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Triangulations and Delaunay Triangulations %%% + +@incollection{cgal:y-t2-${CGAL_RELEASE_YEAR_ID} +, author = "Mariette Yvinec" +, title = "{2D} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulation2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:py-tds2-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Mariette Yvinec" +, title = "{2D} Triangulation Data Structure" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTDS2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-pt2-${CGAL_RELEASE_YEAR_ID} +, author = "Nico Kruithof" +, title = "{2D} Periodic Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPeriodic3Triangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pt-t3-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Monique Teillaud" +, title = "{3D} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pt-tds3-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Monique Teillaud" +, title = "{3D} Triangulation Data Structure" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTDS3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ct-pt3-${CGAL_RELEASE_YEAR_ID} +, author = "Manuel Caroli and Monique Teillaud" +, title = "{3D} Periodic Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPeriodic3Triangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hdj-t-${CGAL_RELEASE_YEAR_ID} +, author = "Samuel Hornus and Olivier Devillers and Clément Jamin" +, title = "Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulationsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-as2-${CGAL_RELEASE_YEAR_ID} +, author = "Tran Kai Frank Da" +, title = "{2D} Alpha Shapes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlphaShape2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dy-as3-${CGAL_RELEASE_YEAR_ID} +, author = "Tran Kai Frank Da and Mariette Yvinec" +, title = "{3D} Alpha Shapes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlphaShapes3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Voronoi Diagrams %%% + +@incollection{cgal:k-sdg2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas" +, title = "{2D} Segment {Delaunay} Graphs" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSegmentDelaunayGraph2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ky-ag2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas and Mariette Yvinec" +, title = "{2D} {Apollonius} Graphs ({Delaunay} Graphs of Disks)" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgApolloniusGraph2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-vda2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas" +, title = "{2D} {Voronoi} Diagram Adaptor" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgVoronoiDiagramAdaptor2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Mesh Generation %%% + +@incollection{cgal:r-ctm2-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Rineau" +, title = "{2D} Conforming Triangulations and Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMesh2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ry-smg-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Rineau and Mariette Yvinec" +, title = "{3D} Surface Mesh Generation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceMesher3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:asg-srps-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Saboret and Gael Guennebaud" +, title = "Surface Reconstruction from Point Sets" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceReconstructionFromPointSetsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-ssm3-${CGAL_RELEASE_YEAR_ID} +, author = "Nico Kruithof" +, title = "{3D} Skin Surface Meshing" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSkinSurface3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:rty-m3-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Rineau and St\'ephane Tayeb and Jane Tournois and Mariette Yvinec" +, title = "{3D} Mesh Generation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMesh_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometry Processing %%% + +@incollection{cgal:s-ssm2-${CGAL_RELEASE_YEAR_ID} +, author = "Le-Jeng Andy Shiue" +, title = "{3D} Surface Subdivision Methods" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceSubdivisionMethods3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:yl-tsms-${CGAL_RELEASE_YEAR_ID} +, author = "Ílker O. Yaz and S\'ebastien Loriot" +, title = "Triangulated Surface Mesh Segmentation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceSegmentationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:c-tsms-${CGAL_RELEASE_YEAR_ID} +, author = "Fernando Cacciola" +, title = "Triangulated Surface Mesh Simplification" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceMeshSimplificationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:lshxy-tsmd-${CGAL_RELEASE_YEAR_ID} +, author = "Sébastien Loriot, Olga Sorkine-Hornung, Yin Xu and Ilker %O. Yaz" +, title = "Triangulated Surface Mesh Deformation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceModelingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:sal-pptsm2-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Saboret and Pierre Alliez and Bruno L\'evy" +, title = "Planar Parameterization of Triangulated Surface Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceParameterizationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cp-arutsm-${CGAL_RELEASE_YEAR_ID} +, author = "Marc Pouget and Fr\'ed\'eric Cazals" +, title = "Approximation of Ridges and Umbilics on Triangulated Surface Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgRidges_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pc-eldp-${CGAL_RELEASE_YEAR_ID} +, author = "Marc Pouget and Fr\'ed\'eric Cazals" +, title = "Estimation of Local Differential Properties of Point-Sampled Surfaces" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgJet_fitting_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ass-psp-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Saboret and Nader Salman" +, title = "Point Set Processing" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPointSetProcessingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:m-ps-${CGAL_RELEASE_YEAR_ID} +, author = "Abdelkrim Mebarki" +, title = "{2D} Placement of Streamlines" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPlacementOfStreamlines2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Spatial Searching and Sorting %%% + +@incollection{cgal:b-ss2-${CGAL_RELEASE_YEAR_ID} +, author = "Matthias B{\"a}sken" +, title = "{2D} Range and Neighbor Search" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPointSet2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:f-isl-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri" +, title = "Interval Skip List" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIntervalSkipListSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:tf-ssd-${CGAL_RELEASE_YEAR_ID} +, author = "Hans Tangelder and Andreas Fabri" +, title = "{dD} Spatial Searching" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSpatialSearchingDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:n-rstd-${CGAL_RELEASE_YEAR_ID} +, author = "Gabriele Neyer" +, title = "{dD} Range and Segment Trees" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgRangeSegmentTreesDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:kmz-isiobd-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner and Andreas Meyer and Afra Zomorodian" +, title = "Intersecting Sequences of {dD} Iso-oriented Boxes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBoxIntersectionDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:atw-aabb-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and St\'ephane Tayeb and Camille Wormser" +, title = "{3D} Fast Intersection and Distance Computation (AABB Tree)" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAABB_treeSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dd-ss-${CGAL_RELEASE_YEAR_ID} +, author = "Christophe Delage and Olivier Devillers" +, title = "Spatial Sorting" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSpatialSortingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometric Optimization %%% + +@incollection{cgal:fghhs-bv-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Thomas Herrmann and Michael Hoffmann and Sven Sch{\"o}nherr" +, title = "Bounding Volumes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBoundingVolumesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hp-ia-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann and Eli Packer" +, title = "Inscribed Areas" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgInscribedAreasSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fghhs-od-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Thomas Herrmann and Michael Hoffmann + and Sven Sch{\"o}nherr" +, title = "Optimal Distances" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgOptimalDistancesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ap-pcad-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Sylvain Pion and Ankit Gupta" +, title = "Principal Component Analysis" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPrincipalComponentAnalysisDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Interpolation %%% + +@incollection{cgal:f-i-${CGAL_RELEASE_YEAR_ID} +, author = "Julia Fl{\"o}totto" +, title = "{2D} and Surface Function Interpolation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgInterpolation2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:abha-gbc-${CGAL_RELEASE_YEAR_ID} +, author = "Dmitry Anisimov and David Bommes and Kai Hormann and Pierre Alliez" +, title = "2D Generalized Barycentric Coordinates" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBarycentric_coordinates_2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Kinetic Data Structures %%% + +@incollection{cgal:r-kds-${CGAL_RELEASE_YEAR_ID} +, author = "Daniel Russel" +, title = "Kinetic Data Structures" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKdsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:r-kdsf-${CGAL_RELEASE_YEAR_ID} +, author = "Daniel Russel" +, title = "Kinetic Framework" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKdsFrameworkSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Support Library %%% + +@incollection{cgal:hkpw-se-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann and Lutz Kettner and Sylvain Pion and Ron Wein" +, title = "STL Extensions for {CGAL}" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgStlExtensionSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cfw-cbgl-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Fernando Cacciola and Ron Wein" +, title = "{CGAL} and the {Boost} Graph Library" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBGLSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fs-cbpm-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Laurent Saboret" +, title = "{CGAL} and {Boost} Property Maps" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgProperty_mapSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dksy-hc-${CGAL_RELEASE_YEAR_ID} +, author = "Olivier Devillers and Lutz Kettner and Michael Seel and Mariette Yvinec" +, title = "Handles and Circulators" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgHandlesAndCirculatorsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dhhk-gog-${CGAL_RELEASE_YEAR_ID} +, author = "Olivier Devillers and Susan Hert and Michael Hoffmann and Lutz Kettner and Sven Sch{\"o}nherr" +, title = "Geometric Object Generators" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGeneratorsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:kps-pthum-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner and Sylvain Pion and Michael Seel" +, title = "Profiling Tools Timers, Hash Map, Union-find, Modifiers" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgProfilingToolsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fgk-ios-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Geert-Jan Giezeman and Lutz Kettner" +, title = "IO Streams" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIOstreamsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Visualization %%% + +@incollection{cgal:fp-gv-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Sylvain Pion" +, title = "Geomview" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGeomviewSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fr-cqgvf-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Laurent Rineau" +, title = "{CGAL} and the Qt Graphics View Framework " +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGraphicsViewSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:lp-gi-${CGAL_RELEASE_YEAR_ID} +, author = "S\'ebastien Loriot and Sylvain Pion" +, title = "{CGAL} Ipelets " +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCGALIpeletsSummary" +, year = ${CGAL_BUILD_YEAR4} +} diff --git a/Documentation/resources/how_to_cite_cgal.bib.in.master b/Documentation/resources/how_to_cite_cgal.bib.in.master new file mode 100755 index 00000000000..a58465d4c90 --- /dev/null +++ b/Documentation/resources/how_to_cite_cgal.bib.in.master @@ -0,0 +1,932 @@ +% please dont't modify the "arobase" string commands +% they are used by the scripts to create the "How to cite CGAL" web page +% thanks - Monique + +@string{ author_create_page = 0 } +@string{ category_create_page = 0 } +@string{ reduced_year_create_page = 0 } +@string{ complete_year_create_page = 0 } + +@string{ index_file_title = "How to cite CGAL" } +@string{ index_page_title = "How to cite CGAL" } + +@string{ complete_biblio_file_title = "CGAL Publications sorted by year" } +@string{ complete_biblio_page_title = "CGAL Publications sorted by year" } +@string{ filename_complete_biblio = "how_to_cite_cgal" } + +@string{ head_tag.end = "layout.html" } +%@string{ header_of_contents = "header_of_contents" } + +@string{ keyword_build_initials_index = 0 } +@string{ keyword_put_initials_in_index = 0 } + +@string{ keyword_write_bibtex_abstract = 0 } +@string{ complete_biblio_write_bibtex_abstract = 0 } + +@string{ disclaimer_2 = ""} +@STRING{ default_header_of_body = "" } +@STRING{ default_footer_of_contents = ""} +@string{ index_write_author = 0 } +@string{ keyword_write_author = 0 } +@string{ complete_biblio_write_author = 0 } + +@string{ index_write_date = 0 } +@string{ keyword_write_date = 0 } +@string{ complete_biblio_write_date = 0 } + + + +@book{ cgal:eb-${CGAL_RELEASE_YEAR_ID} +, title = "{CGAL} User and Reference Manual" +, author = "{The CGAL Project}" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, year = ${CGAL_BUILD_YEAR4} +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html" +} + +%%% Arithmetic and Algebra %%% + +@incollection{cgal:h-af-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Algebraic Foundations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlgebraicFoundationsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hhkps-nt-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer and Susan Hert and Lutz Kettner and Sylvain Pion and Stefan Schirra" +, title = "Number Types" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNumberTypesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-ma-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Modular Arithmetic" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgModularArithmeticSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-p-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hemmer" +, title = "Polynomial" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolynomialSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:bht-ak-${CGAL_RELEASE_YEAR_ID} +, author = "Eric Berberich and Michael Hemmer and Michael Kerber and Sylvain Lazard and Luis Pe{\~n}aranda and Monique Teillaud" +, title = "Algebraic Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlgebraicKerneldSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Combinatorial Algorithms %%% + +@incollection{cgal:h-msms-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann" +, title = "Monotone and Sorted Matrix Search" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMatrixSearchSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fgsw-lqps-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Sven Sch{\"o}nherr and Frans Wessendorp" +, title = "Linear and Quadratic Programming Solver" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgQPSolverSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometry Kernels %%% + +@incollection{cgal:bfghhkps-lgk23-${CGAL_RELEASE_YEAR_ID} +, author = "Herv{\'e} Br{\"o}nnimann and Andreas Fabri and Geert-Jan Giezeman and Susan Hert and Michael Hoffmann and Lutz Kettner and Sylvain Pion and Stefan Schirra" +, title = "{2D} and {3D} Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKernel23Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:s-gkd-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Seel" +, title = "{dD} Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKernelDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cpt-cgk2-${CGAL_RELEASE_YEAR_ID} +, author = "Pedro Machado Manh{\~a}es de Castro and Sylvain Pion and Monique Teillaud" +, title = "{2D} Circular Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCircularKernel2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cclt-sgk3-${CGAL_RELEASE_YEAR_ID} +, author = "Pedro Machado Manh{\~a}es de Castro and Fr{\'e}d{\'e}ric Cazals and S{\'e}bastien Loriot and Monique Teillaud" +, title = "{3D} Spherical Geometry Kernel" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSphericalKernel3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Convex Hull Algorithms %%% + +@incollection{cgal:hs-chep2-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Stefan Schirra" +, title = "{2D} Convex Hulls and Extreme Points" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHull2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hs-ch3-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Stefan Schirra" +, title = "{3D} Convex Hulls" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHull3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hs-chdt3-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert and Michael Seel" +, title = "{dD} Convex Hulls and {Delaunay} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexHullDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Polygons %%% + +@incollection{cgal:gw-p2-${CGAL_RELEASE_YEAR_ID} +, author = "Geert-Jan Giezeman and Wieger Wesselink" +, title = "{2D} Polygons" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolygon2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fwzh-rbso2-${CGAL_RELEASE_YEAR_ID} +, author = "Efi Fogel and Ron Wein and Baruch Zukerman and Dan Halperin" +, title = "{2D} Regularized {Boolean} Set-Operations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBooleanSetOperations2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:s-bonp2-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Seel" +, title = "{2D} {Boolean} Operations on {Nef} Polygons" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNef2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hk-bonpes2-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger and Lutz Kettner" +, title = "{2D} {Boolean} Operations on {Nef} Polygons Embedded on the Sphere" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNefS2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-pp2-${CGAL_RELEASE_YEAR_ID} +, author = "Susan Hert" +, title = "{2D} Polygon Partitioning" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolygonPartitioning2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:c-sspo2-${CGAL_RELEASE_YEAR_ID} +, author = "Fernando Cacciola" +, title = "{2D} Straight Skeleton and Polygon Offsetting" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgStraightSkeleton2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:w-rms2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein" +, title = "{2D} {Minkowski} Sums" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMinkowskiSum2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Cell Complexes and Polyhedra %%% + +@incollection{cgal:k-ps-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner" +, title = "{3D} Polyhedral Surfaces" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPolyhedronSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-hds-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner" +, title = "Halfedge Data Structures" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgHDSSummary" +, year = ${CGAL_BUILD_YEAR4} +} + + +@incollection{cgal:bsmf-hds-${CGAL_RELEASE_YEAR_ID} +, author = "Mario Botsch and Daniel Sieger and Philipp Moeller and Andreas Fabri" +, title = "Surface Mesh" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceMeshSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-cm-${CGAL_RELEASE_YEAR_ID} +, author = "Guillaume Damiand" +, title = "Combinatorial Maps" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCombinatorialMapsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-lcc-${CGAL_RELEASE_YEAR_ID} +, author = "Guillaume Damiand" +, title = "Linear Cell Complex" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgLinearCellComplexSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hk-bonp3-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger and Lutz Kettner" +, title = "{3D} {Boolean} Operations on {Nef} Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgNef3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-emspe-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger" +, title = "Convex Decomposition of Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgConvexDecomposition3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:h-msp3-${CGAL_RELEASE_YEAR_ID} +, author = "Peter Hachenberger" +, title = "{3D} {Minkowski} Sum of Polyhedra" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMinkowskiSum3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Arrangements %%% + +@incollection{cgal:wfzh-a2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein and Eric Berberich and Efi Fogel and Dan Halperin and Michael Hemmer and Oren Salzman and Baruch Zukerman" +, title = "{2D} Arrangements" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgArrangement2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:wfz-ic2-${CGAL_RELEASE_YEAR_ID} +, author = "Baruch Zukerman and Ron Wein and Efi Fogel" +, title = "{2D} Intersection of Curves" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIntersectionOfCurves2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:p-sr2-${CGAL_RELEASE_YEAR_ID} +, author = "Eli Packer" +, title = "{2D} Snap Rounding" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSnapRounding2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:w-e2-${CGAL_RELEASE_YEAR_ID} +, author = "Ron Wein" +, title = "{2D} Envelopes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgEnvelope2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:mwz-e3-${CGAL_RELEASE_YEAR_ID} +, author = "Michal Meyerovitch and Ron Wein and Baruch Zukerman" +, title = "{3D} Envelopes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgEnvelope3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Triangulations and Delaunay Triangulations %%% + +@incollection{cgal:y-t2-${CGAL_RELEASE_YEAR_ID} +, author = "Mariette Yvinec" +, title = "{2D} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulation2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:py-tds2-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Mariette Yvinec" +, title = "{2D} Triangulation Data Structure" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTDS2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-pt2-${CGAL_RELEASE_YEAR_ID} +, author = "Nico Kruithof" +, title = "{2D} Periodic Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPeriodic3Triangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pt-t3-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Monique Teillaud" +, title = "{3D} Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pt-tds3-${CGAL_RELEASE_YEAR_ID} +, author = "Sylvain Pion and Monique Teillaud" +, title = "{3D} Triangulation Data Structure" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTDS3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ct-pt3-${CGAL_RELEASE_YEAR_ID} +, author = "Manuel Caroli and Monique Teillaud" +, title = "{3D} Periodic Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPeriodic3Triangulation3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hdj-t-${CGAL_RELEASE_YEAR_ID} +, author = "Samuel Hornus and Olivier Devillers and Clément Jamin" +, title = "Triangulations" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgTriangulationsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:d-as2-${CGAL_RELEASE_YEAR_ID} +, author = "Tran Kai Frank Da" +, title = "{2D} Alpha Shapes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlphaShape2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dy-as3-${CGAL_RELEASE_YEAR_ID} +, author = "Tran Kai Frank Da and Mariette Yvinec" +, title = "{3D} Alpha Shapes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAlphaShapes3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Voronoi Diagrams %%% + +@incollection{cgal:k-sdg2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas" +, title = "{2D} Segment {Delaunay} Graphs" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSegmentDelaunayGraph2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ky-ag2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas and Mariette Yvinec" +, title = "{2D} {Apollonius} Graphs ({Delaunay} Graphs of Disks)" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgApolloniusGraph2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-vda2-${CGAL_RELEASE_YEAR_ID} +, author = "Menelaos Karavelas" +, title = "{2D} {Voronoi} Diagram Adaptor" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgVoronoiDiagramAdaptor2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Mesh Generation %%% + +@incollection{cgal:r-ctm2-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Rineau" +, title = "{2D} Conforming Triangulations and Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMesh2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ry-smg-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Rineau and Mariette Yvinec" +, title = "{3D} Surface Mesh Generation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceMesher3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:asg-srps-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Saboret and Gael Guennebaud" +, title = "Surface Reconstruction from Point Sets" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceReconstructionFromPointSetsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:k-ssm3-${CGAL_RELEASE_YEAR_ID} +, author = "Nico Kruithof" +, title = "{3D} Skin Surface Meshing" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSkinSurface3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:rty-m3-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Rineau and St\'ephane Tayeb and Jane Tournois and Mariette Yvinec" +, title = "{3D} Mesh Generation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgMesh_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometry Processing %%% + +@incollection{cgal:s-ssm2-${CGAL_RELEASE_YEAR_ID} +, author = "Le-Jeng Andy Shiue" +, title = "{3D} Surface Subdivision Methods" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceSubdivisionMethods3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:yl-tsms-${CGAL_RELEASE_YEAR_ID} +, author = "Ílker O. Yaz and S\'ebastien Loriot" +, title = "Triangulated Surface Mesh Segmentation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceSegmentationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:c-tsms-${CGAL_RELEASE_YEAR_ID} +, author = "Fernando Cacciola" +, title = "Triangulated Surface Mesh Simplification" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceMeshSimplificationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:lshxy-tsmd-${CGAL_RELEASE_YEAR_ID} +, author = "Sébastien Loriot, Olga Sorkine-Hornung, Yin Xu and Ilker %O. Yaz" +, title = "Triangulated Surface Mesh Deformation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceModelingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:sal-pptsm2-${CGAL_RELEASE_YEAR_ID} +, author = "Laurent Saboret and Pierre Alliez and Bruno L\'evy" +, title = "Planar Parameterization of Triangulated Surface Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSurfaceParameterizationSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cp-arutsm-${CGAL_RELEASE_YEAR_ID} +, author = "Marc Pouget and Fr\'ed\'eric Cazals" +, title = "Approximation of Ridges and Umbilics on Triangulated Surface Meshes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgRidges_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:pc-eldp-${CGAL_RELEASE_YEAR_ID} +, author = "Marc Pouget and Fr\'ed\'eric Cazals" +, title = "Estimation of Local Differential Properties of Point-Sampled Surfaces" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgJet_fitting_3Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ass-psp-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Laurent Saboret and Nader Salman" +, title = "Point Set Processing" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPointSetProcessingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:m-ps-${CGAL_RELEASE_YEAR_ID} +, author = "Abdelkrim Mebarki" +, title = "{2D} Placement of Streamlines" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPlacementOfStreamlines2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Spatial Searching and Sorting %%% + +@incollection{cgal:b-ss2-${CGAL_RELEASE_YEAR_ID} +, author = "Matthias B{\"a}sken" +, title = "{2D} Range and Neighbor Search" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPointSet2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:f-isl-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri" +, title = "Interval Skip List" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIntervalSkipListSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:tf-ssd-${CGAL_RELEASE_YEAR_ID} +, author = "Hans Tangelder and Andreas Fabri" +, title = "{dD} Spatial Searching" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSpatialSearchingDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:n-rstd-${CGAL_RELEASE_YEAR_ID} +, author = "Gabriele Neyer" +, title = "{dD} Range and Segment Trees" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgRangeSegmentTreesDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:kmz-isiobd-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner and Andreas Meyer and Afra Zomorodian" +, title = "Intersecting Sequences of {dD} Iso-oriented Boxes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBoxIntersectionDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:atw-aabb-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and St\'ephane Tayeb and Camille Wormser" +, title = "{3D} Fast Intersection and Distance Computation (AABB Tree)" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgAABB_treeSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dd-ss-${CGAL_RELEASE_YEAR_ID} +, author = "Christophe Delage and Olivier Devillers" +, title = "Spatial Sorting" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgSpatialSortingSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Geometric Optimization %%% + +@incollection{cgal:fghhs-bv-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Thomas Herrmann and Michael Hoffmann and Sven Sch{\"o}nherr" +, title = "Bounding Volumes" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBoundingVolumesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:hp-ia-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann and Eli Packer" +, title = "Inscribed Areas" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgInscribedAreasSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fghhs-od-${CGAL_RELEASE_YEAR_ID} +, author = "Kaspar Fischer and Bernd G{\"a}rtner and Thomas Herrmann and Michael Hoffmann + and Sven Sch{\"o}nherr" +, title = "Optimal Distances" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgOptimalDistancesSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:ap-pcad-${CGAL_RELEASE_YEAR_ID} +, author = "Pierre Alliez and Sylvain Pion and Ankit Gupta" +, title = "Principal Component Analysis" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgPrincipalComponentAnalysisDSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Interpolation %%% + +@incollection{cgal:f-i-${CGAL_RELEASE_YEAR_ID} +, author = "Julia Fl{\"o}totto" +, title = "{2D} and Surface Function Interpolation" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgInterpolation2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:abha-gbc-${CGAL_RELEASE_YEAR_ID} +, author = "Dmitry Anisimov and David Bommes and Kai Hormann and Pierre Alliez" +, title = "2D Generalized Barycentric Coordinates" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBarycentric_coordinates_2Summary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Kinetic Data Structures %%% + +@incollection{cgal:r-kds-${CGAL_RELEASE_YEAR_ID} +, author = "Daniel Russel" +, title = "Kinetic Data Structures" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKdsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:r-kdsf-${CGAL_RELEASE_YEAR_ID} +, author = "Daniel Russel" +, title = "Kinetic Framework" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgKdsFrameworkSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Support Library %%% + +@incollection{cgal:hkpw-se-${CGAL_RELEASE_YEAR_ID} +, author = "Michael Hoffmann and Lutz Kettner and Sylvain Pion and Ron Wein" +, title = "STL Extensions for {CGAL}" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgStlExtensionSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:cfw-cbgl-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Fernando Cacciola and Ron Wein" +, title = "{CGAL} and the {Boost} Graph Library" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgBGLSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fs-cbpm-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Laurent Saboret" +, title = "{CGAL} and {Boost} Property Maps" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgProperty_mapSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dksy-hc-${CGAL_RELEASE_YEAR_ID} +, author = "Olivier Devillers and Lutz Kettner and Michael Seel and Mariette Yvinec" +, title = "Handles and Circulators" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgHandlesAndCirculatorsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:dhhk-gog-${CGAL_RELEASE_YEAR_ID} +, author = "Olivier Devillers and Susan Hert and Michael Hoffmann and Lutz Kettner and Sven Sch{\"o}nherr" +, title = "Geometric Object Generators" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGeneratorsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:kps-pthum-${CGAL_RELEASE_YEAR_ID} +, author = "Lutz Kettner and Sylvain Pion and Michael Seel" +, title = "Profiling Tools Timers, Hash Map, Union-find, Modifiers" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgProfilingToolsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fgk-ios-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Geert-Jan Giezeman and Lutz Kettner" +, title = "IO Streams" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgIOstreamsSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +%%% Visualization %%% + +@incollection{cgal:fp-gv-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Sylvain Pion" +, title = "Geomview" +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGeomviewSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:fr-cqgvf-${CGAL_RELEASE_YEAR_ID} +, author = "Andreas Fabri and Laurent Rineau" +, title = "{CGAL} and the Qt Graphics View Framework " +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgGraphicsViewSummary" +, year = ${CGAL_BUILD_YEAR4} +} + +@incollection{cgal:lp-gi-${CGAL_RELEASE_YEAR_ID} +, author = "S\'ebastien Loriot and Sylvain Pion" +, title = "{CGAL} Ipelets " +, publisher = "{CGAL Editorial Board}" +, edition = "{${CGAL_CREATED_VERSION_NUM}}" +, booktitle = "{CGAL} User and Reference Manual" +, url = "http://doc.cgal.org/${CGAL_CREATED_VERSION_NUM}/Manual/packages.html#PkgCGALIpeletsSummary" +, year = ${CGAL_BUILD_YEAR4} +} diff --git a/Solver_interface/doc/Solver_interface/Doxyfile.in b/Solver_interface/doc/Solver_interface/Doxyfile.in new file mode 100644 index 00000000000..26897048744 --- /dev/null +++ b/Solver_interface/doc/Solver_interface/Doxyfile.in @@ -0,0 +1,6 @@ +@INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} + +PROJECT_NAME = "CGAL ${CGAL_CREATED_VERSION_NUM} - CGAL and Solvers" +INPUT = ${CMAKE_SOURCE_DIR}/Solver_interface/doc/Solver_interface/ \ + ${CMAKE_SOURCE_DIR}/Solver_interface/include/CGAL + diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt new file mode 100644 index 00000000000..6bf4ec0a434 --- /dev/null +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -0,0 +1,55 @@ +/// \defgroup PkgSolver CGAL and Solvers Reference + +/// \defgroup PkgSolverConcepts Concepts +/// \ingroup PkgSolver +/// +/// We + +/// \defgroup PkgSolverHelper Helper Classes +/// \ingroup PkgSolver + + + + +/*! +\addtogroup PkgSolver +\cgalPkgDescriptionBegin{CGAL and Solvers,PkgSolverSummary} +\cgalPkgPicture{solver-detail.png} +\cgalPkgSummaryBegin +\cgalPkgAuthors{CGAL Editorial Board } +\cgalPkgDesc{This package provides } +\cgalPkgManuals{Chapter_CGAL_and_Solvers,PkgSolver} +\cgalPkgSummaryEnd +\cgalPkgShortInfoBegin +\cgalPkgSince{3.7} +\cgalPkgBib{cgal:eb-solver } +\cgalPkgLicense{\ref licensesLGPL "LGPL"} +\cgalPkgShortInfoEnd +\cgalPkgDescriptionEnd + +\cgalClassifedRefPages + +## Concepts ## +- `HalfedgeGraph` + + + +## %CGAL Classes Adapted for the Graph API ## + +Different \cgal types have +- \link BGLSMGT `boost::graph_traits< CGAL::Surface_mesh

>` \endlink +- \link BGLPolyGT `boost::graph_traits< CGAL::Polyhedron_3 >` \endlink +- \link BGLT2GT `boost::graph_traits< CGAL::Triangulation_2 >` \endlink +- \link BGLArgtGT `boost::graph_traits< CGAL::Arrangement_2 >` \endlink + + +## Euler Operations ## + +- `CGAL::Euler::join_vertex()` + + +*/ + + + + diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt new file mode 100644 index 00000000000..2174f3daeca --- /dev/null +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -0,0 +1,36 @@ +namespace CGAL { +/*! + +\mainpage User Manual +\anchor Chapter_CGAL_and_Solvers +\anchor chapterBGL +\cgalAutoToc +\authors NN + + + +The scope of \cgal is geometry and not solving linear systems. Nevertheless, this package +provides the necessary classes and functions that enable using the +algorithms of the + + +\section SolverConcepts Solver Concepts + + +See also the Chapter \ref PkgProperty_mapSummary. + +See also Section Visitor Concepts +in the \sc{Bgl} manual. + + +\subsection SolverExamplel Example: + +The following example program computes + +\cgalExample{Solver_interface/eigen.cpp} + + + +*/ +} /* namespace CGAL */ + diff --git a/Solver_interface/doc/Solver_interface/dependencies b/Solver_interface/doc/Solver_interface/dependencies new file mode 100644 index 00000000000..5d9a51f054b --- /dev/null +++ b/Solver_interface/doc/Solver_interface/dependencies @@ -0,0 +1,5 @@ +Manual +Kernel_23 +STL_Extension +Algebraic_foundations +Miscellany diff --git a/Solver_interface/doc/Solver_interface/examples.txt b/Solver_interface/doc/Solver_interface/examples.txt new file mode 100644 index 00000000000..a5fef23e60e --- /dev/null +++ b/Solver_interface/doc/Solver_interface/examples.txt @@ -0,0 +1,16 @@ +/*! +\example BGL_arrangement_2/arr_print.h +\example BGL_arrangement_2/arr_rational_nt.h +\example BGL_arrangement_2/dual.cpp +\example BGL_arrangement_2/primal.cpp +\example BGL_polyhedron_3/cube.off +\example BGL_polyhedron_3/distance.cpp +\example BGL_polyhedron_3/kruskal.cpp +\example BGL_polyhedron_3/kruskal_with_stored_id.cpp +\example BGL_polyhedron_3/normals.cpp +\example BGL_polyhedron_3/incident_vertices.cpp +\example BGL_triangulation_2/dijkstra.cpp +\example BGL_triangulation_2/dijkstra_with_internal_properties.cpp +\example BGL_triangulation_2/emst.cpp +\example BGL_surface_mesh/prim.cpp +*/ diff --git a/Solver_interface/include/CGAL/Eigen_solver_traits.hpp b/Solver_interface/include/CGAL/Eigen_solver_traits.hpp new file mode 100644 index 00000000000..c5e32e2d60c --- /dev/null +++ b/Solver_interface/include/CGAL/Eigen_solver_traits.hpp @@ -0,0 +1,187 @@ +// Copyright (c) 2012 INRIA Bordeaux Sud-Ouest (France), All rights reserved. +// +// This file is part of CGAL (www.cgal.org); 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// Author(s) : Gael Guennebaud + +#ifndef CGAL_EIGEN_SOLVER_TRAITS_H +#define CGAL_EIGEN_SOLVER_TRAITS_H + +#include // include basic.h before testing #defines +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4244) +#endif +#include +#if EIGEN_VERSION_AT_LEAST(3, 1, 91) + +#include +#endif + + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + +#include +#include +#include + +namespace CGAL { + + +namespace internal { + template + struct Get_eigen_matrix{ + typedef Eigen_sparse_matrix type; + }; + + template + struct Get_eigen_matrix< ::Eigen::ConjugateGradient,FT>{ + typedef Eigen_sparse_symmetric_matrix type; + }; + + template + struct Get_eigen_matrix< ::Eigen::SimplicialCholesky,FT>{ + typedef Eigen_sparse_symmetric_matrix type; + }; +#if EIGEN_VERSION_AT_LEAST(3, 1, 91) + template + struct Get_eigen_matrix< ::Eigen::SparseLU, FT> { + typedef Eigen_sparse_matrix type; + }; +#endif +} //internal + +/// The class Eigen_solver_traits +/// is a generic traits class for solving asymmetric or symmetric positive definite (SPD) +/// sparse linear systems using one of the Eigen solvers. +/// The default solver is the iterative bi-congugate gradient stabilized solver +/// Eigen::BiCGSTAB for double. +/// +/// \cgalModels `SparseLinearAlgebraTraitsWithFactor_d`. + + template::EigenType, Eigen::IncompleteLUT< double > > > +class Eigen_solver_traits +{ + typedef typename EigenSolverT::Scalar Scalar; +// Public types +public: + typedef Scalar NT; + typedef typename internal::Get_eigen_matrix::type Matrix; + typedef Eigen_vector Vector; + + +// Public operations +public: + + Eigen_solver_traits():m_mat(NULL), m_solver_sptr(new EigenSolverT) + { + } + + EigenSolverT& solver() { return *m_solver_sptr; } + + /// Solve the sparse linear system "A*X = B". + /// Return true on success. The solution is then (1/D) * X. + /// + /// @commentheading Preconditions: + /// - A.row_dimension() == B.dimension(). + /// - A.column_dimension() == X.dimension(). + bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D) + { + D = 1; // Eigen does not support homogeneous coordinates + + m_solver_sptr->compute(A.eigen_object()); + + if(m_solver_sptr->info() != Eigen::Success) + return false; + + X = m_solver_sptr->solve(B); + + return m_solver_sptr->info() == Eigen::Success; + } + + bool factor (const Matrix& A, NT& D) + { + D = 1; + + m_mat = &A.eigen_object(); + solver().compute(*m_mat); + return solver().info() == Eigen::Success; + } + + bool linear_solver(const Vector& B, Vector& X) + { + CGAL_precondition(m_mat!=NULL); //factor should have been called first + X = solver().solve(B); + return solver().info() == Eigen::Success; + } +protected: + const typename Matrix::EigenType* m_mat; + boost::shared_ptr m_solver_sptr; + +}; + +//specilization of the solver for BiCGSTAB as for surface parameterization, the +//intializer should be a vector of one's (this was the case in 3.1-alpha but not in the official 3.1). +template<> +class Eigen_solver_traits< Eigen::BiCGSTAB::EigenType, Eigen::IncompleteLUT< double > > > +{ + typedef Eigen::BiCGSTAB::EigenType, Eigen::IncompleteLUT< double > > EigenSolverT; + typedef EigenSolverT::Scalar Scalar; +// Public types +public: + typedef Scalar NT; + typedef internal::Get_eigen_matrix::type Matrix; + typedef Eigen_vector Vector; + + +// Public operations +public: + + Eigen_solver_traits(): m_solver_sptr(new EigenSolverT) + { + } + + EigenSolverT& solver() { return *m_solver_sptr; } + + /// Solve the sparse linear system "A*X = B". + /// Return true on success. The solution is then (1/D) * X. + /// + /// @commentheading Preconditions: + /// - A.row_dimension() == B.dimension(). + /// - A.column_dimension() == X.dimension(). + bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D) + { + D = 1; // Eigen does not support homogeneous coordinates + + m_solver_sptr->compute(A.eigen_object()); + + if(m_solver_sptr->info() != Eigen::Success) + return false; + + X.setOnes(B.rows()); + X = m_solver_sptr->solveWithGuess(B,X); + + return m_solver_sptr->info() == Eigen::Success; + } +protected: + boost::shared_ptr m_solver_sptr; + +}; + +} //namespace CGAL + +#endif // CGAL_EIGEN_SOLVER_TRAITS_H From 83f1d1b29ac60ced748dd0350413a0d01b474511 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Mar 2015 08:57:00 +0100 Subject: [PATCH 02/61] move files --- Jet_fitting_3/doc/Jet_fitting_3/Concepts/SvdTraits.h | 2 +- .../doc/Solver_interface}/CGAL/Eigen_matrix.h | 2 +- .../doc/Solver_interface}/CGAL/Eigen_solver_traits.h | 2 +- .../doc/Solver_interface}/CGAL/Eigen_vector.h | 2 +- .../Concepts/SparseLinearAlgebraTraitsWithFactor_d.h | 2 +- .../Solver_interface}/Concepts/SparseLinearAlgebraTraits_d.h | 2 +- Solver_interface/doc/Solver_interface/PackageDescription.txt | 3 ++- .../doc/Surface_mesh_parameterization/PackageDescription.txt | 1 - .../doc/Surface_mesh_parameterization/dependencies | 1 + Surface_modeling/doc/Surface_modeling/PackageDescription.txt | 1 - Surface_modeling/doc/Surface_modeling/dependencies | 2 ++ 11 files changed, 11 insertions(+), 9 deletions(-) rename {Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include => Solver_interface/doc/Solver_interface}/CGAL/Eigen_matrix.h (97%) rename {Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include => Solver_interface/doc/Solver_interface}/CGAL/Eigen_solver_traits.h (97%) rename {Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include => Solver_interface/doc/Solver_interface}/CGAL/Eigen_vector.h (94%) rename {Surface_modeling/doc/Surface_modeling => Solver_interface/doc/Solver_interface}/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h (97%) rename {Surface_mesh_parameterization/doc/Surface_mesh_parameterization => Solver_interface/doc/Solver_interface}/Concepts/SparseLinearAlgebraTraits_d.h (98%) diff --git a/Jet_fitting_3/doc/Jet_fitting_3/Concepts/SvdTraits.h b/Jet_fitting_3/doc/Jet_fitting_3/Concepts/SvdTraits.h index 01230f9a162..5d2d6decc97 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/Concepts/SvdTraits.h +++ b/Jet_fitting_3/doc/Jet_fitting_3/Concepts/SvdTraits.h @@ -39,7 +39,7 @@ public: /*! The matrix type, model of the concept `SvdTraits::Matrix`. */ - typedef unspecified_type matrix; + typedef unspecified_type Matrix; /// @} diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_matrix.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h similarity index 97% rename from Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_matrix.h rename to Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h index db99a7ffa9c..2e952da270b 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_matrix.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h @@ -2,7 +2,7 @@ namespace CGAL { /*! -\ingroup PkgSurfaceParameterizationAlgebra +\ingroup PkgSolver The class `Eigen_sparse_matrix` is a C++ wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix` that represents general matrices, be they symmetric or not. diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_solver_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h similarity index 97% rename from Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_solver_traits.h rename to Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h index 9cec277b46b..289485d4aaf 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h @@ -2,7 +2,7 @@ namespace CGAL { /*! -\ingroup PkgSurfaceParameterizationAlgebra +\ingroup PkgSolver The class `Eigen_solver_traits` provides an interface to the sparse solvers of \ref thirdpartyEigen "Eigen". The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_vector.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h similarity index 94% rename from Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_vector.h rename to Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h index 9b5a0b24521..1b220eb1ea6 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/include/CGAL/Eigen_vector.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h @@ -2,7 +2,7 @@ namespace CGAL { /*! -\ingroup PkgSurfaceParameterizationAlgebra +\ingroup PkgSolver The class `Eigen_vector` is a C++ wrapper around \ref thirdpartyEigen "Eigen" vector, which is a simple array of numbers. The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. diff --git a/Surface_modeling/doc/Surface_modeling/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h similarity index 97% rename from Surface_modeling/doc/Surface_modeling/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h rename to Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h index 2f64c66d578..dfaf510ebae 100644 --- a/Surface_modeling/doc/Surface_modeling/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h @@ -1,6 +1,6 @@ /*! -\ingroup PkgSurfaceModelingConcepts +\ingroup PkgSolverConcepts \cgalConcept @brief Concept describing the set of requirements for a direct sparse linear system solver with factorization. diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Concepts/SparseLinearAlgebraTraits_d.h b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h similarity index 98% rename from Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Concepts/SparseLinearAlgebraTraits_d.h rename to Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h index e8872f54e03..f8e79aceddc 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Concepts/SparseLinearAlgebraTraits_d.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h @@ -1,6 +1,6 @@ /*! -\ingroup PkgSurfaceParameterizationConcepts +\ingroup PkgSolverConcepts \cgalConcept The concept `SparseLinearAlgebraTraits_d` is used to solve sparse linear systems A\f$ \times \f$ X = B. diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index 6bf4ec0a434..2977c94b4d2 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -30,8 +30,9 @@ \cgalClassifedRefPages ## Concepts ## -- `HalfedgeGraph` +- `SparseLinearAlgebraTraits_d` +- `SparseLinearAlgebraTraitsWithFactor_d` ## %CGAL Classes Adapted for the Graph API ## diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt index 463a855a39d..9d2af5f10a9 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt @@ -31,7 +31,6 @@ - `BorderParameterizer_3` - `ParameterizationMesh_3` - `ParameterizationPatchableMesh_3` -- `SparseLinearAlgebraTraits_d` - `PolyhedronTraitsWithKernel_3` ## Surface Parameterization Methods ## diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/dependencies b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/dependencies index fce1616127d..bf0d8576788 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/dependencies +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/dependencies @@ -6,3 +6,4 @@ Circulator Stream_support Polyhedron Kernel_d +Solver_interface diff --git a/Surface_modeling/doc/Surface_modeling/PackageDescription.txt b/Surface_modeling/doc/Surface_modeling/PackageDescription.txt index f0c9b321e95..1f047cd016b 100644 --- a/Surface_modeling/doc/Surface_modeling/PackageDescription.txt +++ b/Surface_modeling/doc/Surface_modeling/PackageDescription.txt @@ -31,7 +31,6 @@ under positional constraints of some of its vertices, without requiring any addi ## Concepts ## - `DeformationClosestRotationTraits_3` - `RawPoint_3` -- `SparseLinearAlgebraTraitsWithFactor_d` - `SurfaceModelingWeights` ## Algebraic Traits ## diff --git a/Surface_modeling/doc/Surface_modeling/dependencies b/Surface_modeling/doc/Surface_modeling/dependencies index 0988d1b453e..f39bf90fd2c 100644 --- a/Surface_modeling/doc/Surface_modeling/dependencies +++ b/Surface_modeling/doc/Surface_modeling/dependencies @@ -7,3 +7,5 @@ Stream_support Polyhedron BGL Surface_mesh_parameterization +Solver_interface + From c50448e918c8bac971809ada6c12af425678375a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Mar 2015 08:51:12 +0200 Subject: [PATCH 03/61] move SvdTraits --- .../doc/Solver_interface}/CGAL/Eigen_svd.h | 0 .../Solver_interface}/Concepts/SvdTraits.h | 2 +- .../Solver_interface/PackageDescription.txt | 24 +++++-------------- 3 files changed, 7 insertions(+), 19 deletions(-) rename {Jet_fitting_3/doc/Jet_fitting_3 => Solver_interface/doc/Solver_interface}/CGAL/Eigen_svd.h (100%) rename {Jet_fitting_3/doc/Jet_fitting_3 => Solver_interface/doc/Solver_interface}/Concepts/SvdTraits.h (98%) diff --git a/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Eigen_svd.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h similarity index 100% rename from Jet_fitting_3/doc/Jet_fitting_3/CGAL/Eigen_svd.h rename to Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h diff --git a/Jet_fitting_3/doc/Jet_fitting_3/Concepts/SvdTraits.h b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h similarity index 98% rename from Jet_fitting_3/doc/Jet_fitting_3/Concepts/SvdTraits.h rename to Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h index 5d2d6decc97..4e139dac5f5 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/Concepts/SvdTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h @@ -1,5 +1,5 @@ /*! - \ingroup PkgJet_fitting_3Concepts + \ingroup PkgSolverConcepts \cgalConcept The concept `SvdTraits` describes the set of requirements to be diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index 2977c94b4d2..032e5de2a3b 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -5,11 +5,6 @@ /// /// We -/// \defgroup PkgSolverHelper Helper Classes -/// \ingroup PkgSolver - - - /*! \addtogroup PkgSolver @@ -33,21 +28,14 @@ - `SparseLinearAlgebraTraits_d` - `SparseLinearAlgebraTraitsWithFactor_d` +- `SvdTraits` +## Classes ## -## %CGAL Classes Adapted for the Graph API ## - -Different \cgal types have -- \link BGLSMGT `boost::graph_traits< CGAL::Surface_mesh

>` \endlink -- \link BGLPolyGT `boost::graph_traits< CGAL::Polyhedron_3 >` \endlink -- \link BGLT2GT `boost::graph_traits< CGAL::Triangulation_2 >` \endlink -- \link BGLArgtGT `boost::graph_traits< CGAL::Arrangement_2 >` \endlink - - -## Euler Operations ## - -- `CGAL::Euler::join_vertex()` - +- `Eigen_solver_traits` +- `Eigen_svd` +- `Eigen_matrix` +- `Eigen_vector` */ From 71aed48848c2aeb1eea578137d6864c0e638b764 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 2 Apr 2015 14:08:18 +0200 Subject: [PATCH 04/61] cleanup --- .../CGAL/Monge_via_jet_fitting.h | 2 +- .../doc/Jet_fitting_3/PackageDescription.txt | 4 +- Jet_fitting_3/doc/Jet_fitting_3/dependencies | 1 + .../doc/Solver_interface/CGAL/Eigen_matrix.h | 2 +- .../CGAL/Eigen_solver_traits.h | 5 +- .../doc/Solver_interface/CGAL/Eigen_svd.h | 4 +- .../Concepts/LinearAlgebraTraits_d.h | 183 +++++++++ .../doc/Solver_interface/Concepts/Matrix.h | 354 ++++++++++++++++++ .../Concepts/SparseLinearAlgebraTraits_d.h | 17 +- .../doc/Solver_interface/Concepts/SvdTraits.h | 20 +- .../doc/Solver_interface/Concepts/Vector.h | 177 +++++++++ .../doc/Solver_interface/Doxyfile.in | 3 +- .../Solver_interface/PackageDescription.txt | 11 +- .../doc/Solver_interface/Solver_interface.txt | 21 +- .../doc/Solver_interface/dependencies | 1 + .../doc/Solver_interface/examples.txt | 15 +- .../doc/Solver_interface/fig/solver.png | Bin 0 -> 909 bytes 17 files changed, 749 insertions(+), 71 deletions(-) create mode 100644 Solver_interface/doc/Solver_interface/Concepts/LinearAlgebraTraits_d.h create mode 100644 Solver_interface/doc/Solver_interface/Concepts/Matrix.h create mode 100644 Solver_interface/doc/Solver_interface/Concepts/Vector.h create mode 100755 Solver_interface/doc/Solver_interface/fig/solver.png diff --git a/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Monge_via_jet_fitting.h b/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Monge_via_jet_fitting.h index 79c817fd066..947b05c27ad 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Monge_via_jet_fitting.h +++ b/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Monge_via_jet_fitting.h @@ -24,7 +24,7 @@ the geometric classes and tools required by local computations. \tparam SvdTraits features the linear -algebra algorithm required by the fitting method. +algebra algorithm required by the fitting method. The scalar type, `SvdTraits::FT`, must be the same as that of the `LocalKernel` concept : `LocalKernel::FT`. \sa `Eigen_svd` \sa `Monge_form` diff --git a/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt b/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt index 0fabcbfd18f..cb916cc1583 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt +++ b/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt @@ -25,12 +25,12 @@ ## Concepts ## - `DataKernel` - `LocalKernel` -- `SvdTraits` + ## Classes ## - \link CGAL::Monge_via_jet_fitting::Monge_form `CGAL::Monge_via_jet_fitting< DataKernel, LocalKernel, SvdTraits>::Monge_form` \endlink - `CGAL::Monge_via_jet_fitting` -- `CGAL::Eigen_svd` + ## Global Functions ## The insert operator (operator<< ) is overloaded for the class \link CGAL::Monge_via_jet_fitting::Monge_form `Monge_form` \endlink. diff --git a/Jet_fitting_3/doc/Jet_fitting_3/dependencies b/Jet_fitting_3/doc/Jet_fitting_3/dependencies index 468e2683aad..f18ef3e0938 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/dependencies +++ b/Jet_fitting_3/doc/Jet_fitting_3/dependencies @@ -5,3 +5,4 @@ Algebraic_foundations Circulator Stream_support Number_types +Solver_interface diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h index 2e952da270b..0748e5f8b09 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h @@ -41,7 +41,7 @@ typedef unspecified_type EigenType; namespace CGAL { /*! -\ingroup PkgSurfaceParameterizationAlgebra +\ingroup PkgSolver The class `Eigen_sparse_symmetric_matrix` is a C++ wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix`. diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h index 289485d4aaf..c5850c93336 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h @@ -9,16 +9,13 @@ The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available o \cgalModels `SparseLinearAlgebraTraitsWithFactor_d` -Parameters --------------- -`T`: a sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver +\tparam T a sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver `Eigen::BiCGSTAB` for `double`. \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` \sa `CGAL::Eigen_vector` -\sa http://eigen.tuxfamily.org Example -------------- diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h index 974d4ffa48a..810308c7874 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h @@ -2,7 +2,7 @@ namespace CGAL { /*! -\ingroup PkgJet_fitting_3 +\ingroup PkgSolver The class `Eigen_svd` provides an algorithm to solve in the least square sense a linear system with a singular value decomposition using @@ -15,7 +15,7 @@ square sense a linear system with a singular value decomposition using class Eigen_svd { public: -/// @} + }; /* end Eigen_svd */ } /* end namespace CGAL */ diff --git a/Solver_interface/doc/Solver_interface/Concepts/LinearAlgebraTraits_d.h b/Solver_interface/doc/Solver_interface/Concepts/LinearAlgebraTraits_d.h new file mode 100644 index 00000000000..c52619321be --- /dev/null +++ b/Solver_interface/doc/Solver_interface/Concepts/LinearAlgebraTraits_d.h @@ -0,0 +1,183 @@ + +/*! +\ingroup PkgKernelDLinAlgConcepts +\cgalConcept + +The data type `LinearAlgebraTraits_d` encapsulates two classes +`Matrix`, `Vector` and many functions of basic linear algebra. +An instance of data type `Matrix` is a matrix of variables of type +`NT`. Accordingly, `Vector` implements vectors of variables of +type `NT`. Most functions of linear algebra are checkable, +i.e., the programs can be asked for a proof that their output is +correct. For example, if the linear system solver declares a linear +system \f$ A x = b\f$ unsolvable it also returns a vector \f$ c\f$ such that +\f$ c^T A = 0\f$ and \f$ c^T b \neq 0\f$. + +\cgalHasModel `CGAL::Linear_algebraHd` +\cgalHasModel `CGAL::Linear_algebraCd` + +*/ + +class LinearAlgebraTraits_d { +public: + +/// \name Types +/// @{ + +/*! +the number type of the components. +*/ +typedef unspecified_type NT; + +/*! +the vector type. +*/ +typedef unspecified_type Vector; + +/*! +the matrix type. +*/ +typedef unspecified_type Matrix; + +/// @} + +/// \name Operations +/// @{ + +/*! +returns \f$ M^T\f$ +(a `M.column_dimension()` \f$ \times\f$ `M.column_dimension()` - +matrix). +*/ +static Matrix transpose(const Matrix& M); + +/*! +determines whether `M` has an inverse. It also +computes either the inverse as \f$ (1/D) \cdot I\f$ or when no +inverse exists, a vector \f$ c\f$ such that \f$ c^T \cdot M = 0 \f$. +\pre \f$ M\f$ is square. +*/ +static bool inverse(const Matrix& M, Matrix& I, NT& D, +Vector& c); + +/*! +returns the +inverse matrix of `M`. More precisely, \f$ 1/D\f$ times the matrix +returned is the inverse of `M`. +\pre `determinant(M) != 0`. + +\pre \f$ M\f$ is square. +*/ +static Matrix inverse(const Matrix& M, NT& D) ; + +/*! +returns the determinant \f$ D\f$ of +`M` and sufficient information to verify that the value of the +determinant is correct. If the determinant is zero then \f$ c\f$ is a +vector such that \f$ c^T \cdot M = 0\f$. If the determinant is non-zero +then \f$ L\f$ and \f$ U\f$ are lower and upper diagonal matrices respectively +and \f$ q\f$ encodes a permutation matrix \f$ Q\f$ with \f$ Q(i,j) = 1\f$ iff \f$ i = +q(j)\f$ such that \f$ L \cdot M \cdot Q = U\f$, \f$ L(0,0) = 1\f$, \f$ L(i,i) = U(i +- 1,i - 1)\f$ for all \f$ i\f$, \f$ 1 \le i < n\f$, and \f$ D = s \cdot U(n - 1,n - +1)\f$ where \f$ s\f$ is the determinant of \f$ Q\f$. + +\pre `M` is square. +*/ +static NT determinant (const Matrix& M, Matrix& L, Matrix& +U, std::vector& q, Vector& c); + +/*! +verifies the conditions stated above. +*/ +static bool verify_determinant (const Matrix& M, NT D, +Matrix& L, Matrix& U, const std::vector& q, Vector& +c); + +/*! +returns the +determinant of `M`. + +\pre `M` is square. +*/ +static NT determinant (const Matrix& M); + +/*! +returns +the sign of the determinant of `M`. + +\pre `M` is square. +*/ +static int sign_of_determinant (const Matrix& M); + +/*! +determines +the complete solution space of the linear system \f$ M\cdot x = b\f$. If +the system is unsolvable then \f$ c^T \cdot M = 0\f$ and \f$ c^T \cdot b +\not= 0\f$. If the system is solvable then \f$ (1/D) x\f$ is a solution, +and the columns of `spanning_vectors` are a maximal set of +linearly independent solutions to the corresponding homogeneous +system. + +\pre `M.row_dimension() = b.dimension()`. +*/ +static bool linear_solver(const Matrix& M, const Vector& b, +Vector& x, NT& D, Matrix& spanning_vectors, Vector& c); + +/*! +determines whether the linear +system \f$ M\cdot x = b\f$ is solvable. If yes, then \f$ (1/D) x\f$ is a +solution, if not then \f$ c^T \cdot M = 0\f$ and \f$ c^T \cdot b \not= 0\f$. +\pre `M.row_dimension() = b.dimension()`. +*/ +static bool linear_solver(const Matrix& M, const Vector& b, +Vector& x, NT& D, Vector& c) ; + +/*! +as above, but without the witness \f$ c\f$ +\pre `M.row_dimension() = b.dimension()`. +*/ +static bool linear_solver(const Matrix& M, const Vector& b, +Vector& x, NT& D) ; + +/*! +determines whether the system \f$ M \cdot x = b\f$ is solvable + +\pre `M.row_dimension() = b.dimension()`. +*/ +static bool is_solvable(const Matrix& M, const Vector& b) +; + +/*! +determines whether the homogeneous linear system +\f$ M\cdot x = 0\f$ has a non - trivial solution. If yes, then \f$ x\f$ is +such a solution. +*/ +static bool homogeneous_linear_solver (const Matrix& M, +Vector& x); + +/*! +determines the solution space of the +homogeneous linear system \f$ M\cdot x = 0\f$. It returns the dimension +of the solution space. Moreover the columns of `spanning_vecs` +span the solution space. +*/ +static int homogeneous_linear_solver (const Matrix& M, +Matrix& spanning_vecs); + +/*! +returns the indices of a maximal subset +of independent columns of `M`. +*/ +static int independent_columns (const Matrix& M, +std::vector& columns); + +/*! +returns the rank of +matrix `M` +*/ +static int rank (const Matrix & M); + +/// @} + +}; /* end LinearAlgebraTraits_d */ + diff --git a/Solver_interface/doc/Solver_interface/Concepts/Matrix.h b/Solver_interface/doc/Solver_interface/Concepts/Matrix.h new file mode 100644 index 00000000000..c1728429535 --- /dev/null +++ b/Solver_interface/doc/Solver_interface/Concepts/Matrix.h @@ -0,0 +1,354 @@ + +/*! +\ingroup PkgKernelDLinAlgConcepts +\cgalConcept + +An instance of data type `Matrix` is a matrix of +variables of number type `NT`. The types `Matrix` and `Vector` +together realize many functions of basic linear algebra. + +*/ + +class Matrix { +public: + +/// \name Types +/// @{ + +/*! +the ring type of the components. +*/ +typedef unspecified_type NT; + +/*! +bidirectional iterator for accessing +all components row-wise. +*/ +typedef unspecified_type iterator; + +/*! +bidirectional iterator for accessing +all components row-wise. +*/ +typedef unspecified_type const_iterator; + + +/*! +random access iterator for accessing row +entries. +*/ +typedef unspecified_type row_iterator; + +/*! +random access iterator for accessing row +entries. +*/ +typedef unspecified_type const_row_iterator; + +/*! +random access iterator for accessing +column entries. +*/ +typedef unspecified_type column_iterator; + +/*! +random access iterator for accessing +column entries. +*/ +typedef unspecified_type const_column_iterator; + +/*! +a tag class for identity initialization +*/ +typedef unspecified_type Identity; + +/*! +the vector type used. +*/ +typedef unspecified_type Vector; + +/// @} + +/// \name Creation +/// @{ + +/*! +creates an instance `M` of type +`Matrix`. +*/ +Matrix(); + +/*! +creates an instance `M` of type +`Matrix` of dimension \f$ n \times n\f$ initialized to the zero matrix. + +*/ +Matrix(int n); + +/*! +creates an instance `M` of +type `Matrix` of dimension \f$ m \times n\f$ initialized to the zero +matrix. +*/ +Matrix(int m, int n); + +/*! +creates an instance +`M` of type `Matrix` of dimension +`p.first`\f$ \times\f$`p.second` initialized to the zero matrix. +*/ +Matrix(std::pair p); + +/*! +creates an +instance `M` of type `Matrix` of dimension \f$ n \times n\f$ +initialized to the identity matrix (times `x`). +*/ +Matrix(int n, Identity, NT x = NT(1)); + +/*! +creates an instance `M` +of type `Matrix` of dimension \f$ m \times n\f$ initialized to the +matrix with `x` entries. +*/ +Matrix(int m, int n, NT x); + +/*! +creates an +instance `M` of type `Matrix`. Let \f$ S\f$ be the ordered set of +\f$ n\f$ column-vectors of common dimension \f$ m\f$ as given by the iterator +range `[first,last)`. `M` is initialized to an \f$ m \times n\f$ +matrix with the columns as specified by \f$ S\f$. + +\pre `Forward_iterator` has a value type `V` from which we require to provide a iterator type `V::const_iterator`, to have `V::value_type == NT`. + +Note that `Vector` or `std::vector` fulfill these requirements. +*/ +template +Matrix(Forward_iterator first, Forward_iterator last); + +/*! +creates an instance +`M` of type `Matrix`. Let \f$ A\f$ be an array of \f$ n\f$ +column-vectors of common dimension \f$ m\f$. `M` is initialized to an +\f$ m \times n\f$ matrix with the columns as specified by \f$ A\f$. +*/ +Matrix(std::vector< Vector > A); + +/// @} + +/// \name Operations +/// @{ + +/*! +returns \f$ n\f$, the number of rows of +`M`. +*/ +int row_dimension() ; + +/*! +returns \f$ m\f$, the number of columns +of `M`. +*/ +int column_dimension() ; + +/*! +returns \f$ (m,n)\f$, the +dimension pair of `M`. +*/ +std::pair dimension() ; + +/*! +returns the \f$ i\f$-th row of `M` (an +\f$ m\f$ - vector). + +\pre \f$ 0 \le i \le m - 1\f$. +*/ +Vector row(int i) ; + +/*! +returns the \f$ i\f$-th column of `M` +(an \f$ n\f$ - vector). + +\pre \f$ 0 \le i \le n - 1\f$. +*/ +Vector column(int i) ; + +/*! +returns \f$ M_{i,j}\f$. +\pre \f$ 0\le i\le m-1\f$ and \f$ 0\le j\le n-1\f$. +*/ +NT& operator()(int i, int j) ; + +/*! +swaps rows \f$ i\f$ and \f$ j\f$. +\pre \f$ 0\le i\le m-1\f$ and \f$ 0\le j\le m-1\f$. + +*/ +void swap_rows(int i, int j) ; + +/*! +swaps columns \f$ i\f$ and +\f$ j\f$. + +\pre \f$ 0\le i\le n-1\f$ and \f$ 0\le j\le n-1\f$. +*/ +void swap_columns(int i, int j) ; + +/*! +an iterator pointing to the +first entry of the \f$ i\f$th row. + +\pre \f$ 0\le i\le m-1\f$. +*/ +row_iterator row_begin(int i) ; + +/*! +an iterator pointing beyond +the last entry of the \f$ i\f$th row. + +\pre \f$ 0\le i\le m-1\f$. +*/ +row_iterator row_end(int i) ; + +/*! +an iterator pointing to the +first entry of the \f$ i\f$th row. + +\pre \f$ 0\le i\le m-1\f$. +*/ +const_row_iterator row_begin(int i) const; + +/*! +an iterator pointing beyond +the last entry of the \f$ i\f$th row. + +\pre \f$ 0\le i\le m-1\f$. +*/ +const_row_iterator row_end(int i) const; + +/*! +an iterator pointing +to the first entry of the \f$ i\f$th column. + +\pre \f$ 0\le i\le n-1\f$. + +*/ +column_iterator column_begin(int i) ; + +/*! +an iterator pointing +beyond the last entry of the \f$ i\f$th column. + +\pre \f$ 0\le i\le n-1\f$. +*/ +column_iterator column_end(int i) ; + +/*! +an iterator pointing +to the first entry of the \f$ i\f$th column. + +\pre \f$ 0\le i\le n-1\f$. + +*/ +const_column_iterator column_begin(int i) const; + +/*! +an iterator pointing +beyond the last entry of the \f$ i\f$th column. + +\pre \f$ 0\le i\le n-1\f$. +*/ +const_column_iterator column_end(int i) const; + + +/*! +an iterator pointing to the first entry +of \f$ M\f$. +*/ +iterator begin(); + +/*! +an iterator pointing beyond the last entry +of \f$ M\f$. +*/ +terator end(); + +/*! +an iterator pointing to the first entry +of \f$ M\f$. +*/ +const_iterator begin() const; + +/*! +an iterator pointing beyond the last entry +of \f$ M\f$. +*/ +const_terator end() const; + + +/*! +Test for equality. +*/ +bool operator==(const Matrix& M1) ; + +/*! +Test for inequality. +*/ +bool operator!=(const Matrix& M1) ; + +/// @} + +/// \name Arithmetic Operators +/// @{ + +/*! +Addition. +\pre `M.row_dimension() == M1.row_dimension()` +\pre `M.column_dimension() == M1.column_dimension()` +*/ +Matrix operator+ (const Matrix& M1); + +/*! + +Subtraction. +\pre `M.row_dimension() == M1.row_dimension()` +\pre `M.column_dimension() == M1.column_dimension()` +*/ +Matrix operator- (const Matrix& M1); + +/*! +Negation. +*/ +Matrix operator-(); + +/*! +Multiplication. + +\pre `M.column_dimension() = M1.row_dimension()` +*/ +Matrix operator*(const Matrix& M1) +; + +/*! +Multiplication with +vector. + +\pre `M.column_dimension() = vec.dimension()` +*/ +Vector operator*(const Vector& vec) ; + +/*! +Multiplication of every entry with `x`. +*/ +Matrix operator*(const NT& x, const Matrix& M); + +/*! +Multiplication of every entry with `x`. +*/ +Matrix operator*(const Matrix& M, const NT& x) ; + +/// @} + +}; /* end Matrix */ + diff --git a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h index f8e79aceddc..5670f5113ac 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h @@ -5,14 +5,11 @@ The concept `SparseLinearAlgebraTraits_d` is used to solve sparse linear systems A\f$ \times \f$ X = B. -\cgalRefines `LinearAlgebraTraits_d` \cgalHasModel `CGAL::Eigen_solver_traits` \cgalHasModel `OpenNL::DefaultLinearSolverTraits` in OpenNL package \cgalHasModel `OpenNL::SymmetricLinearSolverTraits` in OpenNL package -\sa `SparseLinearAlgebraTraits_d::Matrix` -\sa `SparseLinearAlgebraTraits_d::Vector` */ @@ -67,7 +64,7 @@ bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D); /// @} /*! -\ingroup PkgSurfaceParameterizationConcepts +\ingroup PkgSolverConcepts \cgalConcept `SparseLinearAlgebraTraits_d::Vector` is a concept of a vector that can be multiplied by a sparse matrix. @@ -82,7 +79,10 @@ bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D); */ -class Vector { +}; /* end SparseLinearAlgebraTraits_d */ + + +class SparseLinearAlgebraTraits_d::Vector { public: /// \name Types @@ -142,7 +142,7 @@ NT& operator[](int row); }; /* end Vector */ /*! -\ingroup PkgSurfaceParameterizationConcepts +\ingroup PkgSolverConcepts \cgalConcept `SparseLinearAlgebraTraits_d::Matrix` is a concept of a sparse matrix class. @@ -158,7 +158,7 @@ NT& operator[](int row); */ -class Matrix { + class SparseLinearAlgebraTraits_d::Matrix { public: /// \name Types @@ -243,6 +243,3 @@ void set_coef(int row, int column, NT value, bool new_coef = false); }; /* end Matrix */ - -}; /* end SparseLinearAlgebraTraits_d */ - diff --git a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h index 4e139dac5f5..639ae5a158d 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h @@ -2,22 +2,12 @@ \ingroup PkgSolverConcepts \cgalConcept - The concept `SvdTraits` describes the set of requirements to be - fulfilled by any class used to instantiate the third template - parameter of the class - `CGAL::Monge_via_jet_fitting`. - - It describes the linear algebra types and algorithms needed by the - class `CGAL::Monge_via_jet_fitting`. - - \cgalHeading{Requirements} - - The scalar type, `SvdTraits::FT`, must be the same as that of - the `LocalKernel` concept : `LocalKernel::FT`. + The concept `SvdTraits` describes the linear algebra types and algorithms needed + to solve in the least square sense a linear system with a singular value decomposition \cgalHasModel `CGAL::Eigen_svd` - \sa `LocalKernel` + \sa `CGAL::Monge_via_jet_fitting` */ class SvdTraits { @@ -60,7 +50,7 @@ public: }; /* end SvdTraits */ /*! -\ingroup PkgJet_fitting_3Concepts +\ingroup PkgSolverConcepts \cgalConcept Concept of vector type used by the concept SvdTraits. */ @@ -93,7 +83,7 @@ public: /*! -\ingroup PkgJet_fitting_3Concepts +\ingroup PkgSolverConcepts \cgalConcept Concept of matrix type used by the concept SvdTraits. */ diff --git a/Solver_interface/doc/Solver_interface/Concepts/Vector.h b/Solver_interface/doc/Solver_interface/Concepts/Vector.h new file mode 100644 index 00000000000..ed8882ec327 --- /dev/null +++ b/Solver_interface/doc/Solver_interface/Concepts/Vector.h @@ -0,0 +1,177 @@ + +/*! +\ingroup PkgKernelDLinAlgConcepts +\cgalConcept + +An instance of data type `Vector` is a vector of variables of +number type `NT`. Together with the type `Matrix` it realizes +the basic operations of linear algebra. + +*/ + +class Vector { +public: + +/// \name Types +/// @{ + +/*! +the ring type of the components. +*/ +typedef unspecified_type NT; + +/*! +the iterator type for accessing components. +*/ +typedef unspecified_type iterator; + +/*! +the const iterator type for accessing +components. +*/ +typedef unspecified_type const_iterator; + +/// @} + +/// \name Creation +/// @{ + +/*! +creates an instance `v` of type +`Vector`. +*/ +Vector(); + +/*! +creates an instance `v` of type +`Vector`. `v` is initialized to a vector of dimension \f$ d\f$. + +*/ +Vector(int d); + +/*! +creates an instance `v` of +type `Vector`. `v` is initialized to a vector of dimension +\f$ d\f$ with entries `x`. +*/ +Vector(int d, NT x); + +/*! +creates an +instance `v` of type `Vector`; `v` is initialized to the +vector with entries `set [first,last)`. +\cgalRequires `Forward_iterator` has value type `NT`. +*/ +template +Vector(Forward_iterator first, Forward_iterator last); + +/// @} + +/// \name Operations +/// @{ + +/*! +returns the dimension of `v`. +*/ +int dimension() ; + +/*! +returns true iff `v` is the zero +vector. +*/ +bool is_zero() ; + +/*! +returns the \f$ i\f$-th component of `v`. + +\pre \f$ 0\le i \le v.dimension()-1\f$. +*/ +NT& operator[](int i) ; + +/*! +iterator to the first component. +*/ +iterator begin() ; + +/*! +iterator beyond the last component. +*/ +iterator end() ; + +/*! +iterator to the first component. +*/ +const_iterator begin() const; + +/*! +iterator beyond the last component. +*/ +const_iterator end() const; + + +/*! +Addition. + +\pre `v.dimension() == v1.dimension()`. +*/ +Vector operator+(const Vector& v1) ; + +/*! +Subtraction. + +\pre `v.dimension() = v1.dimension()`. +*/ +Vector operator-(const Vector& v1) ; + +/*! +Inner Product. + +\pre `v.dimension() = v1.dimension()`. +*/ +NT operator*(const Vector& v1) ; + +/*! +Negation. +*/ +Vector operator-() ; + +/*! +Addition plus assignment. + +\pre `v.dimension() == v1.dimension()`. +*/ +Vector& operator+=(const Vector& v1); + +/*! +Subtraction plus assignment. + +\pre `v.dimension() == v1.dimension()`. +*/ +Vector& operator-=(const Vector& v1); + +/*! +Scalar multiplication plus +assignment. +*/ +Vector& operator*=(const NT& s); + +/*! +Scalar division plus assignment. + +*/ +Vector& operator/=(const NT& s); + +/*! +Component-wise multiplication with number \f$ r\f$. +*/ +Vector operator*(const NT& r, const Vector& v); + +/*! +Component-wise multiplication with number \f$ r\f$. +*/ +Vector operator*(const Vector& v, const NT& r); + +/// @} + +}; /* end Vector */ + diff --git a/Solver_interface/doc/Solver_interface/Doxyfile.in b/Solver_interface/doc/Solver_interface/Doxyfile.in index 26897048744..506657d2239 100644 --- a/Solver_interface/doc/Solver_interface/Doxyfile.in +++ b/Solver_interface/doc/Solver_interface/Doxyfile.in @@ -1,6 +1,5 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} PROJECT_NAME = "CGAL ${CGAL_CREATED_VERSION_NUM} - CGAL and Solvers" -INPUT = ${CMAKE_SOURCE_DIR}/Solver_interface/doc/Solver_interface/ \ - ${CMAKE_SOURCE_DIR}/Solver_interface/include/CGAL +INPUT = ${CMAKE_SOURCE_DIR}/Solver_interface/doc/Solver_interface/ diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index 032e5de2a3b..b59e1ad476c 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -3,13 +3,12 @@ /// \defgroup PkgSolverConcepts Concepts /// \ingroup PkgSolver /// -/// We /*! \addtogroup PkgSolver \cgalPkgDescriptionBegin{CGAL and Solvers,PkgSolverSummary} -\cgalPkgPicture{solver-detail.png} +\cgalPkgPicture{solver.png} \cgalPkgSummaryBegin \cgalPkgAuthors{CGAL Editorial Board } \cgalPkgDesc{This package provides } @@ -32,10 +31,10 @@ ## Classes ## -- `Eigen_solver_traits` -- `Eigen_svd` -- `Eigen_matrix` -- `Eigen_vector` +- `CGAL::Eigen_solver_traits` +- `CGAL::Eigen_svd` +- `CGAL::Eigen_matrix` +- `CGAL::Eigen_vector` */ diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 2174f3daeca..4f5998554ad 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -5,30 +5,23 @@ namespace CGAL { \anchor Chapter_CGAL_and_Solvers \anchor chapterBGL \cgalAutoToc -\authors NN +\authors %CGAL Editorial Board -The scope of \cgal is geometry and not solving linear systems. Nevertheless, this package -provides the necessary classes and functions that enable using the -algorithms of the +Several \cgal packages have to solve linear systems with dense or sparse matrices. +This package provides concepts and models for that purpose. The models we provide +all use the \ref thirdpartyEigen library. -\section SolverConcepts Solver Concepts + +\section SectionSolverConcepts Solver Concepts -See also the Chapter \ref PkgProperty_mapSummary. -See also Section Visitor Concepts -in the \sc{Bgl} manual. +\section SectionSolverEigen Eigen -\subsection SolverExamplel Example: - -The following example program computes - -\cgalExample{Solver_interface/eigen.cpp} - */ diff --git a/Solver_interface/doc/Solver_interface/dependencies b/Solver_interface/doc/Solver_interface/dependencies index 5d9a51f054b..8dc4d44a8cc 100644 --- a/Solver_interface/doc/Solver_interface/dependencies +++ b/Solver_interface/doc/Solver_interface/dependencies @@ -3,3 +3,4 @@ Kernel_23 STL_Extension Algebraic_foundations Miscellany +Jet_fitting_3 diff --git a/Solver_interface/doc/Solver_interface/examples.txt b/Solver_interface/doc/Solver_interface/examples.txt index a5fef23e60e..e356965d012 100644 --- a/Solver_interface/doc/Solver_interface/examples.txt +++ b/Solver_interface/doc/Solver_interface/examples.txt @@ -1,16 +1,3 @@ /*! -\example BGL_arrangement_2/arr_print.h -\example BGL_arrangement_2/arr_rational_nt.h -\example BGL_arrangement_2/dual.cpp -\example BGL_arrangement_2/primal.cpp -\example BGL_polyhedron_3/cube.off -\example BGL_polyhedron_3/distance.cpp -\example BGL_polyhedron_3/kruskal.cpp -\example BGL_polyhedron_3/kruskal_with_stored_id.cpp -\example BGL_polyhedron_3/normals.cpp -\example BGL_polyhedron_3/incident_vertices.cpp -\example BGL_triangulation_2/dijkstra.cpp -\example BGL_triangulation_2/dijkstra_with_internal_properties.cpp -\example BGL_triangulation_2/emst.cpp -\example BGL_surface_mesh/prim.cpp + */ diff --git a/Solver_interface/doc/Solver_interface/fig/solver.png b/Solver_interface/doc/Solver_interface/fig/solver.png new file mode 100755 index 0000000000000000000000000000000000000000..ea9b0ba8238f2651b235584f23d81db70a12ce1b GIT binary patch literal 909 zcmeAS@N?(olHy`uVBq!ia0vp^6(G#P1|%(0%q{^bmUKs7M+SzC{oH>NS%G}c0*}aI z1_q%L5N5oWCJ)jfQQ{g=5}cn_Ql40p$`Fv4nOCCc=Nh6=W~^syw(|KSRR#uTZci7- zkczmscm1_<5@im2ynkoL6aTPfYdECWAH3$hA)rgM^?Gu$N9UwHjN0DXkqdPM^bZ_s z@+f-l(|^a%_)KAbY;CQ5>8Cl*dy>!noOf8~isqh>)(v$_*Ebm%%xQec!;_w1!F*U! z;@p7(wl-rzLhBy>U)0~%wO`&(OEckJBRxq9_#2{}2x=zAxb{=aVeEk2lg~RRPMmn_dy4&TQG3^V zRfB@jS)W8C(^UBR=xapEArg=^OxhKOz#~0WzWaQ_vpJLAuD Date: Fri, 3 Apr 2015 08:45:16 +0200 Subject: [PATCH 05/61] the version sent as small feature --- .../doc/Solver_interface/CGAL/Eigen_matrix.h | 45 ++- .../doc/Solver_interface/CGAL/Eigen_svd.h | 6 +- .../doc/Solver_interface/CGAL/Eigen_vector.h | 11 +- .../doc/Solver_interface/Concepts/Matrix.h | 354 ------------------ .../Concepts/SparseLinearAlgebraTraits_d.h | 15 +- .../doc/Solver_interface/Concepts/SvdTraits.h | 2 - .../doc/Solver_interface/Concepts/Vector.h | 177 --------- .../Solver_interface/PackageDescription.txt | 4 +- 8 files changed, 49 insertions(+), 565 deletions(-) delete mode 100644 Solver_interface/doc/Solver_interface/Concepts/Matrix.h delete mode 100644 Solver_interface/doc/Solver_interface/Concepts/Vector.h diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h index 0748e5f8b09..98cba67ebad 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h @@ -4,22 +4,16 @@ namespace CGAL { /*! \ingroup PkgSolver -The class `Eigen_sparse_matrix` is a C++ wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix` +The class `Eigen_sparse_matrix` is a wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix` that represents general matrices, be they symmetric or not. -The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. \cgalModels `SparseLinearAlgebraTraits_d::Matrix` -Parameters --------------- - -`T`: Number type. +\tparam T Number type. \sa `CGAL::Eigen_solver_traits` \sa `CGAL::Eigen_sparse_symmetric_matrix` \sa `CGAL::Eigen_vector` -\sa http://eigen.tuxfamily.org - */ template< typename T > class Eigen_sparse_matrix { @@ -43,21 +37,17 @@ namespace CGAL { /*! \ingroup PkgSolver -The class `Eigen_sparse_symmetric_matrix` is a C++ wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix`. +The class `Eigen_sparse_symmetric_matrix` is a wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix` As the matrix is symmetric only the lower triangle part is stored. \cgalModels `SparseLinearAlgebraTraits_d::Matrix` -Parameters --------------- - -`T`: Number type. +\tparam T Number type. \sa `CGAL::Eigen_solver_traits` -\sa `CGAL::Eigen_sparse_symmetric_matrix` +\sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_vector` -\sa http://eigen.tuxfamily.org */ template< typename T > @@ -75,4 +65,29 @@ typedef unspecified_type EigenType; /// @} }; /* end Eigen_sparse_symmetric_matrix */ + + +/*! +\ingroup PkgSolver + +The class `Eigen_matrix` is a wrapper around \ref thirdpartyEigen "Eigen" +matrix type +`Eigen::Matrix`. + + +\cgalModels `SvdTraits::Matrix` + +\tparam T Number type. + +\sa `CGAL::Eigen_svd` +\sa `CGAL::Eigen_vector` + +*/ +template< typename T > +class Eigen_matrix { +public: + +}; + + } /* end namespace CGAL */ diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h index 810308c7874..4bb7061d928 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h @@ -6,7 +6,7 @@ namespace CGAL { The class `Eigen_svd` provides an algorithm to solve in the least square sense a linear system with a singular value decomposition using -\ref thirdpartyEigen. The field type is `double`. +\ref thirdpartyEigen. \cgalModels `SvdTraits` @@ -15,7 +15,11 @@ square sense a linear system with a singular value decomposition using class Eigen_svd { public: + typedef double FT; + typedef Eigen_vector Vector; + + typedef Eigen_matrix Matrix; }; /* end Eigen_svd */ } /* end namespace CGAL */ diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h index 1b220eb1ea6..3ce95292cc4 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h @@ -4,20 +4,19 @@ namespace CGAL { /*! \ingroup PkgSolver -The class `Eigen_vector` is a C++ wrapper around \ref thirdpartyEigen "Eigen" vector, which is a simple array of numbers. -The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. +The class `Eigen_vector` is a wrapper around \ref thirdpartyEigen "Eigen" vector +type , +which is a simple array of numbers. +\cgalModels `SvdTraits::Vector` \cgalModels `SparseLinearAlgebraTraits_d::Vector`. -Parameters --------------- -`T`: Number type. +\tparam T Number type. \sa `CGAL::Eigen_solver_traits` \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` -\sa http://eigen.tuxfamily.org */ template< typename T > diff --git a/Solver_interface/doc/Solver_interface/Concepts/Matrix.h b/Solver_interface/doc/Solver_interface/Concepts/Matrix.h deleted file mode 100644 index c1728429535..00000000000 --- a/Solver_interface/doc/Solver_interface/Concepts/Matrix.h +++ /dev/null @@ -1,354 +0,0 @@ - -/*! -\ingroup PkgKernelDLinAlgConcepts -\cgalConcept - -An instance of data type `Matrix` is a matrix of -variables of number type `NT`. The types `Matrix` and `Vector` -together realize many functions of basic linear algebra. - -*/ - -class Matrix { -public: - -/// \name Types -/// @{ - -/*! -the ring type of the components. -*/ -typedef unspecified_type NT; - -/*! -bidirectional iterator for accessing -all components row-wise. -*/ -typedef unspecified_type iterator; - -/*! -bidirectional iterator for accessing -all components row-wise. -*/ -typedef unspecified_type const_iterator; - - -/*! -random access iterator for accessing row -entries. -*/ -typedef unspecified_type row_iterator; - -/*! -random access iterator for accessing row -entries. -*/ -typedef unspecified_type const_row_iterator; - -/*! -random access iterator for accessing -column entries. -*/ -typedef unspecified_type column_iterator; - -/*! -random access iterator for accessing -column entries. -*/ -typedef unspecified_type const_column_iterator; - -/*! -a tag class for identity initialization -*/ -typedef unspecified_type Identity; - -/*! -the vector type used. -*/ -typedef unspecified_type Vector; - -/// @} - -/// \name Creation -/// @{ - -/*! -creates an instance `M` of type -`Matrix`. -*/ -Matrix(); - -/*! -creates an instance `M` of type -`Matrix` of dimension \f$ n \times n\f$ initialized to the zero matrix. - -*/ -Matrix(int n); - -/*! -creates an instance `M` of -type `Matrix` of dimension \f$ m \times n\f$ initialized to the zero -matrix. -*/ -Matrix(int m, int n); - -/*! -creates an instance -`M` of type `Matrix` of dimension -`p.first`\f$ \times\f$`p.second` initialized to the zero matrix. -*/ -Matrix(std::pair p); - -/*! -creates an -instance `M` of type `Matrix` of dimension \f$ n \times n\f$ -initialized to the identity matrix (times `x`). -*/ -Matrix(int n, Identity, NT x = NT(1)); - -/*! -creates an instance `M` -of type `Matrix` of dimension \f$ m \times n\f$ initialized to the -matrix with `x` entries. -*/ -Matrix(int m, int n, NT x); - -/*! -creates an -instance `M` of type `Matrix`. Let \f$ S\f$ be the ordered set of -\f$ n\f$ column-vectors of common dimension \f$ m\f$ as given by the iterator -range `[first,last)`. `M` is initialized to an \f$ m \times n\f$ -matrix with the columns as specified by \f$ S\f$. - -\pre `Forward_iterator` has a value type `V` from which we require to provide a iterator type `V::const_iterator`, to have `V::value_type == NT`. - -Note that `Vector` or `std::vector` fulfill these requirements. -*/ -template -Matrix(Forward_iterator first, Forward_iterator last); - -/*! -creates an instance -`M` of type `Matrix`. Let \f$ A\f$ be an array of \f$ n\f$ -column-vectors of common dimension \f$ m\f$. `M` is initialized to an -\f$ m \times n\f$ matrix with the columns as specified by \f$ A\f$. -*/ -Matrix(std::vector< Vector > A); - -/// @} - -/// \name Operations -/// @{ - -/*! -returns \f$ n\f$, the number of rows of -`M`. -*/ -int row_dimension() ; - -/*! -returns \f$ m\f$, the number of columns -of `M`. -*/ -int column_dimension() ; - -/*! -returns \f$ (m,n)\f$, the -dimension pair of `M`. -*/ -std::pair dimension() ; - -/*! -returns the \f$ i\f$-th row of `M` (an -\f$ m\f$ - vector). - -\pre \f$ 0 \le i \le m - 1\f$. -*/ -Vector row(int i) ; - -/*! -returns the \f$ i\f$-th column of `M` -(an \f$ n\f$ - vector). - -\pre \f$ 0 \le i \le n - 1\f$. -*/ -Vector column(int i) ; - -/*! -returns \f$ M_{i,j}\f$. -\pre \f$ 0\le i\le m-1\f$ and \f$ 0\le j\le n-1\f$. -*/ -NT& operator()(int i, int j) ; - -/*! -swaps rows \f$ i\f$ and \f$ j\f$. -\pre \f$ 0\le i\le m-1\f$ and \f$ 0\le j\le m-1\f$. - -*/ -void swap_rows(int i, int j) ; - -/*! -swaps columns \f$ i\f$ and -\f$ j\f$. - -\pre \f$ 0\le i\le n-1\f$ and \f$ 0\le j\le n-1\f$. -*/ -void swap_columns(int i, int j) ; - -/*! -an iterator pointing to the -first entry of the \f$ i\f$th row. - -\pre \f$ 0\le i\le m-1\f$. -*/ -row_iterator row_begin(int i) ; - -/*! -an iterator pointing beyond -the last entry of the \f$ i\f$th row. - -\pre \f$ 0\le i\le m-1\f$. -*/ -row_iterator row_end(int i) ; - -/*! -an iterator pointing to the -first entry of the \f$ i\f$th row. - -\pre \f$ 0\le i\le m-1\f$. -*/ -const_row_iterator row_begin(int i) const; - -/*! -an iterator pointing beyond -the last entry of the \f$ i\f$th row. - -\pre \f$ 0\le i\le m-1\f$. -*/ -const_row_iterator row_end(int i) const; - -/*! -an iterator pointing -to the first entry of the \f$ i\f$th column. - -\pre \f$ 0\le i\le n-1\f$. - -*/ -column_iterator column_begin(int i) ; - -/*! -an iterator pointing -beyond the last entry of the \f$ i\f$th column. - -\pre \f$ 0\le i\le n-1\f$. -*/ -column_iterator column_end(int i) ; - -/*! -an iterator pointing -to the first entry of the \f$ i\f$th column. - -\pre \f$ 0\le i\le n-1\f$. - -*/ -const_column_iterator column_begin(int i) const; - -/*! -an iterator pointing -beyond the last entry of the \f$ i\f$th column. - -\pre \f$ 0\le i\le n-1\f$. -*/ -const_column_iterator column_end(int i) const; - - -/*! -an iterator pointing to the first entry -of \f$ M\f$. -*/ -iterator begin(); - -/*! -an iterator pointing beyond the last entry -of \f$ M\f$. -*/ -terator end(); - -/*! -an iterator pointing to the first entry -of \f$ M\f$. -*/ -const_iterator begin() const; - -/*! -an iterator pointing beyond the last entry -of \f$ M\f$. -*/ -const_terator end() const; - - -/*! -Test for equality. -*/ -bool operator==(const Matrix& M1) ; - -/*! -Test for inequality. -*/ -bool operator!=(const Matrix& M1) ; - -/// @} - -/// \name Arithmetic Operators -/// @{ - -/*! -Addition. -\pre `M.row_dimension() == M1.row_dimension()` -\pre `M.column_dimension() == M1.column_dimension()` -*/ -Matrix operator+ (const Matrix& M1); - -/*! - -Subtraction. -\pre `M.row_dimension() == M1.row_dimension()` -\pre `M.column_dimension() == M1.column_dimension()` -*/ -Matrix operator- (const Matrix& M1); - -/*! -Negation. -*/ -Matrix operator-(); - -/*! -Multiplication. - -\pre `M.column_dimension() = M1.row_dimension()` -*/ -Matrix operator*(const Matrix& M1) -; - -/*! -Multiplication with -vector. - -\pre `M.column_dimension() = vec.dimension()` -*/ -Vector operator*(const Vector& vec) ; - -/*! -Multiplication of every entry with `x`. -*/ -Matrix operator*(const NT& x, const Matrix& M); - -/*! -Multiplication of every entry with `x`. -*/ -Matrix operator*(const Matrix& M, const NT& x) ; - -/// @} - -}; /* end Matrix */ - diff --git a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h index 5670f5113ac..d7aee80b141 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h @@ -1,6 +1,7 @@ /*! \ingroup PkgSolverConcepts + \cgalConcept The concept `SparseLinearAlgebraTraits_d` is used to solve sparse linear systems A\f$ \times \f$ X = B. @@ -63,24 +64,22 @@ bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D); /// @} +}; /* end SparseLinearAlgebraTraits_d */ + + /*! -\ingroup PkgSolverConcepts \cgalConcept `SparseLinearAlgebraTraits_d::Vector` is a concept of a vector that can be multiplied by a sparse matrix. -\cgalRefines `LinearAlgebraTraits_d::Vector` - \cgalHasModel `CGAL::Eigen_vector` -\cgalHasModel `OpenNL::FullVector` in `OpenNL` package +\cgalHasModel `OpenNL::FullVector` in the `OpenNL` package \sa `SparseLinearAlgebraTraits_d` \sa `SparseLinearAlgebraTraits_d::Matrix` */ -}; /* end SparseLinearAlgebraTraits_d */ - class SparseLinearAlgebraTraits_d::Vector { public: @@ -142,13 +141,11 @@ NT& operator[](int row); }; /* end Vector */ /*! -\ingroup PkgSolverConcepts + \cgalConcept `SparseLinearAlgebraTraits_d::Matrix` is a concept of a sparse matrix class. -\cgalRefines `LinearAlgebraTraits_d::Matrix` - \cgalHasModel `CGAL::Eigen_sparse_matrix` \cgalHasModel `CGAL::Eigen_sparse_symmetric_matrix` \cgalHasModel `OpenNL::SparseMatrix` in `OpenNL` package diff --git a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h index 639ae5a158d..5271089b975 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h @@ -50,7 +50,6 @@ public: }; /* end SvdTraits */ /*! -\ingroup PkgSolverConcepts \cgalConcept Concept of vector type used by the concept SvdTraits. */ @@ -83,7 +82,6 @@ public: /*! -\ingroup PkgSolverConcepts \cgalConcept Concept of matrix type used by the concept SvdTraits. */ diff --git a/Solver_interface/doc/Solver_interface/Concepts/Vector.h b/Solver_interface/doc/Solver_interface/Concepts/Vector.h deleted file mode 100644 index ed8882ec327..00000000000 --- a/Solver_interface/doc/Solver_interface/Concepts/Vector.h +++ /dev/null @@ -1,177 +0,0 @@ - -/*! -\ingroup PkgKernelDLinAlgConcepts -\cgalConcept - -An instance of data type `Vector` is a vector of variables of -number type `NT`. Together with the type `Matrix` it realizes -the basic operations of linear algebra. - -*/ - -class Vector { -public: - -/// \name Types -/// @{ - -/*! -the ring type of the components. -*/ -typedef unspecified_type NT; - -/*! -the iterator type for accessing components. -*/ -typedef unspecified_type iterator; - -/*! -the const iterator type for accessing -components. -*/ -typedef unspecified_type const_iterator; - -/// @} - -/// \name Creation -/// @{ - -/*! -creates an instance `v` of type -`Vector`. -*/ -Vector(); - -/*! -creates an instance `v` of type -`Vector`. `v` is initialized to a vector of dimension \f$ d\f$. - -*/ -Vector(int d); - -/*! -creates an instance `v` of -type `Vector`. `v` is initialized to a vector of dimension -\f$ d\f$ with entries `x`. -*/ -Vector(int d, NT x); - -/*! -creates an -instance `v` of type `Vector`; `v` is initialized to the -vector with entries `set [first,last)`. -\cgalRequires `Forward_iterator` has value type `NT`. -*/ -template -Vector(Forward_iterator first, Forward_iterator last); - -/// @} - -/// \name Operations -/// @{ - -/*! -returns the dimension of `v`. -*/ -int dimension() ; - -/*! -returns true iff `v` is the zero -vector. -*/ -bool is_zero() ; - -/*! -returns the \f$ i\f$-th component of `v`. - -\pre \f$ 0\le i \le v.dimension()-1\f$. -*/ -NT& operator[](int i) ; - -/*! -iterator to the first component. -*/ -iterator begin() ; - -/*! -iterator beyond the last component. -*/ -iterator end() ; - -/*! -iterator to the first component. -*/ -const_iterator begin() const; - -/*! -iterator beyond the last component. -*/ -const_iterator end() const; - - -/*! -Addition. - -\pre `v.dimension() == v1.dimension()`. -*/ -Vector operator+(const Vector& v1) ; - -/*! -Subtraction. - -\pre `v.dimension() = v1.dimension()`. -*/ -Vector operator-(const Vector& v1) ; - -/*! -Inner Product. - -\pre `v.dimension() = v1.dimension()`. -*/ -NT operator*(const Vector& v1) ; - -/*! -Negation. -*/ -Vector operator-() ; - -/*! -Addition plus assignment. - -\pre `v.dimension() == v1.dimension()`. -*/ -Vector& operator+=(const Vector& v1); - -/*! -Subtraction plus assignment. - -\pre `v.dimension() == v1.dimension()`. -*/ -Vector& operator-=(const Vector& v1); - -/*! -Scalar multiplication plus -assignment. -*/ -Vector& operator*=(const NT& s); - -/*! -Scalar division plus assignment. - -*/ -Vector& operator/=(const NT& s); - -/*! -Component-wise multiplication with number \f$ r\f$. -*/ -Vector operator*(const NT& r, const Vector& v); - -/*! -Component-wise multiplication with number \f$ r\f$. -*/ -Vector operator*(const Vector& v, const NT& r); - -/// @} - -}; /* end Vector */ - diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index b59e1ad476c..31880f73a87 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -11,7 +11,7 @@ \cgalPkgPicture{solver.png} \cgalPkgSummaryBegin \cgalPkgAuthors{CGAL Editorial Board } -\cgalPkgDesc{This package provides } +\cgalPkgDesc{This package provides concepts and models for solving linear systems with dense or sparse matrices.} \cgalPkgManuals{Chapter_CGAL_and_Solvers,PkgSolver} \cgalPkgSummaryEnd \cgalPkgShortInfoBegin @@ -35,6 +35,8 @@ - `CGAL::Eigen_svd` - `CGAL::Eigen_matrix` - `CGAL::Eigen_vector` +- `CGAL::Eigen_sparse_matrix` +- `CGAL::Eigen_sparse_symmetric_matrix` */ From 8ae42933c7b69d2d626d70d42976df6198266c12 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 13 Apr 2015 16:37:40 +0200 Subject: [PATCH 06/61] Do not explain OpenNL and say that LSCM has no parameter for a solver --- .../CGAL/Eigen_solver_traits.h | 19 --- .../SparseLinearAlgebraTraitsWithFactor_d.h | 10 +- .../Concepts/SparseLinearAlgebraTraits_d.h | 4 - .../doc/Solver_interface/Solver_interface.txt | 27 +++- .../include/CGAL/Eigen_solver_traits.h | 2 + .../PackageDescription.txt | 24 +-- .../Surface_mesh_parameterization.txt | 152 +----------------- .../dependencies | 1 + .../Authalic_parameterization.cpp | 3 +- .../CMakeLists.txt | 17 +- .../Complete_parameterization_example.cpp | 6 +- .../Mesh_cutting_parameterization.cpp | 1 - .../Simple_parameterization.cpp | 3 +- .../Square_border_parameterization.cpp | 1 - .../Barycentric_mapping_parameterizer_3.h | 5 +- .../CGAL/Discrete_authalic_parameterizer_3.h | 5 +- .../Discrete_conformal_map_parameterizer_3.h | 5 +- .../CGAL/Fixed_border_parameterizer_3.h | 7 +- .../include/CGAL/LSCM_parameterizer_3.h | 25 +-- .../Mean_value_coordinates_parameterizer_3.h | 6 +- 20 files changed, 82 insertions(+), 241 deletions(-) diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h index c5850c93336..10a82acd965 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h @@ -17,25 +17,6 @@ The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available o \sa `CGAL::Eigen_sparse_symmetric_matrix` \sa `CGAL::Eigen_vector` -Example --------------- - -The instantiation of this class assumes an \ref thirdpartyEigen "Eigen" sparse solver is provided. Here are few examples: - -\code{.cpp} - -typedef CGAL::Eigen_sparse_matrix::EigenType EigenMatrix; - -//iterative general solver -typedef CGAL::Eigen_solver_traits< Eigen::BiCGSTAB > Iterative_general_solver; - -//iterative symmetric solver -typedef CGAL::Eigen_solver_traits< Eigen::ConjugateGradient > Iterative_symmetric_solver; - -//direct symmetric solver -typedef CGAL::Eigen_solver_traits< Eigen::SimplicialCholesky > Direct_symmetric_solver; - -\endcode */ template< typename T > diff --git a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h index dfaf510ebae..1da0282a169 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraitsWithFactor_d.h @@ -31,16 +31,16 @@ SparseLinearAlgebraTraitsWithFactor_d(); /// @{ /*! -Factorize the sparse matrix A. -This factorization is used in SparseLinearAlgebraTraitsWithFactor_d::linear_solver to solve the system for different right-hand side vectors. + Factorize the sparse matrix `A`. +This factorization is used in `SparseLinearAlgebraTraitsWithFactor_d::linear_solver()` to solve the system for different right-hand side vectors. See `::SparseLinearAlgebraTraits_d::linear_solver()` for the description of `D`. -@return true if the factorization is successful +@return `true` if the factorization is successful */ bool factor(const Matrix& A, NT& D); /*! -Solve the sparse linear system \f$ A \times X = B\f$, with \f$ A \f$ being the matrix provided in SparseLinearAlgebraTraitsWithFactor_d::factor. -@return true if the solver is successful +Solve the sparse linear system \f$ A \times X = B\f$, with \f$ A \f$ being the matrix provided in `SparseLinearAlgebraTraitsWithFactor_d::factor()`. +@return `true` if the solver is successful */ bool linear_solver(const Vector& B, Vector& X); diff --git a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h index d7aee80b141..b6fc4e8c57d 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h @@ -8,8 +8,6 @@ The concept `SparseLinearAlgebraTraits_d` is used to solve sparse linear systems \cgalHasModel `CGAL::Eigen_solver_traits` -\cgalHasModel `OpenNL::DefaultLinearSolverTraits` in OpenNL package -\cgalHasModel `OpenNL::SymmetricLinearSolverTraits` in OpenNL package */ @@ -73,7 +71,6 @@ bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D); `SparseLinearAlgebraTraits_d::Vector` is a concept of a vector that can be multiplied by a sparse matrix. \cgalHasModel `CGAL::Eigen_vector` -\cgalHasModel `OpenNL::FullVector` in the `OpenNL` package \sa `SparseLinearAlgebraTraits_d` \sa `SparseLinearAlgebraTraits_d::Matrix` @@ -148,7 +145,6 @@ NT& operator[](int row); \cgalHasModel `CGAL::Eigen_sparse_matrix` \cgalHasModel `CGAL::Eigen_sparse_symmetric_matrix` -\cgalHasModel `OpenNL::SparseMatrix` in `OpenNL` package \sa `SparseLinearAlgebraTraits_d` \sa `SparseLinearAlgebraTraits_d::Vector` diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 4f5998554ad..d49d4361688 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -15,12 +15,31 @@ all use the \ref thirdpartyEigen library. -\section SectionSolverConcepts Solver Concepts - - - \section SectionSolverEigen Eigen +An interface to all sparse solvers from the \ref thirdpartyEigen +library is provided through the class +`Eigen_solver_traits`. This solver traits class can be used for an +iterative or a direct, symmetric or general sparse solvers. The +specific solver to be used must be given as template +parameter. + +Here are few examples: + +\code{.cpp} + +typedef CGAL::Eigen_sparse_matrix::EigenType EigenMatrix; + +//iterative general solver +typedef CGAL::Eigen_solver_traits< Eigen::BiCGSTAB > Iterative_general_solver; + +//iterative symmetric solver +typedef CGAL::Eigen_solver_traits< Eigen::ConjugateGradient > Iterative_symmetric_solver; + +//direct symmetric solver +typedef CGAL::Eigen_solver_traits< Eigen::SimplicialCholesky > Direct_symmetric_solver; + +\endcode diff --git a/Solver_interface/include/CGAL/Eigen_solver_traits.h b/Solver_interface/include/CGAL/Eigen_solver_traits.h index 569fad546d3..27d77321d9e 100644 --- a/Solver_interface/include/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/include/CGAL/Eigen_solver_traits.h @@ -79,6 +79,7 @@ class Eigen_solver_traits typedef typename EigenSolverT::Scalar Scalar; // Public types public: + typedef EigenSolverT Solver; typedef Scalar NT; typedef typename internal::Get_eigen_matrix::type Matrix; typedef Eigen_vector Vector; @@ -143,6 +144,7 @@ class Eigen_solver_traits< Eigen::BiCGSTAB::EigenTyp typedef EigenSolverT::Scalar Scalar; // Public types public: + typedef EigenSolverT Solver; typedef Scalar NT; typedef internal::Get_eigen_matrix::type Matrix; typedef Eigen_vector Vector; diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt index 9d2af5f10a9..f3818718c66 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt @@ -54,7 +54,7 @@ This \cgal package implements several parameterization methods: - `CGAL::Barycentric_mapping_parameterizer_3` - `CGAL::Discrete_authalic_parameterizer_3` - `CGAL::Discrete_conformal_map_parameterizer_3` -- `CGAL::LSCM_parameterizer_3` +- `CGAL::LSCM_parameterizer_3` - `CGAL::Mean_value_coordinates_parameterizer_3` ## Border Parameterization Methods ## @@ -121,16 +121,6 @@ The package provides an interface with `CGAL::Polyhedron_3`: A `(u,v)` pair is computed for each inner vertex (i.e.\ its halfedges share the same `(u,v)` pair), while a `(u,v)` pair is computed for each border halfedge. The user must iterate over the mesh halfedges to get the result. -## Sparse Linear Algebra ## - -Since parameterizing meshes requires -efficient representation of sparse matrices and efficient iterative or -direct linear solvers, we provide an interface to several -sparse linear solvers: - - Eigen 3.1 (or greater) is the library recommended by %CGAL solving sparse systems. - - OpenNL (authored by Bruno Lévy) is shipped with %CGAL is the default solver. - - `OpenNL::DefaultLinearSolverTraits` in OpenNL package - - `OpenNL::SymmetricLinearSolverTraits` in OpenNL package ## Helper Classes ## @@ -249,18 +239,6 @@ The package provides an interface with `CGAL::Polyhedron_3`: -/*! \defgroup PkgSurfaceParameterizationAlgebra Sparse Linear Algebra - \ingroup PkgSurfaceParameterization - -Since parameterizing meshes requires -efficient representation of sparse matrices and efficient iterative or -direct linear solvers, we provide an interface to several -sparse linear solvers: - - Eigen 3.1 (or greater) is the library recommended by %CGAL solving sparse systems. - - OpenNL (authored by Bruno Lévy) is shipped with %CGAL is the default solver. - - `OpenNL::DefaultLinearSolverTraits` in OpenNL package - - `OpenNL::SymmetricLinearSolverTraits` in OpenNL package -*/ /*! \defgroup PkgSurfaceParameterizationHelper Helper Class diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt index c431ce598a6..86e3d101201 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt @@ -40,9 +40,8 @@ data structure. Since parameterizing meshes require efficient representation of sparse matrices and efficient iterative or direct linear solvers, we provide -a unified interface to a linear solver library (\ref thirdpartyEigen "Eigen"), -and propose a separate package devoted to OpenNL sparse -linear solver. +a unified interface to linear solvers as described in Chapter +\ref PkgSolverSummary. Note that linear solvers commonly use double precision floating point numbers. Therefore, this package is intended to be used with a \cgal %Cartesian kernel with doubles. @@ -69,8 +68,8 @@ Parameterizer_traits_3::Error_code parameterize (Paramet The function `parameterize()` applies a default surface parameterization method, namely Floater Mean Value Coordinates \cgalCite{cgal:f-mvc-03}, with an -arc-length circular border parameterization, and using OpenNL sparse -linear solver \cgalCite{cgal:l-nmdgp-05}. The `ParameterizationMesh_3` concept defines the input meshes handled by `parameterize()`. See Section \ref secInputMeshforparameterize. The result is stored into the `(u,v)` fields of the mesh halfedges. +arc-length circular border parameterization, and using a sparse +linear solver from the \thirdpartyEigen library. The `ParameterizationMesh_3` concept defines the input meshes handled by `parameterize()`. See Section \ref secInputMeshforparameterize. The result is stored into the `(u,v)` fields of the mesh halfedges. The mesh must be a triangle mesh surface with one connected component. Note: `Parameterizer_traits_3` is the (pure virtual) superclass of all surface parameterizations and defines the error codes. @@ -155,7 +154,7 @@ and \ref secBorderParameterizationsforFreeMethods. \subsection Surface_mesh_parameterizationTheSparseLinearAlgebraTraitsd The SparseLinearAlgebraTraits_d Concept This package solves sparse linear systems using solvers which are models -of `SparseLinearAlgebraTraits_d`. See Section \ref secSparseLinearAlgebra. +of `SparseLinearAlgebraTraits_d`. See Chapter \ref PkgSolverSummary. \subsection Surface_mesh_parameterizationTheParameterizationMesh3 The ParameterizationMesh_3 and ParameterizationPatchableMesh_3 Concepts @@ -419,65 +418,7 @@ Parameterizer::Error_code err = CGAL::parameterize(mesh_adaptor, Parameterizer() \endcode -\section secSparseLinearAlgebra Sparse Linear Algebra -Parameterizing triangle meshes requires both efficient representation -of sparse matrices and efficient iterative or direct linear -solvers. We provide links to \ref thirdpartyEigen "Eigen" library -and include a separate package devoted to OpenNL sparse linear solver. - -\subsection Surface_mesh_parameterizationListofSolvers List of Solvers - -We provide an interface to several sparse linear solvers, as models -of the `SparseLinearAlgebraTraits_d` concept: - -- An interface to sparse solvers from the `OpenNL` library \cgalCite{cgal:l-nmdgp-05} is provided through classes -`OpenNL::DefaultLinearSolverTraits` and -`OpenNL::SymmetricLinearSolverTraits`. The OpenNL library version shipped with \cgal is a lightweight default sparse linear solver. It does not support large systems, but it is portable and -supports exact number types. - -- An interface to all sparse solvers from the \ref thirdpartyEigen "Eigen" library is provided through the class -`Eigen_solver_traits`. This solver traits class can be used for an iterative or a direct, -symmetric or general sparse solvers. The \ref thirdpartyEigen "Eigen" solver to be used must be given as template parameter. - -\subsection Surface_mesh_parameterizationEigenSolver Eigen Solver Example - -The example \ref Surface_mesh_parameterization/Eigen_parameterization.cpp "Eigen_parameterization.cpp" computes the -default parameterization method (Floater mean value coordinates with a circular border), -but specifically instantiates an \ref thirdpartyEigen "Eigen" solver. Specifying a specific solver -instead of the default one (OpenNL) means using the third parameter of -`Mean_value_coordinates_parameterizer_3`. The differences with the first -example \ref Surface_mesh_parameterization/Simple_parameterization.cpp "Simple_parameterization.cpp" are: - -\code{.cpp} - -#include - -... - -//*************************************** -// Floater Mean Value Coordinates parameterization -// (circular border) with Eigen solver -//*************************************** - -// Circular border parameterizer (the default) -typedef CGAL::Circular_border_arc_length_parameterizer_3 -Border_parameterizer; -// Eigen solver -typedef CGAL::Eigen_solver_traits<> Solver; - -// Floater Mean Value Coordinates parameterization -// (circular border) with Eigen solver -typedef CGAL::Mean_value_coordinates_parameterizer_3 -Parameterizer; - -Parameterizer::Error_code err = CGAL::parameterize(mesh_adaptor, Parameterizer()); - -... - -\endcode \section secCuttingaMesh Cutting a Mesh @@ -605,63 +546,7 @@ and is therefore non-singular (Gram theorem). -\subsection Surface_mesh_parameterizationPrecision Precision -Two algorithms of this package construct the sparse linear system(s) -using trigonometric functions, and are this incompatible with exact arithmetic: - -

- -On the other hand, linear solvers commonly use double precision floating point -numbers. - -OpenNL's BICGSTAB solver (accessible through the -`OpenNL::DefaultLinearSolverTraits` interface) -is the only solver supported by this package which -computes exact results, when used with an exact arithmetic. This package is -intended to be used mainly with a \cgal %Cartesian kernel with doubles. - -\subsection Surface_mesh_parameterizationOpenNLsBICGSTAB OpenNL's BICGSTAB Solver with an Exact Arithmetic - -The BICGSTAB conjugate gradient is in disguise a direct solver. -In a nutshell, it computes a vector basis -orthogonal with respect to the matrix, and the coordinates of the solution in this vector basis. -Each iteration computes one component of the basis and one coordinate, therefore the algorithm -converges to the solution in \f$ n\f$ iterations, where \f$ n\f$ is the dimension of the matrix. More precisely, it is shown to converge in \f$ k\f$ iteration, where \f$ k\f$ is the number of distinct eigenvalues of the matrix. - -\subsection Surface_mesh_parameterizationSolverswith Solvers with a Floating Point Arithmetic - -OpenNL's BICGSTAB example: - -When inexact numerical types are used (e.g. doubles), accumulated errors slow down convergence -(in practice, it requires approximately \f$ 5k\f$ iterations to converge). -The required number of iterations depends on the eigenvalues of the matrix, and these eigenvalues depend -on the shape of the triangles. The optimum is when the triangles are equilateral (then the solver converges -in less than 10 iterations). The worst case is obtained when the mesh has a large number of skinny triangles (near-singular Jacobian matrix of the triangle). In this case, the spectrum of the matrix -is wide (many different eigenvalues), and the solver requires nearly \f$ 5n\f$ iterations to converge. - -\subsection Surface_mesh_parameterizationAlgorithmic Algorithmic Complexity - -In this package, we focus on piecewise linear mappings onto a planar -domain. All surface parameterization methods are based on solving one (or two) -sparse linear system(s). -The algorithmic complexity is dominated by the resolution of the sparse linear system(s). - -OpenNL's BICGSTAB example: - -At each iteration, the operation of highest complexity is the product between the sparse-matrix and a vector. -The sparse matrix has a fixed number of non-zero coefficients per row, -therefore the matrix / vector product has \f$ O(n)\f$ complexity. -Since convergence is reached after \f$ k\f$ iterations, the complexity is \f$ O(k.n)\f$ -(where \f$ k\f$ is the number of distinct eigenvalues of the matrix). -Therefore, best case complexity is \f$ O(n)\f$ (equilateral triangles), -and worst case complexity is \f$ O(n^2)\f$ (skinny triangles). \section Surface_mesh_parameterizationSoftware Software Design @@ -801,7 +686,7 @@ The purpose of such a model is to:
  • Support several kind of meshes.
  • Hide the implementation of extra fields specific to the parameterization domain (`index`, `u`, `v`, `is_parameterized`). -
  • Handle in the mesh type the complexity of virtually cutting a mesh +
  • %Handle in the mesh type the complexity of virtually cutting a mesh to make it homeomorphic to a disk (instead of duplicating this code in each parameterization method). @@ -834,15 +719,6 @@ This mainly means that: can be set per corner (which is a more general way of saying per half-edge). -\subsection Surface_mesh_parameterizationSparseLinearAlgebraTraitsd SparseLinearAlgebraTraits_d Concept - -This package solves sparse linear systems using solvers which are models -of `SparseLinearAlgebraTraits_d`. - -`SparseLinearAlgebraTraits_d` is a sub-concept of the `LinearAlgebraTraits_d` concept -in `Kernel_d`. -The goal is to adapt easily code written for dense matrices to sparse ones, -and vice-versa. \subsection Surface_mesh_parameterizationCuttingaMesh_1 Cutting a Mesh @@ -855,23 +731,7 @@ not intend to cover this topic at the moment. \section Surface_mesh_parameterizationExtendingthe Extending the Package and Reusing Code -\subsection Surface_mesh_parameterizationReusingMesh Reusing Mesh Adaptors -`ParameterizationMesh_3` defines a concept to access to a -general polyhedral mesh. -It is optimized for the `Surface_mesh_parameterization` package -only in the sense that it -defines the accessors to fields specific to the parameterization domain -(`index`, `u`, `v`, `is_parameterized`). - -It may be easily generalized. - -\subsection Surface_mesh_parameterizationReusingSparse Reusing Sparse Linear Algebra - -The `SparseLinearAlgebraTraits_d` concept and the traits classes -for \ref thirdpartyEigen "Eigen" and OpenNL are independent of the rest of the -`Surface_mesh_parameterization` package, and may be reused by -\cgal developers for other purposes. \subsection Surface_mesh_parameterizationAddingNewParameterization Adding New Parameterization Methods diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/dependencies b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/dependencies index bf0d8576788..96055a7fb4b 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/dependencies +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/dependencies @@ -7,3 +7,4 @@ Stream_support Polyhedron Kernel_d Solver_interface +Convex_hull_2 diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Authalic_parameterization.cpp b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Authalic_parameterization.cpp index 6665e621f15..1b89de29246 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Authalic_parameterization.cpp +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Authalic_parameterization.cpp @@ -27,7 +27,6 @@ int main(int argc, char * argv[]) std::cerr << "PARAMETERIZATION" << std::endl; std::cerr << " Discrete Authalic Parameterization" << std::endl; std::cerr << " circle border" << std::endl; - std::cerr << " OpenNL solver" << std::endl; //*************************************** // decode parameters @@ -68,7 +67,7 @@ int main(int argc, char * argv[]) //*************************************** // Discrete Authalic Parameterization - // (defaults are circular border and OpenNL solver) + // (defaults are circular border and Eigen solver) //*************************************** typedef CGAL::Discrete_authalic_parameterizer_3 diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt index 2130b342647..144152e05c6 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt @@ -66,25 +66,26 @@ if ( CGAL_FOUND ) list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_PROGRAM_OPTIONS_LIBRARY}) endif() - # Executables that do *not* require Eigen + + find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) + + if (EIGEN3_FOUND) + # Executables that require Eigen 3.1 + include( ${EIGEN3_USE_FILE} ) create_single_source_cgal_program( "Authalic_parameterization.cpp" ) create_single_source_cgal_program( "Mesh_cutting_parameterization.cpp" ) create_single_source_cgal_program( "Simple_parameterization.cpp" ) create_single_source_cgal_program( "Square_border_parameterization.cpp" ) - find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) - - if (EIGEN3_FOUND) - # Executables that require Eigen 3.1 - include( ${EIGEN3_USE_FILE} ) create_single_source_cgal_program( "Complete_parameterization_example.cpp" ) create_single_source_cgal_program( "Eigen_parameterization.cpp" ) + + create_single_source_cgal_program( "polyhedron_ex_parameterization.cpp" ) + else(EIGEN3_FOUND) message(STATUS "NOTICE: Some examples require Eigen 3.1 (or greater) and will not be compiled.") endif(EIGEN3_FOUND) - create_single_source_cgal_program( "polyhedron_ex_parameterization.cpp" ) - else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Complete_parameterization_example.cpp b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Complete_parameterization_example.cpp index e0d23c9b9aa..c0786005d2e 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Complete_parameterization_example.cpp +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Complete_parameterization_example.cpp @@ -248,14 +248,10 @@ int main(int argc, char * argv[]) // Border parameterizer typedef CGAL::Square_border_arc_length_parameterizer_3 Border_parameterizer; - // Eigen solver - typedef CGAL::Eigen_solver_traits<> Solver; - // Discrete Authalic Parameterization (square border) // with Eigen solver typedef CGAL::Discrete_authalic_parameterizer_3 Parameterizer; + Border_parameterizer> Parameterizer; Parameterizer::Error_code err = CGAL::parameterize(mesh_patch, Parameterizer()); switch(err) { diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp index 413ecb4eaf0..d012ca50755 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp @@ -93,7 +93,6 @@ int main(int argc, char * argv[]) std::cerr << "PARAMETERIZATION" << std::endl; std::cerr << " Floater parameterization" << std::endl; std::cerr << " Circle border" << std::endl; - std::cerr << " OpenNL solver" << std::endl; std::cerr << " Very simple cut if model is not a topological disk" << std::endl; //*************************************** diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Simple_parameterization.cpp b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Simple_parameterization.cpp index 490a3761e26..68a076f5770 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Simple_parameterization.cpp +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Simple_parameterization.cpp @@ -25,7 +25,6 @@ int main(int argc, char * argv[]) std::cerr << "PARAMETERIZATION" << std::endl; std::cerr << " Floater parameterization" << std::endl; std::cerr << " Circle border" << std::endl; - std::cerr << " OpenNL solver" << std::endl; //*************************************** // decode parameters @@ -66,7 +65,7 @@ int main(int argc, char * argv[]) //*************************************** // Floater Mean Value Coordinates parameterization - // (defaults are circular border and OpenNL solver) + // (defaults are circular border and Eigen solver) //*************************************** typedef CGAL::Parameterizer_traits_3 diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Square_border_parameterization.cpp b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Square_border_parameterization.cpp index e6c5335d124..426d9a9dc55 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Square_border_parameterization.cpp +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Square_border_parameterization.cpp @@ -26,7 +26,6 @@ int main(int argc, char * argv[]) std::cerr << "PARAMETERIZATION" << std::endl; std::cerr << " Floater parameterization" << std::endl; std::cerr << " square border" << std::endl; - std::cerr << " OpenNL solver" << std::endl; //*************************************** // decode parameters diff --git a/Surface_mesh_parameterization/include/CGAL/Barycentric_mapping_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Barycentric_mapping_parameterizer_3.h index f9b4186010a..2ba0d2aac74 100644 --- a/Surface_mesh_parameterization/include/CGAL/Barycentric_mapping_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Barycentric_mapping_parameterizer_3.h @@ -24,6 +24,7 @@ #include #include +#include /// \file Barycentric_mapping_parameterizer_3.h @@ -58,7 +59,7 @@ namespace CGAL { \sa `CGAL::Fixed_border_parameterizer_3` \sa `CGAL::Discrete_authalic_parameterizer_3` \sa `CGAL::Discrete_conformal_map_parameterizer_3` -\sa `CGAL::LSCM_parameterizer_3` +\sa `CGAL::LSCM_parameterizer_3` \sa `CGAL::Mean_value_coordinates_parameterizer_3` */ @@ -68,7 +69,7 @@ template class BorderParameterizer_3 = Circular_border_arc_length_parameterizer_3, class SparseLinearAlgebraTraits_d - = OpenNL::DefaultLinearSolverTraits + = Eigen_solver_traits::EigenType, Eigen::IncompleteLUT< double > > > > class Barycentric_mapping_parameterizer_3 : public Fixed_border_parameterizer_3 #include +#include /// \file Discrete_authalic_parameterizer_3.h @@ -55,7 +56,7 @@ namespace CGAL { /// \sa `CGAL::Fixed_border_parameterizer_3` /// \sa `CGAL::Barycentric_mapping_parameterizer_3` /// \sa `CGAL::Discrete_conformal_map_parameterizer_3` -/// \sa `CGAL::LSCM_parameterizer_3` +/// \sa `CGAL::LSCM_parameterizer_3` /// \sa `CGAL::Mean_value_coordinates_parameterizer_3` template @@ -64,7 +65,7 @@ template class BorderParameterizer_3 ///< Strategy to parameterize the surface border = Circular_border_arc_length_parameterizer_3, class SparseLinearAlgebraTraits_d ///< Traits class to solve a sparse linear system - = OpenNL::DefaultLinearSolverTraits + = Eigen_solver_traits::EigenType, Eigen::IncompleteLUT< double > > > > class Discrete_authalic_parameterizer_3 : public Fixed_border_parameterizer_3 #include +#include /// \file Discrete_conformal_map_parameterizer_3.h @@ -61,7 +62,7 @@ namespace CGAL { /// \sa `CGAL::Fixed_border_parameterizer_3` /// \sa `CGAL::Barycentric_mapping_parameterizer_3` /// \sa `CGAL::Discrete_authalic_parameterizer_3` -/// \sa `CGAL::LSCM_parameterizer_3` +/// \sa `CGAL::LSCM_parameterizer_3` /// \sa `CGAL::Mean_value_coordinates_parameterizer_3` template @@ -70,7 +71,7 @@ template class BorderParameterizer_3 = Circular_border_arc_length_parameterizer_3, class SparseLinearAlgebraTraits_d - = OpenNL::DefaultLinearSolverTraits + = Eigen_solver_traits::EigenType, Eigen::IncompleteLUT< double > > > > class Discrete_conformal_map_parameterizer_3 : public Fixed_border_parameterizer_3 #include -#include +#include + #include #include @@ -80,8 +81,8 @@ template class BorderParameterizer_3 ///< Strategy to parameterize the surface border = Circular_border_arc_length_parameterizer_3, class SparseLinearAlgebraTraits_d ///< Traits class to solve a sparse linear system - = OpenNL::DefaultLinearSolverTraits -> + = Eigen_solver_traits::EigenType, Eigen::IncompleteLUT< double > > > > + class Fixed_border_parameterizer_3 : public Parameterizer_traits_3 { diff --git a/Surface_mesh_parameterization/include/CGAL/LSCM_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/LSCM_parameterizer_3.h index ef820d9b813..47def05f44c 100644 --- a/Surface_mesh_parameterization/include/CGAL/LSCM_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/LSCM_parameterizer_3.h @@ -43,15 +43,17 @@ namespace CGAL { /// \ingroup PkgSurfaceParameterizationMethods /// -/// The class LSCM_parameterizer_3 implements the +/// The class `LSCM_parameterizer_3` implements the /// *Least Squares Conformal Maps (LSCM)* parameterization \cgalCite{cgal:lprm-lscm-02}. /// /// This is a conformal parameterization, i.e. it attempts to preserve angles. /// -/// This is a free border parameterization. No need to map the surface's border +/// This is a free border parameterization. No need to map the border of the surface /// onto a convex polygon (only two pinned vertices are needed to ensure a /// unique solution), but one-to-one mapping is *not* guaranteed. /// +/// Note that his parametrization method has no template parameter for changing the sparse solver. +/// /// \cgalModels `ParameterizerTraits_3` /// /// @@ -66,14 +68,17 @@ template < class ParameterizationMesh_3, ///< 3D surface mesh. class BorderParameterizer_3 - = Two_vertices_parameterizer_3, + = Two_vertices_parameterizer_3 +#ifndef DOXYGEN_RUNNING + , ///< Strategy to parameterize the surface border. ///< The minimum is to parameterize two vertices. - class SparseLinearAlgebraTraits_d + class SparseLinearAlgebraTraits_d = OpenNL::SymmetricLinearSolverTraits - ///< Traits class to solve a sparse linear system. - ///< We may use a symmetric definite positive solver because LSCM - ///< solves the system in the least squares sense. + //< Traits class to solve a sparse linear system. + //< We may use a symmetric definite positive solver because LSCM + //< solves the system in the least squares sense. +#endif > class LSCM_parameterizer_3 : public Parameterizer_traits_3 @@ -94,11 +99,11 @@ public: /// Export BorderParameterizer_3 template parameter. typedef BorderParameterizer_3 Border_param; - /// Export SparseLinearAlgebraTraits_d template parameter. + +// Private types +private: typedef SparseLinearAlgebraTraits_d Sparse_LA; -// Private types -private: // Mesh_Adaptor_3 subtypes: typedef typename Adaptor::NT NT; typedef typename Adaptor::Point_2 Point_2; diff --git a/Surface_mesh_parameterization/include/CGAL/Mean_value_coordinates_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Mean_value_coordinates_parameterizer_3.h index bbb8246fb81..c9826a07b7c 100644 --- a/Surface_mesh_parameterization/include/CGAL/Mean_value_coordinates_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Mean_value_coordinates_parameterizer_3.h @@ -24,6 +24,7 @@ #include #include +#include /// \file Mean_value_coordinates_parameterizer_3.h @@ -56,7 +57,7 @@ namespace CGAL { /// \sa `CGAL::Barycentric_mapping_parameterizer_3` /// \sa `CGAL::Discrete_authalic_parameterizer_3` /// \sa `CGAL::Discrete_conformal_map_parameterizer_3` -/// \sa `CGAL::LSCM_parameterizer_3` +/// \sa `CGAL::LSCM_parameterizer_3` template < @@ -64,8 +65,9 @@ template class BorderParameterizer_3 ///< Strategy to parameterize the surface border = Circular_border_arc_length_parameterizer_3, class SparseLinearAlgebraTraits_d ///< Traits class to solve a sparse linear system - = OpenNL::DefaultLinearSolverTraits + = Eigen_solver_traits::EigenType, Eigen::IncompleteLUT< double > > > > + class Mean_value_coordinates_parameterizer_3 : public Fixed_border_parameterizer_3 Date: Tue, 14 Apr 2015 11:21:16 +0200 Subject: [PATCH 07/61] change several package descriptions --- .../doc/Jet_fitting_3/PackageDescription.txt | 2 +- .../PackageDescription.txt | 2 +- Ridges_3/doc/Ridges_3/PackageDescription.txt | 2 +- .../CGAL/Eigen_solver_traits.h | 4 ++-- .../doc/Solver_interface/Concepts/SvdTraits.h | 18 +++++++++++------- .../doc/Solver_interface/Solver_interface.txt | 7 ++++++- .../include/CGAL/Eigen_solver_traits.h | 4 ++-- .../PackageDescription.txt | 2 +- 8 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt b/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt index cb916cc1583..18ab3348455 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt +++ b/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt @@ -13,7 +13,7 @@ \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{3.3} -\cgalPkgDependsOn{Solvers from \ref thirdpartyEigen.} +\cgalPkgDependsOn{\ref PkgSolverSummary} \cgalPkgBib{cgal:pc-eldp} \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{Operations on Polyhedra,polyhedron_3.zip} diff --git a/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt b/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt index a3e26632398..505a3a13344 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt @@ -11,7 +11,7 @@ \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{3.5} -\cgalPkgDependsOn{\ref thirdpartyEigen "Eigen"} +\cgalPkgDependsOn{\ref PkgSolverSummary} \cgalPkgBib{cgal:ass-psp} \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{See Polyhedral Surface,polyhedron_3.zip} diff --git a/Ridges_3/doc/Ridges_3/PackageDescription.txt b/Ridges_3/doc/Ridges_3/PackageDescription.txt index a2f119dfc74..dbf4b7e03e2 100644 --- a/Ridges_3/doc/Ridges_3/PackageDescription.txt +++ b/Ridges_3/doc/Ridges_3/PackageDescription.txt @@ -18,7 +18,7 @@ \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{3.3} -\cgalPkgDependsOn{Solvers from \ref thirdpartyEigen.} +\cgalPkgDependsOn{\ref PkgSolverSummary} \cgalPkgBib{cgal:cp-arutsm} \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgShortInfoEnd diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h index 10a82acd965..9bd853c190b 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h @@ -11,7 +11,7 @@ The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available o \tparam T a sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver -`Eigen::BiCGSTAB` for `double`. +`Eigen::BiCGSTAB` for `double`. \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` @@ -37,7 +37,7 @@ typedef typename T::Scalar NT; typedef CGAL::Eigen_vector Vector; /*! -If `T` is `Eigen::ConjugateGradient` or `Eigen::SimplicialCholesky`, `Matrix` is `CGAL::Eigen_sparse_symmetric_matrix` +If `T` is `Eigen::ConjugateGradient` or `Eigen::SimplicialCholesky`, `Matrix` is `CGAL::Eigen_sparse_symmetric_matrix` and `CGAL::Eigen_sparse_matrix` otherwise. */ diff --git a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h index 5271089b975..630a682051e 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h @@ -51,7 +51,9 @@ public: /*! \cgalConcept -Concept of vector type used by the concept SvdTraits. +Concept of vector type used by the concept `SvdTraits`. + +\cgalHasModel `CGAL::Eigen_vector` */ class SvdTraits::Vector { public: @@ -65,12 +67,12 @@ public: size_t size(); /*! - return the \f$ i^{th}\f$ entry, \f$ i\f$ from \f$ 0\f$ to \f$ size()-1\f$. + return the `i`th entry, `i` from `0` to `size()-1`. */ FT operator()(size_t i); /*! - set the \f$ i^{th}\f$ entry to `value`. + set the `i`'th entry to `value`. */ void set(size_t i, const FT value); @@ -83,7 +85,9 @@ public: /*! \cgalConcept -Concept of matrix type used by the concept SvdTraits. +Concept of matrix type used by the concept `SvdTraits`. + +\cgalHasModel `CGAL::Eigen_matrix` */ class SvdTraits::Matrix { public: @@ -103,13 +107,13 @@ public: size_t number_of_columns(); /*! - return the entry at row \f$ i\f$ and column \f$ j\f$, \f$ i\f$ from \f$ 0\f$ to `number_of_rows - 1`, - \f$ j\f$ from \f$ 0\f$ to `number_of_columns - 1`. + return the entry at row `i` and column `j`, `i` from `0` to `number_of_rows - 1`, + `j` from `0` to `number_of_columns - 1`. */ FT operator()(size_t i, size_t j); /*! - set the entry at row \f$ i\f$ and column \f$ j\f$ to \f$ value\f$. + set the entry at row `i` and column `j` to `value`. */ void set(size_t i, size_t j, const FT value); }; diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index d49d4361688..042ea14f242 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -11,7 +11,9 @@ namespace CGAL { Several \cgal packages have to solve linear systems with dense or sparse matrices. This package provides concepts and models for that purpose. The models we provide -all use the \ref thirdpartyEigen library. +all use the \ref thirdpartyEigen library. It is straightforward to develop +equivalent models for other solvers, for example those found in the +Intel Math Kernel Library (MKL). @@ -24,6 +26,9 @@ iterative or a direct, symmetric or general sparse solvers. The specific solver to be used must be given as template parameter. +Each \cgal package using a sparse solver specifies which type of matrix +and solver is required. + Here are few examples: \code{.cpp} diff --git a/Solver_interface/include/CGAL/Eigen_solver_traits.h b/Solver_interface/include/CGAL/Eigen_solver_traits.h index 27d77321d9e..c3b06e92a2c 100644 --- a/Solver_interface/include/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/include/CGAL/Eigen_solver_traits.h @@ -69,7 +69,7 @@ namespace internal { /// is a generic traits class for solving asymmetric or symmetric positive definite (SPD) /// sparse linear systems using one of the Eigen solvers. /// The default solver is the iterative bi-congugate gradient stabilized solver -/// Eigen::BiCGSTAB for double. +/// Eigen::BiCGSTAB for double. /// /// \cgalModels `SparseLinearAlgebraTraitsWithFactor_d`. @@ -135,7 +135,7 @@ protected: }; -//specilization of the solver for BiCGSTAB as for surface parameterization, the +//specialization of the solver for BiCGSTAB as for surface parameterization, the //intializer should be a vector of one's (this was the case in 3.1-alpha but not in the official 3.1). template<> class Eigen_solver_traits< Eigen::BiCGSTAB::EigenType> > diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt index f3818718c66..66cad8b2040 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/PackageDescription.txt @@ -12,7 +12,7 @@ \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{3.2} -\cgalPkgDependsOn{Solvers as \ref thirdpartyEigen.} +\cgalPkgDependsOn{\ref PkgSolverSummary} \cgalPkgBib{cgal:sal-pptsm2} \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{Operations on Polyhedra,polyhedron_3.zip} From 3f1883e07543fb8fe440d1763629c43e2f89516e Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 14 Apr 2015 11:25:09 +0200 Subject: [PATCH 08/61] remove example as Eigen is now the default --- .../Eigen_parameterization.cmd | 1 - .../Eigen_parameterization.cpp | 124 ------------------ 2 files changed, 125 deletions(-) delete mode 100644 Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Eigen_parameterization.cmd delete mode 100644 Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Eigen_parameterization.cpp diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Eigen_parameterization.cmd b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Eigen_parameterization.cmd deleted file mode 100644 index c85f1308eb3..00000000000 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Eigen_parameterization.cmd +++ /dev/null @@ -1 +0,0 @@ -data/mannequin-devil.off diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Eigen_parameterization.cpp b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Eigen_parameterization.cpp deleted file mode 100644 index 7c97b3f8823..00000000000 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/Eigen_parameterization.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - - -// ---------------------------------------------------------------------------- -// Private types -// ---------------------------------------------------------------------------- - -typedef CGAL::Simple_cartesian Kernel; -typedef CGAL::Polyhedron_3 Polyhedron; - - -// ---------------------------------------------------------------------------- -// main() -// ---------------------------------------------------------------------------- - -int main(int argc, char * argv[]) -{ - std::cerr << "PARAMETERIZATION" << std::endl; - std::cerr << " Floater parameterization" << std::endl; - std::cerr << " Circle border" << std::endl; - std::cerr << " Eigen solver" << std::endl; - - //*************************************** - // decode parameters - //*************************************** - - if (argc-1 != 1) - { - std::cerr << "Usage: " << argv[0] << " input_file.off" << std::endl; - return(EXIT_FAILURE); - } - - // File name is: - const char* input_filename = argv[1]; - - //*************************************** - // Read the mesh - //*************************************** - - // Read the mesh - std::ifstream stream(input_filename); - Polyhedron mesh; - stream >> mesh; - if(!stream || !mesh.is_valid() || mesh.empty()) - { - std::cerr << "Error: cannot read OFF file " << input_filename << std::endl; - return EXIT_FAILURE; - } - - //*************************************** - // Create Polyhedron adaptor - // Note: no cutting => we support only - // meshes that are topological disks - //*************************************** - - typedef CGAL::Parameterization_polyhedron_adaptor_3 - Parameterization_polyhedron_adaptor; - - Parameterization_polyhedron_adaptor mesh_adaptor(mesh); - - //*************************************** - // Floater Mean Value Coordinates parameterization - // (circular border) with Eigen solver - //*************************************** - - // Circular border parameterizer (the default) - typedef CGAL::Circular_border_arc_length_parameterizer_3 - Border_parameterizer; - // Eigen solver - typedef CGAL::Eigen_solver_traits<> Solver; - - // Floater Mean Value Coordinates parameterization - // (circular border) with Eigen solver - typedef CGAL::Mean_value_coordinates_parameterizer_3 - Parameterizer; - - Parameterizer::Error_code err = CGAL::parameterize(mesh_adaptor, Parameterizer()); - - switch(err) { - case Parameterizer::OK: // Success - break; - case Parameterizer::ERROR_EMPTY_MESH: // Input mesh not supported - case Parameterizer::ERROR_NON_TRIANGULAR_MESH: - case Parameterizer::ERROR_NO_TOPOLOGICAL_DISC: - case Parameterizer::ERROR_BORDER_TOO_SHORT: - std::cerr << "Input mesh not supported: " << Parameterizer::get_error_message(err) << std::endl; - return EXIT_FAILURE; - break; - default: // Error - std::cerr << "Error: " << Parameterizer::get_error_message(err) << std::endl; - return EXIT_FAILURE; - break; - }; - - //*************************************** - // Output - //*************************************** - - // Raw output: dump (u,v) pairs - Polyhedron::Vertex_const_iterator pVertex; - for (pVertex = mesh.vertices_begin(); - pVertex != mesh.vertices_end(); - pVertex++) - { - // (u,v) pair is stored in any halfedge - double u = mesh_adaptor.info(pVertex->halfedge())->uv().x(); - double v = mesh_adaptor.info(pVertex->halfedge())->uv().y(); - std::cout << "(u,v) = (" << u << "," << v << ")" << std::endl; - } - - return EXIT_SUCCESS; -} From 90e6fbb97934d135bc586a25e49c08c60e2259c5 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 14 Apr 2015 11:31:06 +0200 Subject: [PATCH 09/61] remove example as Eigen is now the default --- .../Surface_mesh_parameterization.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt index 86e3d101201..15705de52a7 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt @@ -763,7 +763,6 @@ which transform arbitrary meshes into topological disks. \example Surface_mesh_parameterization/Simple_parameterization.cpp \example Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp \example Surface_mesh_parameterization/Complete_parameterization_example.cpp -\example Surface_mesh_parameterization/Eigen_parameterization.cpp \example Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp From 674159d412803b225353b847b30f8788582971bf Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 14 Apr 2015 14:37:42 +0200 Subject: [PATCH 10/61] fixes of doxygen warnings/errors --- Documentation/doc/Documentation/Doxyfile.in | 2 +- Solver_interface/doc/Solver_interface/Solver_interface.txt | 2 +- .../Surface_mesh_parameterization.txt | 2 +- .../doc/Surface_reconstruction_points_3/PackageDescription.txt | 2 +- .../doc/Surface_reconstruction_points_3/dependencies | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Documentation/doc/Documentation/Doxyfile.in b/Documentation/doc/Documentation/Doxyfile.in index 64555ba7df8..f16b658f6e7 100644 --- a/Documentation/doc/Documentation/Doxyfile.in +++ b/Documentation/doc/Documentation/Doxyfile.in @@ -58,7 +58,6 @@ IMAGE_PATH = ${CMAKE_SOURCE_DIR}/Documentation/doc/Documentation/fig \ ${CMAKE_SOURCE_DIR}/GraphicsView/doc/GraphicsView/fig \ ${CMAKE_SOURCE_DIR}/HalfedgeDS/doc/HalfedgeDS/fig \ ${CMAKE_SOURCE_DIR}/BGL/doc/BGL/fig \ - ${CMAKE_SOURCE_DIR}/BGL/doc/Solver_interface/fig \ ${CMAKE_SOURCE_DIR}/Combinatorial_map/doc/Combinatorial_map/fig \ ${CMAKE_SOURCE_DIR}/Linear_cell_complex/doc/Linear_cell_complex/fig \ ${CMAKE_SOURCE_DIR}/Interval_skip_list/doc/Interval_skip_list/fig \ @@ -90,6 +89,7 @@ IMAGE_PATH = ${CMAKE_SOURCE_DIR}/Documentation/doc/Documentation/fig \ ${CMAKE_SOURCE_DIR}/STL_Extension/doc/STL_Extension/fig \ ${CMAKE_SOURCE_DIR}/Skin_surface_3/doc/Skin_surface_3/fig \ ${CMAKE_SOURCE_DIR}/Snap_rounding_2/doc/Snap_rounding_2/fig \ + ${CMAKE_SOURCE_DIR}/Solver_interface/doc/Solver_interface/fig \ ${CMAKE_SOURCE_DIR}/Arrangement_on_surface_2/doc/Sweep_line_2/fig \ ${CMAKE_SOURCE_DIR}/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig \ ${CMAKE_SOURCE_DIR}/Boolean_set_operations_2/doc/Boolean_set_operations_2/fig \ diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 042ea14f242..e7848822a22 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -3,7 +3,7 @@ namespace CGAL { \mainpage User Manual \anchor Chapter_CGAL_and_Solvers -\anchor chapterBGL +\anchor chapterSolvers \cgalAutoToc \authors %CGAL Editorial Board diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt index 15705de52a7..4a0e711b544 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt @@ -69,7 +69,7 @@ Parameterizer_traits_3::Error_code parameterize (Paramet The function `parameterize()` applies a default surface parameterization method, namely Floater Mean Value Coordinates \cgalCite{cgal:f-mvc-03}, with an arc-length circular border parameterization, and using a sparse -linear solver from the \thirdpartyEigen library. The `ParameterizationMesh_3` concept defines the input meshes handled by `parameterize()`. See Section \ref secInputMeshforparameterize. The result is stored into the `(u,v)` fields of the mesh halfedges. +linear solver from the \ref thirdpartyEigen library. The `ParameterizationMesh_3` concept defines the input meshes handled by `parameterize()`. See Section \ref secInputMeshforparameterize. The result is stored into the `(u,v)` fields of the mesh halfedges. The mesh must be a triangle mesh surface with one connected component. Note: `Parameterizer_traits_3` is the (pure virtual) superclass of all surface parameterizations and defines the error codes. diff --git a/Surface_reconstruction_points_3/doc/Surface_reconstruction_points_3/PackageDescription.txt b/Surface_reconstruction_points_3/doc/Surface_reconstruction_points_3/PackageDescription.txt index 050a9cb09e0..bdeb66f2d3c 100644 --- a/Surface_reconstruction_points_3/doc/Surface_reconstruction_points_3/PackageDescription.txt +++ b/Surface_reconstruction_points_3/doc/Surface_reconstruction_points_3/PackageDescription.txt @@ -10,7 +10,7 @@ \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{3.5} -\cgalPkgDependsOn{\ref thirdpartyEigen} +\cgalPkgDependsOn{\ref PkgSolverSummary} \cgalPkgBib{cgal:asg-srps} \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{See Polyhedral Surface,polyhedron_3.zip} diff --git a/Surface_reconstruction_points_3/doc/Surface_reconstruction_points_3/dependencies b/Surface_reconstruction_points_3/doc/Surface_reconstruction_points_3/dependencies index 85ac52dc0d8..28de26d11fa 100644 --- a/Surface_reconstruction_points_3/doc/Surface_reconstruction_points_3/dependencies +++ b/Surface_reconstruction_points_3/doc/Surface_reconstruction_points_3/dependencies @@ -7,3 +7,4 @@ Stream_support Surface_mesher Point_set_processing_3 Surface_mesh_parameterization +Solver_interface From 9b4c1246367e88b8711562c051408fc26280d81f Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 14 Apr 2015 15:19:39 +0200 Subject: [PATCH 11/61] If there are no examples we need an empty EXAMPLE_PATH --- Solver_interface/doc/Solver_interface/Doxyfile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Solver_interface/doc/Solver_interface/Doxyfile.in b/Solver_interface/doc/Solver_interface/Doxyfile.in index 506657d2239..38f6e8f437c 100644 --- a/Solver_interface/doc/Solver_interface/Doxyfile.in +++ b/Solver_interface/doc/Solver_interface/Doxyfile.in @@ -2,4 +2,6 @@ PROJECT_NAME = "CGAL ${CGAL_CREATED_VERSION_NUM} - CGAL and Solvers" INPUT = ${CMAKE_SOURCE_DIR}/Solver_interface/doc/Solver_interface/ +EXAMPLE_PATH = + From d003e7bb2f25d8194a76249fd48667bf3d12dadb Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 15 Apr 2015 12:32:42 +0200 Subject: [PATCH 12/61] fix CMakeList.txt --- .../examples/Surface_mesh_parameterization/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt index 144152e05c6..c9615454f53 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt @@ -78,7 +78,6 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "Square_border_parameterization.cpp" ) create_single_source_cgal_program( "Complete_parameterization_example.cpp" ) - create_single_source_cgal_program( "Eigen_parameterization.cpp" ) create_single_source_cgal_program( "polyhedron_ex_parameterization.cpp" ) From f20024ff41211a2007114ba403574b247065497b Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 20 Aug 2015 11:57:21 +0200 Subject: [PATCH 13/61] Update moved out-of-date file --- .../CGAL/Eigen_solver_traits.h | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h index 9bd853c190b..a22a9812b50 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h @@ -7,16 +7,36 @@ namespace CGAL { The class `Eigen_solver_traits` provides an interface to the sparse solvers of \ref thirdpartyEigen "Eigen". The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. -\cgalModels `SparseLinearAlgebraTraitsWithFactor_d` +\cgalModels `SparseLinearAlgebraTraitsWithFactor_d` and `#NormalEquationSparseLinearAlgebraTraits_d` -\tparam T a sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver -`Eigen::BiCGSTAB` for `double`. +`T`: a sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver +`Eigen::BiCGSTAB` for `double`. \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` \sa `CGAL::Eigen_vector` +\sa http://eigen.tuxfamily.org +Example +-------------- + +The instantiation of this class assumes an \ref thirdpartyEigen "Eigen" sparse solver is provided. Here are few examples: + +\code{.cpp} + +typedef CGAL::Eigen_sparse_matrix::EigenType EigenMatrix; + +//iterative general solver +typedef CGAL::Eigen_solver_traits< Eigen::BiCGSTAB > Iterative_general_solver; + +//iterative symmetric solver +typedef CGAL::Eigen_solver_traits< Eigen::ConjugateGradient > Iterative_symmetric_solver; + +//direct symmetric solver +typedef CGAL::Eigen_solver_traits< Eigen::SimplicialCholesky > Direct_symmetric_solver; + +\endcode */ template< typename T > @@ -37,7 +57,7 @@ typedef typename T::Scalar NT; typedef CGAL::Eigen_vector Vector; /*! -If `T` is `Eigen::ConjugateGradient` or `Eigen::SimplicialCholesky`, `Matrix` is `CGAL::Eigen_sparse_symmetric_matrix` +If `T` is `Eigen::ConjugateGradient` or `Eigen::SimplicialCholesky`, `Matrix` is `CGAL::Eigen_sparse_symmetric_matrix` and `CGAL::Eigen_sparse_matrix` otherwise. */ From 89bb821611e8a1bee6ff9d5abc3393232b8c95f6 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 20 Aug 2015 16:04:53 +0200 Subject: [PATCH 14/61] Remove duplicated file (.h + .hpp) --- .../include/CGAL/Eigen_solver_traits.hpp | 187 ------------------ 1 file changed, 187 deletions(-) delete mode 100644 Solver_interface/include/CGAL/Eigen_solver_traits.hpp diff --git a/Solver_interface/include/CGAL/Eigen_solver_traits.hpp b/Solver_interface/include/CGAL/Eigen_solver_traits.hpp deleted file mode 100644 index c5e32e2d60c..00000000000 --- a/Solver_interface/include/CGAL/Eigen_solver_traits.hpp +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) 2012 INRIA Bordeaux Sud-Ouest (France), All rights reserved. -// -// This file is part of CGAL (www.cgal.org); 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. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Gael Guennebaud - -#ifndef CGAL_EIGEN_SOLVER_TRAITS_H -#define CGAL_EIGEN_SOLVER_TRAITS_H - -#include // include basic.h before testing #defines -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4244) -#endif -#include -#if EIGEN_VERSION_AT_LEAST(3, 1, 91) - -#include -#endif - - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif - -#include -#include -#include - -namespace CGAL { - - -namespace internal { - template - struct Get_eigen_matrix{ - typedef Eigen_sparse_matrix type; - }; - - template - struct Get_eigen_matrix< ::Eigen::ConjugateGradient,FT>{ - typedef Eigen_sparse_symmetric_matrix type; - }; - - template - struct Get_eigen_matrix< ::Eigen::SimplicialCholesky,FT>{ - typedef Eigen_sparse_symmetric_matrix type; - }; -#if EIGEN_VERSION_AT_LEAST(3, 1, 91) - template - struct Get_eigen_matrix< ::Eigen::SparseLU, FT> { - typedef Eigen_sparse_matrix type; - }; -#endif -} //internal - -/// The class Eigen_solver_traits -/// is a generic traits class for solving asymmetric or symmetric positive definite (SPD) -/// sparse linear systems using one of the Eigen solvers. -/// The default solver is the iterative bi-congugate gradient stabilized solver -/// Eigen::BiCGSTAB for double. -/// -/// \cgalModels `SparseLinearAlgebraTraitsWithFactor_d`. - - template::EigenType, Eigen::IncompleteLUT< double > > > -class Eigen_solver_traits -{ - typedef typename EigenSolverT::Scalar Scalar; -// Public types -public: - typedef Scalar NT; - typedef typename internal::Get_eigen_matrix::type Matrix; - typedef Eigen_vector Vector; - - -// Public operations -public: - - Eigen_solver_traits():m_mat(NULL), m_solver_sptr(new EigenSolverT) - { - } - - EigenSolverT& solver() { return *m_solver_sptr; } - - /// Solve the sparse linear system "A*X = B". - /// Return true on success. The solution is then (1/D) * X. - /// - /// @commentheading Preconditions: - /// - A.row_dimension() == B.dimension(). - /// - A.column_dimension() == X.dimension(). - bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D) - { - D = 1; // Eigen does not support homogeneous coordinates - - m_solver_sptr->compute(A.eigen_object()); - - if(m_solver_sptr->info() != Eigen::Success) - return false; - - X = m_solver_sptr->solve(B); - - return m_solver_sptr->info() == Eigen::Success; - } - - bool factor (const Matrix& A, NT& D) - { - D = 1; - - m_mat = &A.eigen_object(); - solver().compute(*m_mat); - return solver().info() == Eigen::Success; - } - - bool linear_solver(const Vector& B, Vector& X) - { - CGAL_precondition(m_mat!=NULL); //factor should have been called first - X = solver().solve(B); - return solver().info() == Eigen::Success; - } -protected: - const typename Matrix::EigenType* m_mat; - boost::shared_ptr m_solver_sptr; - -}; - -//specilization of the solver for BiCGSTAB as for surface parameterization, the -//intializer should be a vector of one's (this was the case in 3.1-alpha but not in the official 3.1). -template<> -class Eigen_solver_traits< Eigen::BiCGSTAB::EigenType, Eigen::IncompleteLUT< double > > > -{ - typedef Eigen::BiCGSTAB::EigenType, Eigen::IncompleteLUT< double > > EigenSolverT; - typedef EigenSolverT::Scalar Scalar; -// Public types -public: - typedef Scalar NT; - typedef internal::Get_eigen_matrix::type Matrix; - typedef Eigen_vector Vector; - - -// Public operations -public: - - Eigen_solver_traits(): m_solver_sptr(new EigenSolverT) - { - } - - EigenSolverT& solver() { return *m_solver_sptr; } - - /// Solve the sparse linear system "A*X = B". - /// Return true on success. The solution is then (1/D) * X. - /// - /// @commentheading Preconditions: - /// - A.row_dimension() == B.dimension(). - /// - A.column_dimension() == X.dimension(). - bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D) - { - D = 1; // Eigen does not support homogeneous coordinates - - m_solver_sptr->compute(A.eigen_object()); - - if(m_solver_sptr->info() != Eigen::Success) - return false; - - X.setOnes(B.rows()); - X = m_solver_sptr->solveWithGuess(B,X); - - return m_solver_sptr->info() == Eigen::Success; - } -protected: - boost::shared_ptr m_solver_sptr; - -}; - -} //namespace CGAL - -#endif // CGAL_EIGEN_SOLVER_TRAITS_H From 942907957d232112638d7cbb1f18ff3876cb68de Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 20 Aug 2015 16:11:33 +0200 Subject: [PATCH 15/61] Move eigen files from PCA (note: this is internal code from CGAL that should be replaced by Eigen) --- .../include/CGAL/eigen.h | 0 .../include/CGAL/eigen_2.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {Principal_component_analysis => Solver_interface}/include/CGAL/eigen.h (100%) rename {Principal_component_analysis => Solver_interface}/include/CGAL/eigen_2.h (100%) diff --git a/Principal_component_analysis/include/CGAL/eigen.h b/Solver_interface/include/CGAL/eigen.h similarity index 100% rename from Principal_component_analysis/include/CGAL/eigen.h rename to Solver_interface/include/CGAL/eigen.h diff --git a/Principal_component_analysis/include/CGAL/eigen_2.h b/Solver_interface/include/CGAL/eigen_2.h similarity index 100% rename from Principal_component_analysis/include/CGAL/eigen_2.h rename to Solver_interface/include/CGAL/eigen_2.h From abf90635613495b67f8614b453035d6dc085e5ec Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 20 Aug 2015 16:43:58 +0200 Subject: [PATCH 16/61] Move Eigen_vcm_traits.h to Solver package --- .../include/CGAL/Eigen_vcm_traits.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {Point_set_processing_3 => Solver_interface}/include/CGAL/Eigen_vcm_traits.h (100%) diff --git a/Point_set_processing_3/include/CGAL/Eigen_vcm_traits.h b/Solver_interface/include/CGAL/Eigen_vcm_traits.h similarity index 100% rename from Point_set_processing_3/include/CGAL/Eigen_vcm_traits.h rename to Solver_interface/include/CGAL/Eigen_vcm_traits.h From 9e0e0b7c8a6eb0c1c25275c5201f02c6181a3e1e Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 20 Aug 2015 16:45:04 +0200 Subject: [PATCH 17/61] Add function to diagonalize covariance matrix AND recover eigenvectors --- .../include/CGAL/Eigen_vcm_traits.h | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Solver_interface/include/CGAL/Eigen_vcm_traits.h b/Solver_interface/include/CGAL/Eigen_vcm_traits.h index 6a2aef110c3..5036194d427 100644 --- a/Solver_interface/include/CGAL/Eigen_vcm_traits.h +++ b/Solver_interface/include/CGAL/Eigen_vcm_traits.h @@ -85,6 +85,38 @@ public: return res; } + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors) + { + Eigen::Matrix3f m = construct_covariance_matrix(cov); + + // Diagonalizing the matrix + Eigen::Vector3f eigenvalues_; + Eigen::Matrix3f eigenvectors_; + bool res = diagonalize_selfadjoint_matrix(m, eigenvectors_, eigenvalues_); + + if (res) + { + eigenvalues[0]=eigenvalues_[0]; + eigenvalues[1]=eigenvalues_[1]; + eigenvalues[2]=eigenvalues_[2]; + eigenvectors[0]=eigenvectors_(0,0); + eigenvectors[1]=eigenvectors_(1,0); + eigenvectors[2]=eigenvectors_(2,0); + eigenvectors[3]=eigenvectors_(0,1); + eigenvectors[4]=eigenvectors_(1,1); + eigenvectors[5]=eigenvectors_(2,1); + eigenvectors[6]=eigenvectors_(0,2); + eigenvectors[7]=eigenvectors_(1,2); + eigenvectors[8]=eigenvectors_(2,2); + } + + return res; + } + // Extract the eigenvector associated to the largest eigenvalue static bool extract_largest_eigenvector_of_covariance_matrix ( From a3bcd62a42e521e3b24498d3ef08d308592a8a5e Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 21 Aug 2015 09:16:46 +0200 Subject: [PATCH 18/61] Make Eigen_vcm_traits template of floating types with static_casts for Eigen conversion --- .../include/CGAL/Eigen_vcm_traits.h | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/Solver_interface/include/CGAL/Eigen_vcm_traits.h b/Solver_interface/include/CGAL/Eigen_vcm_traits.h index 5036194d427..ffda6d6dbfa 100644 --- a/Solver_interface/include/CGAL/Eigen_vcm_traits.h +++ b/Solver_interface/include/CGAL/Eigen_vcm_traits.h @@ -30,15 +30,20 @@ namespace CGAL { /// A model of the concept `VCMTraits` using \ref thirdpartyEigen. /// \cgalModels `VCMTraits` + +template class Eigen_vcm_traits{ // Construct the covariance matrix static Eigen::Matrix3f - construct_covariance_matrix (const cpp11::array& cov) { + construct_covariance_matrix (const cpp11::array& cov) { Eigen::Matrix3f m; - m(0,0) = cov[0]; m(0,1) = cov[1]; m(0,2) = cov[2]; - m(1,1) = cov[3]; m(1,2) = cov[4]; - m(2,2) = cov[5]; + m(0,0) = static_cast(cov[0]); + m(0,1) = static_cast(cov[1]); + m(0,2) = static_cast(cov[2]); + m(1,1) = static_cast(cov[3]); + m(1,2) = static_cast(cov[4]); + m(2,2) = static_cast(cov[5]); m(1, 0) = m(0,1); m(2, 0) = m(0, 2); m(2, 1) = m(1, 2); @@ -65,8 +70,8 @@ class Eigen_vcm_traits{ public: static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues) + const cpp11::array& cov, + cpp11::array& eigenvalues) { Eigen::Matrix3f m = construct_covariance_matrix(cov); @@ -77,9 +82,9 @@ public: if (res) { - eigenvalues[0]=eigenvalues_[0]; - eigenvalues[1]=eigenvalues_[1]; - eigenvalues[2]=eigenvalues_[2]; + eigenvalues[0]=static_cast(eigenvalues_[0]); + eigenvalues[1]=static_cast(eigenvalues_[1]); + eigenvalues[2]=static_cast(eigenvalues_[2]); } return res; @@ -87,9 +92,9 @@ public: static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues, - cpp11::array& eigenvectors) + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors) { Eigen::Matrix3f m = construct_covariance_matrix(cov); @@ -100,18 +105,18 @@ public: if (res) { - eigenvalues[0]=eigenvalues_[0]; - eigenvalues[1]=eigenvalues_[1]; - eigenvalues[2]=eigenvalues_[2]; - eigenvectors[0]=eigenvectors_(0,0); - eigenvectors[1]=eigenvectors_(1,0); - eigenvectors[2]=eigenvectors_(2,0); - eigenvectors[3]=eigenvectors_(0,1); - eigenvectors[4]=eigenvectors_(1,1); - eigenvectors[5]=eigenvectors_(2,1); - eigenvectors[6]=eigenvectors_(0,2); - eigenvectors[7]=eigenvectors_(1,2); - eigenvectors[8]=eigenvectors_(2,2); + eigenvalues[0]=static_cast(eigenvalues_[0]); + eigenvalues[1]=static_cast(eigenvalues_[1]); + eigenvalues[2]=static_cast(eigenvalues_[2]); + eigenvectors[0]=static_cast(eigenvectors_(0,0)); + eigenvectors[1]=static_cast(eigenvectors_(1,0)); + eigenvectors[2]=static_cast(eigenvectors_(2,0)); + eigenvectors[3]=static_cast(eigenvectors_(0,1)); + eigenvectors[4]=static_cast(eigenvectors_(1,1)); + eigenvectors[5]=static_cast(eigenvectors_(2,1)); + eigenvectors[6]=static_cast(eigenvectors_(0,2)); + eigenvectors[7]=static_cast(eigenvectors_(1,2)); + eigenvectors[8]=static_cast(eigenvectors_(2,2)); } return res; @@ -120,8 +125,8 @@ public: // Extract the eigenvector associated to the largest eigenvalue static bool extract_largest_eigenvector_of_covariance_matrix ( - const cpp11::array& cov, - cpp11::array &normal) + const cpp11::array& cov, + cpp11::array &normal) { // Construct covariance matrix Eigen::Matrix3f m = construct_covariance_matrix(cov); @@ -134,9 +139,9 @@ public: } // Eigenvalues are already sorted by increasing order - normal[0]=eigenvectors(0,0); - normal[1]=eigenvectors(1,0); - normal[2]=eigenvectors(2,0); + normal[0]=static_cast(eigenvectors(0,0)); + normal[1]=static_cast(eigenvectors(1,0)); + normal[2]=static_cast(eigenvectors(2,0)); return true; } From 9dccbee9ed492c1b4cd73a4046ac7ff9b10e1ec7 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 21 Aug 2015 09:36:59 +0200 Subject: [PATCH 19/61] Move VCMtraits to Solver package --- .../doc/Solver_interface/Concepts}/Concepts/VCMTraits.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {Point_set_processing_3/doc/Point_set_processing_3 => Solver_interface/doc/Solver_interface/Concepts}/Concepts/VCMTraits.h (100%) diff --git a/Point_set_processing_3/doc/Point_set_processing_3/Concepts/VCMTraits.h b/Solver_interface/doc/Solver_interface/Concepts/Concepts/VCMTraits.h similarity index 100% rename from Point_set_processing_3/doc/Point_set_processing_3/Concepts/VCMTraits.h rename to Solver_interface/doc/Solver_interface/Concepts/Concepts/VCMTraits.h From 075c29c3fabdb1ceab918eae53c89925b68b44cd Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 21 Aug 2015 09:41:57 +0200 Subject: [PATCH 20/61] New file to document Eigen_vcm_traits --- .../Solver_interface/CGAL/Eigen_vcm_traits.h | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h new file mode 100644 index 00000000000..0ef89e9cbbf --- /dev/null +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h @@ -0,0 +1,47 @@ +namespace CGAL { + +/*! +\ingroup PkgSolver + +The class `Eigen_vcm_traits` provides an interface to the diagonalization of Variance-Covariance Matrices of \ref thirdpartyEigen "Eigen". +The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. + +\cgalModels `VCMTraits` + + +`T`: floating type + +\sa http://eigen.tuxfamily.org + +Example +-------------- + + +*/ + + + +template +class Eigen_vcm_traits{ + +public: + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues); + + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors); + + static bool + extract_largest_eigenvector_of_covariance_matrix ( + const cpp11::array& cov, + cpp11::array &normal); + +}; + +} // namespace CGAL + From 99eb0e104118c9b67dbb90470a9185c9862b73d5 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 21 Aug 2015 11:57:46 +0200 Subject: [PATCH 21/61] Started working on examples --- .../doc/Solver_interface/Doxyfile.in | 2 +- .../Solver_interface/PackageDescription.txt | 2 ++ .../doc/Solver_interface/Solver_interface.txt | 22 ++++++++++-- .../doc/Solver_interface/examples.txt | 2 +- .../examples/Solver_interface/CMakeLists.txt | 34 ++++++++++++++++++ .../eigen_singular_value_decomposition.cpp | 36 +++++++++++++++++++ 6 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 Solver_interface/examples/Solver_interface/CMakeLists.txt create mode 100644 Solver_interface/examples/Solver_interface/eigen_singular_value_decomposition.cpp diff --git a/Solver_interface/doc/Solver_interface/Doxyfile.in b/Solver_interface/doc/Solver_interface/Doxyfile.in index 38f6e8f437c..0f3e79647fd 100644 --- a/Solver_interface/doc/Solver_interface/Doxyfile.in +++ b/Solver_interface/doc/Solver_interface/Doxyfile.in @@ -2,6 +2,6 @@ PROJECT_NAME = "CGAL ${CGAL_CREATED_VERSION_NUM} - CGAL and Solvers" INPUT = ${CMAKE_SOURCE_DIR}/Solver_interface/doc/Solver_interface/ -EXAMPLE_PATH = +EXAMPLE_PATH = ${CMAKE_SOURCE_DIR}/Solver_interface/examples/Solver_interface/ diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index 31880f73a87..1713c6412e2 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -28,11 +28,13 @@ - `SparseLinearAlgebraTraits_d` - `SparseLinearAlgebraTraitsWithFactor_d` - `SvdTraits` +- `VCMTraits` ## Classes ## - `CGAL::Eigen_solver_traits` - `CGAL::Eigen_svd` +- `CGAL::Eigen_vcm_traits` - `CGAL::Eigen_matrix` - `CGAL::Eigen_vector` - `CGAL::Eigen_sparse_matrix` diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index e7848822a22..41dd52c4501 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -17,7 +17,7 @@ equivalent models for other solvers, for example those found in the -\section SectionSolverEigen Eigen +\section SectionSolverEigenSparse Eigen Sparse Solvers An interface to all sparse solvers from the \ref thirdpartyEigen library is provided through the class @@ -44,7 +44,25 @@ typedef CGAL::Eigen_solver_traits< Eigen::ConjugateGradient > Itera //direct symmetric solver typedef CGAL::Eigen_solver_traits< Eigen::SimplicialCholesky > Direct_symmetric_solver; -\endcode +\endcode + +\section SectionSolverEigenSVD Eigen Singular Value Decomposition + +The class `Eigen_svd` provides an algorithm to solve in the least +square sense a linear system with a singular value decomposition using +\ref thirdpartyEigen. The field type is `double`. + +Here is a simple example that shows how to handle matrices, vectors +and this solver: + +\cgalExample{Solver_interface/eigen_singular_value_decomposition.cpp} + +\section SectionSolverEigenVCM Variance Covariance Matrix + +The class `Eigen_vcm_traits` provides an interface to the +selfadjoint solver of the \ref thirdpartyEigen library. + + diff --git a/Solver_interface/doc/Solver_interface/examples.txt b/Solver_interface/doc/Solver_interface/examples.txt index e356965d012..8e789ad4230 100644 --- a/Solver_interface/doc/Solver_interface/examples.txt +++ b/Solver_interface/doc/Solver_interface/examples.txt @@ -1,3 +1,3 @@ /*! - +\example Solver_interface/eigen_singular_value_decomposition.cpp */ diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt new file mode 100644 index 00000000000..a6f626c4f71 --- /dev/null +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -0,0 +1,34 @@ +# Created by the script cgal_create_cmake_script +# This is the CMake script for compiling a CGAL application. + + +project( examples_ ) + +cmake_minimum_required(VERSION 2.8.10) + +find_package(CGAL QUIET COMPONENTS Core ) + +if ( CGAL_FOUND ) + + include( ${CGAL_USE_FILE} ) + + include( CGAL_CreateSingleSourceCGALProgram ) + + find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) + if (NOT EIGEN3_FOUND) + message(STATUS "This program requires the Eigen library, and will not be compiled.") + else() + include( ${EIGEN3_USE_FILE} ) + endif() + + + include_directories (BEFORE "../include") + + create_single_source_cgal_program( "eigen_singular_value_decomposition.cpp" ) + +else() + + message(STATUS "This program requires the CGAL library, and will not be compiled.") + +endif() + diff --git a/Solver_interface/examples/Solver_interface/eigen_singular_value_decomposition.cpp b/Solver_interface/examples/Solver_interface/eigen_singular_value_decomposition.cpp new file mode 100644 index 00000000000..439587d59dc --- /dev/null +++ b/Solver_interface/examples/Solver_interface/eigen_singular_value_decomposition.cpp @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +typedef CGAL::Eigen_svd::FT FT; +typedef CGAL::Eigen_svd::Vector Eigen_vector; +typedef CGAL::Eigen_svd::Matrix Eigen_matrix; + +int main(void) +{ + std::size_t degree = 3; + + Eigen_vector B (degree); + Eigen_matrix M (degree, degree); + + + // Fill B and M with random numbers + for (std::size_t i = 0; i < degree; ++ i) + { + B.set (i, rand()); + for (std::size_t j = 0; j < degree; ++ j) + M.set (i, j, rand()); + } + + // Solve MX=B + std::cout << CGAL::Eigen_svd::solve(M, B) << std::endl; + + // Print result + std::cout << "Solution of SVD = [ "; + for (std::size_t i = 0; i < degree; ++ i) + std::cout << B.vector()[i] << " "; + std::cout << "]" << std::endl; + + return 0; +} From 45cd7b58bbc33947396618d8506d469715955fd6 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 21 Aug 2015 14:16:17 +0200 Subject: [PATCH 22/61] Fixed bad move of VCMTraits.h --- .../doc/Solver_interface/Concepts/{Concepts => }/VCMTraits.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Solver_interface/doc/Solver_interface/Concepts/{Concepts => }/VCMTraits.h (96%) diff --git a/Solver_interface/doc/Solver_interface/Concepts/Concepts/VCMTraits.h b/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h similarity index 96% rename from Solver_interface/doc/Solver_interface/Concepts/Concepts/VCMTraits.h rename to Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h index 4c4b91b12a1..b2e30246aaf 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/Concepts/VCMTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h @@ -1,5 +1,5 @@ /*! -\ingroup PkgPointSetProcessingConcepts +\ingroup PkgSolverConcepts \cgalConcept Concept providing functions to extract eigenvectors and eigenvalue from covariance matrices represented by an array `a` as follows: From edd823d2fdd7e387b8df8d5f2b28e07d7e79d58d Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 21 Aug 2015 14:55:48 +0200 Subject: [PATCH 23/61] Example of eigendecomposition --- Solver_interface/doc/Solver_interface/Solver_interface.txt | 4 ++++ Solver_interface/doc/Solver_interface/examples.txt | 1 + Solver_interface/examples/Solver_interface/CMakeLists.txt | 1 + 3 files changed, 6 insertions(+) diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 41dd52c4501..22fe8e4a5a7 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -62,6 +62,10 @@ and this solver: The class `Eigen_vcm_traits` provides an interface to the selfadjoint solver of the \ref thirdpartyEigen library. +This is an example of an eigendecomposition of a matrix using this +class: + +\cgalExample{Solver_interface/eigen_variance_covariance_matrix.cpp} diff --git a/Solver_interface/doc/Solver_interface/examples.txt b/Solver_interface/doc/Solver_interface/examples.txt index 8e789ad4230..a19fc9887e2 100644 --- a/Solver_interface/doc/Solver_interface/examples.txt +++ b/Solver_interface/doc/Solver_interface/examples.txt @@ -1,3 +1,4 @@ /*! \example Solver_interface/eigen_singular_value_decomposition.cpp +\example Solver_interface/eigen_variance_covariance_matrix.cpp */ diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index a6f626c4f71..b64849b0387 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -25,6 +25,7 @@ if ( CGAL_FOUND ) include_directories (BEFORE "../include") create_single_source_cgal_program( "eigen_singular_value_decomposition.cpp" ) + create_single_source_cgal_program( "eigen_variance_covariance_matrix.cpp" ) else() From b1151e6f048138bae4b059dbbe917bd4bafb4079 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 24 Aug 2015 16:10:20 +0200 Subject: [PATCH 24/61] New example for sparse solvers --- .../doc/Solver_interface/Solver_interface.txt | 9 ++- .../doc/Solver_interface/examples.txt | 1 + .../examples/Solver_interface/CMakeLists.txt | 1 + .../Solver_interface/eigen_sparse_solvers.cpp | 64 +++++++++++++++++++ 4 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 22fe8e4a5a7..ed50799101c 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -27,9 +27,7 @@ specific solver to be used must be given as template parameter. Each \cgal package using a sparse solver specifies which type of matrix -and solver is required. - -Here are few examples: +and solver is required: \code{.cpp} @@ -46,6 +44,11 @@ typedef CGAL::Eigen_solver_traits< Eigen::SimplicialCholesky > Dire \endcode +Here is an example that shows how to fill the sparse matrix and call +the solver: + +\cgalExample{Solver_interface/eigen_sparse_solvers.cpp} + \section SectionSolverEigenSVD Eigen Singular Value Decomposition The class `Eigen_svd` provides an algorithm to solve in the least diff --git a/Solver_interface/doc/Solver_interface/examples.txt b/Solver_interface/doc/Solver_interface/examples.txt index a19fc9887e2..2d2b127bd9c 100644 --- a/Solver_interface/doc/Solver_interface/examples.txt +++ b/Solver_interface/doc/Solver_interface/examples.txt @@ -1,4 +1,5 @@ /*! \example Solver_interface/eigen_singular_value_decomposition.cpp \example Solver_interface/eigen_variance_covariance_matrix.cpp +\example Solver_interface/eigen_sparse_solvers.cpp */ diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index b64849b0387..2d6de0e3734 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -26,6 +26,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "eigen_singular_value_decomposition.cpp" ) create_single_source_cgal_program( "eigen_variance_covariance_matrix.cpp" ) + create_single_source_cgal_program( "eigen_sparse_solvers.cpp" ) else() diff --git a/Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp b/Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp new file mode 100644 index 00000000000..4f26d5a284c --- /dev/null +++ b/Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp @@ -0,0 +1,64 @@ +#include + +#include +#include +#include + + +typedef CGAL::Eigen_solver_traits::EigenType> > Eigen_solver; +typedef Eigen_solver::NT FT; +typedef Eigen_solver::Matrix Eigen_matrix; +typedef Eigen_solver::Vector Eigen_vector; + + +int main(void) +{ + srand (time (NULL)); + std::size_t degree = 3000; + std::size_t nb_nonzero_coef = 100; + + Eigen_vector B (degree); + Eigen_matrix A (degree); + + std::set > done; + + Eigen_vector diag (degree); + for (std::size_t i = 0; i < nb_nonzero_coef; ++ i) + { + std::size_t x = rand () % degree; + std::size_t y = rand () % degree; + if (x == y) + continue; + + FT value = rand () / static_cast (RAND_MAX); + + A.add_coef (x, y, value); + diag.set (x, diag.vector()[x] - value); + + B.set (x, 1.); + } + + for (std::size_t i = 0; i < degree; ++ i) + A.add_coef (i, i, diag.vector()[i]); + + A.assemble_matrix(); + + Eigen_vector X (degree); + FT d; + + Eigen_solver solver; + if (!(solver.linear_solver (A, B, X, d))) + { + std::cerr << "Error: linear solver failed" << std::endl; + return -1; + } + + // Print extract of result + std::cout << "Vector X (non-zero coefficients) = [ "; + for (std::size_t i = 0; i < degree; ++ i) + if (X.vector()[i] != 0.) + std::cout << X.vector()[i] << " "; + std::cout << "]" << std::endl; + + return 0; +} From f04eeea9699b350873491c45816f5c24ccdfd445 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 25 Aug 2015 11:18:04 +0200 Subject: [PATCH 25/61] Sparse solver example: removed unused variable --- .../examples/Solver_interface/eigen_sparse_solvers.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp b/Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp index 4f26d5a284c..f549a055456 100644 --- a/Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp +++ b/Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp @@ -20,8 +20,6 @@ int main(void) Eigen_vector B (degree); Eigen_matrix A (degree); - std::set > done; - Eigen_vector diag (degree); for (std::size_t i = 0; i < nb_nonzero_coef; ++ i) { From 700684f0ff2fe11361d59f17afd264dbcadc545d Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 25 Aug 2015 11:55:27 +0200 Subject: [PATCH 26/61] New file Internal_vcm_traits.h (aim at replacing eigen.h in PCA package) --- .../include/CGAL/Internal_vcm_traits.h | 244 ++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 Solver_interface/include/CGAL/Internal_vcm_traits.h diff --git a/Solver_interface/include/CGAL/Internal_vcm_traits.h b/Solver_interface/include/CGAL/Internal_vcm_traits.h new file mode 100644 index 00000000000..5a22dd9f6d3 --- /dev/null +++ b/Solver_interface/include/CGAL/Internal_vcm_traits.h @@ -0,0 +1,244 @@ +#ifndef CGAL_INTERNAL_VCM_TRAITS_H +#define CGAL_INTERNAL_VCM_TRAITS_H + +#include + +namespace CGAL { + + /// A model of the concept `VCMTraits` + /// \cgalModels `VCMTraits` + + template + class Internal_vcm_traits{ + + public: + static bool + diagonalize_selfadjoint_covariance_matrix(const cpp11::array& cov, + cpp11::array& eigenvalues) + { + cpp11::array eigenvectors; + return diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); + } + + // Extract the eigenvector associated to the largest eigenvalue + static bool + extract_largest_eigenvector_of_covariance_matrix (const cpp11::array& cov, + cpp11::array &normal) + { + cpp11::array eigenvalues; + cpp11::array eigenvectors; + + diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); + + normal[0] = static_cast (eigenvectors(0)); + normal[1] = static_cast (eigenvectors(1)); + normal[2] = static_cast (eigenvectors(2)); + + return true; + } + + static bool diagonalize_selfadjoint_covariance_matrix (const cpp11::array& mat, + cpp11::array& eigen_values, + cpp11::array& eigen_vectors) + { + const int n = 3; + const int MAX_ITER = 100; + static const FT EPSILON = (FT)0.00001; + + // number of entries in mat + int nn = (n*(n+1))/2; + + // copy matrix + FT *a = new FT[nn]; + int ij; + for(ij=0; ij a_normEPS && nb_iter < MAX_ITER) + { + nb_iter++; + FT thr_nn = thr / nn; + + for(int l=1; l< n; l++) + { + for(int m=l+1; m<=n; m++) + { + // compute sinx and cosx + int lq = (l*l-l)/2; + int mq = (m*m-m)/2; + + int lm = l + mq; + FT a_lm = a[lm]; + FT a_lm_2 = a_lm * a_lm; + + if(a_lm_2 < thr_nn) + continue; + + int ll = l + lq; + int mm = m + mq; + FT a_ll = a[ll]; + FT a_mm = a[mm]; + + FT delta = a_ll - a_mm; + + FT x; + if(delta == 0.0) + x = (FT) - CGAL_PI / 4; + else + x = (FT)(- std::atan( (a_lm+a_lm) / delta ) / 2.0); + + FT sinx = std::sin(x); + FT cosx = std::cos(x); + FT sinx_2 = sinx * sinx; + FT cosx_2 = cosx * cosx; + FT sincos = sinx * cosx; + + // rotate L and M columns + int ilv = n*(l-1); + int imv = n*(m-1); + + int i; + for( i=1; i<=n;i++ ) + { + if( (i!=l) && (i!=m) ) + { + int iq = (i*i-i)/2; + + int im; + if( i eigen_values[j]) + { + k = j; + x = eigen_values[j]; + } + + eigen_values[k] = eigen_values[i]; + eigen_values[i] = x; + + int jj = index[k]; + index[k] = index[i]; + index[i] = jj; + } + + + // save eigen vectors + v++; // back to C++ + ij = 0; + for(int k=0; k Date: Tue, 25 Aug 2015 15:11:04 +0200 Subject: [PATCH 27/61] Add unsigned int template to VCM_traits so that matrices of dimension other than 3 can be diagonalized --- .../eigen_variance_covariance_matrix.cpp | 41 ++++++++ .../include/CGAL/Eigen_vcm_traits.h | 97 +++++++++---------- .../include/CGAL/Internal_vcm_traits.h | 53 +++++----- 3 files changed, 116 insertions(+), 75 deletions(-) create mode 100644 Solver_interface/examples/Solver_interface/eigen_variance_covariance_matrix.cpp diff --git a/Solver_interface/examples/Solver_interface/eigen_variance_covariance_matrix.cpp b/Solver_interface/examples/Solver_interface/eigen_variance_covariance_matrix.cpp new file mode 100644 index 00000000000..46ce3680908 --- /dev/null +++ b/Solver_interface/examples/Solver_interface/eigen_variance_covariance_matrix.cpp @@ -0,0 +1,41 @@ +#include +#include + + +typedef double FT; +typedef CGAL::cpp11::array Eigen_matrix; +typedef CGAL::cpp11::array Eigen_vector; +typedef CGAL::cpp11::array Eigen_three_vectors; +typedef CGAL::Eigen_vcm_traits Vcm_traits; + +int main(void) +{ + Eigen_matrix covariance = {{ 0., 0., 0., 0., 0., 0. }}; + // Fill matrix with random numbers + for (std::size_t i = 0; i < 6; ++ i) + covariance[i] = rand (); + + Eigen_vector eigenvalues; + Eigen_three_vectors eigenvectors; + + if (!(Vcm_traits::diagonalize_selfadjoint_covariance_matrix (covariance, + eigenvalues, + eigenvectors))) + { + std::cerr << "Error: cannot diagonalize matrix" << std::endl; + return -1; + } + + + // Print result + for (std::size_t i = 0; i < 3; ++ i) + { + std::cout << "Eigenvalue " << i+1 << " = " << eigenvalues[i] << std::endl + << " with eigenvector [ "; + for (std::size_t j = 0; j < 3; ++ j) + std::cout << eigenvectors[3*i + j] << " "; + std::cout << "]" << std::endl; + } + + return 0; +} diff --git a/Solver_interface/include/CGAL/Eigen_vcm_traits.h b/Solver_interface/include/CGAL/Eigen_vcm_traits.h index ffda6d6dbfa..7ab5bc1627a 100644 --- a/Solver_interface/include/CGAL/Eigen_vcm_traits.h +++ b/Solver_interface/include/CGAL/Eigen_vcm_traits.h @@ -31,31 +31,35 @@ namespace CGAL { /// A model of the concept `VCMTraits` using \ref thirdpartyEigen. /// \cgalModels `VCMTraits` -template +template class Eigen_vcm_traits{ + + typedef Eigen::Matrix Matrix; + typedef Eigen::Matrix Vector; + // Construct the covariance matrix - static Eigen::Matrix3f - construct_covariance_matrix (const cpp11::array& cov) { - Eigen::Matrix3f m; + static Matrix + construct_covariance_matrix + (const cpp11::array& cov) { + Matrix m; - m(0,0) = static_cast(cov[0]); - m(0,1) = static_cast(cov[1]); - m(0,2) = static_cast(cov[2]); - m(1,1) = static_cast(cov[3]); - m(1,2) = static_cast(cov[4]); - m(2,2) = static_cast(cov[5]); - - m(1, 0) = m(0,1); m(2, 0) = m(0, 2); m(2, 1) = m(1, 2); + for (std::size_t i = 0; i < degree; ++ i) + for (std::size_t j = i; j < degree; ++ j) + { + m(i,j) = static_cast(cov[(degree * i) + j - ((i * (i+1)) / 2)]); + if (i != j) + m(j,i) = m(i,j); + } return m; } // Diagonalize a selfadjoint matrix static bool - diagonalize_selfadjoint_matrix (Eigen::Matrix3f &m, - Eigen::Matrix3f &eigenvectors, - Eigen::Vector3f &eigenvalues) { - Eigen::SelfAdjointEigenSolver eigensolver(m); + diagonalize_selfadjoint_matrix (Matrix& m, + Matrix& eigenvectors, + Vector& eigenvalues) { + Eigen::SelfAdjointEigenSolver eigensolver(m); if (eigensolver.info() != Eigen::Success) { return false; @@ -70,21 +74,20 @@ class Eigen_vcm_traits{ public: static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues) + const cpp11::array& cov, + cpp11::array& eigenvalues) { - Eigen::Matrix3f m = construct_covariance_matrix(cov); + Matrix m = construct_covariance_matrix(cov); // Diagonalizing the matrix - Eigen::Vector3f eigenvalues_; - Eigen::Matrix3f eigenvectors_; + Vector eigenvalues_; + Matrix eigenvectors_; bool res = diagonalize_selfadjoint_matrix(m, eigenvectors_, eigenvalues_); if (res) { - eigenvalues[0]=static_cast(eigenvalues_[0]); - eigenvalues[1]=static_cast(eigenvalues_[1]); - eigenvalues[2]=static_cast(eigenvalues_[2]); + for (std::size_t i = 0; i < degree; ++ i) + eigenvalues[i] = static_cast(eigenvalues_[i]); } return res; @@ -92,31 +95,26 @@ public: static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues, - cpp11::array& eigenvectors) + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors) { - Eigen::Matrix3f m = construct_covariance_matrix(cov); + Matrix m = construct_covariance_matrix(cov); // Diagonalizing the matrix - Eigen::Vector3f eigenvalues_; - Eigen::Matrix3f eigenvectors_; + Vector eigenvalues_; + Matrix eigenvectors_; bool res = diagonalize_selfadjoint_matrix(m, eigenvectors_, eigenvalues_); if (res) { - eigenvalues[0]=static_cast(eigenvalues_[0]); - eigenvalues[1]=static_cast(eigenvalues_[1]); - eigenvalues[2]=static_cast(eigenvalues_[2]); - eigenvectors[0]=static_cast(eigenvectors_(0,0)); - eigenvectors[1]=static_cast(eigenvectors_(1,0)); - eigenvectors[2]=static_cast(eigenvectors_(2,0)); - eigenvectors[3]=static_cast(eigenvectors_(0,1)); - eigenvectors[4]=static_cast(eigenvectors_(1,1)); - eigenvectors[5]=static_cast(eigenvectors_(2,1)); - eigenvectors[6]=static_cast(eigenvectors_(0,2)); - eigenvectors[7]=static_cast(eigenvectors_(1,2)); - eigenvectors[8]=static_cast(eigenvectors_(2,2)); + for (std::size_t i = 0; i < degree; ++ i) + { + eigenvalues[i] = static_cast(eigenvalues_[i]); + + for (std::size_t j = 0; j < degree; ++ j) + eigenvectors[degree*i + j]=static_cast(eigenvectors_(j,i)); + } } return res; @@ -125,23 +123,22 @@ public: // Extract the eigenvector associated to the largest eigenvalue static bool extract_largest_eigenvector_of_covariance_matrix ( - const cpp11::array& cov, - cpp11::array &normal) + const cpp11::array& cov, + cpp11::array &normal) { // Construct covariance matrix - Eigen::Matrix3f m = construct_covariance_matrix(cov); + Matrix m = construct_covariance_matrix(cov); // Diagonalizing the matrix - Eigen::Vector3f eigenvalues; - Eigen::Matrix3f eigenvectors; + Vector eigenvalues; + Matrix eigenvectors; if (! diagonalize_selfadjoint_matrix(m, eigenvectors, eigenvalues)) { return false; } // Eigenvalues are already sorted by increasing order - normal[0]=static_cast(eigenvectors(0,0)); - normal[1]=static_cast(eigenvectors(1,0)); - normal[2]=static_cast(eigenvectors(2,0)); + for (unsigned int i = 0; i < degree; ++ i) + normal[i] = static_cast (eigenvectors(i,0)); return true; } diff --git a/Solver_interface/include/CGAL/Internal_vcm_traits.h b/Solver_interface/include/CGAL/Internal_vcm_traits.h index 5a22dd9f6d3..11ce707175b 100644 --- a/Solver_interface/include/CGAL/Internal_vcm_traits.h +++ b/Solver_interface/include/CGAL/Internal_vcm_traits.h @@ -8,40 +8,43 @@ namespace CGAL { /// A model of the concept `VCMTraits` /// \cgalModels `VCMTraits` - template - class Internal_vcm_traits{ +template +class Internal_vcm_traits{ - public: + public: static bool - diagonalize_selfadjoint_covariance_matrix(const cpp11::array& cov, - cpp11::array& eigenvalues) + diagonalize_selfadjoint_covariance_matrix + (const cpp11::array& cov, + cpp11::array& eigenvalues) { - cpp11::array eigenvectors; + cpp11::array eigenvectors; return diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); } // Extract the eigenvector associated to the largest eigenvalue static bool - extract_largest_eigenvector_of_covariance_matrix (const cpp11::array& cov, - cpp11::array &normal) + extract_largest_eigenvector_of_covariance_matrix + (const cpp11::array& cov, + cpp11::array &normal) { - cpp11::array eigenvalues; - cpp11::array eigenvectors; + cpp11::array eigenvalues; + cpp11::array eigenvectors; diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); - normal[0] = static_cast (eigenvectors(0)); - normal[1] = static_cast (eigenvectors(1)); - normal[2] = static_cast (eigenvectors(2)); - + for (std::size_t i = 0; i < degree; ++ i) + normal[i] = static_cast (eigenvectors(i)); + return true; } - static bool diagonalize_selfadjoint_covariance_matrix (const cpp11::array& mat, - cpp11::array& eigen_values, - cpp11::array& eigen_vectors) + static bool diagonalize_selfadjoint_covariance_matrix + (const cpp11::array& mat, + cpp11::array& eigen_values, + cpp11::array& eigen_vectors) { - const int n = 3; + const int n = degree; + const int MAX_ITER = 100; static const FT EPSILON = (FT)0.00001; @@ -51,13 +54,13 @@ namespace CGAL { // copy matrix FT *a = new FT[nn]; int ij; - for(ij=0; ij Date: Tue, 25 Aug 2015 16:14:32 +0200 Subject: [PATCH 28/61] Update doc with VCM trait classes --- .../Solver_interface/CGAL/Eigen_vcm_traits.h | 25 +++++----- .../CGAL/Internal_vcm_traits.h | 46 +++++++++++++++++++ .../doc/Solver_interface/Concepts/VCMTraits.h | 21 +++++++-- 3 files changed, 77 insertions(+), 15 deletions(-) create mode 100644 Solver_interface/doc/Solver_interface/CGAL/Internal_vcm_traits.h diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h index 0ef89e9cbbf..9831893a6ec 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h @@ -9,7 +9,9 @@ The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available o \cgalModels `VCMTraits` -`T`: floating type +`FT`: floating type + +`dim`: dimension of the matrices and vectors \sa http://eigen.tuxfamily.org @@ -21,25 +23,26 @@ Example -template +template class Eigen_vcm_traits{ public: static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues); - + const cpp11::array& cov, + cpp11::array& eigenvalues); + static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues, - cpp11::array& eigenvectors); - + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors); + static bool extract_largest_eigenvector_of_covariance_matrix ( - const cpp11::array& cov, - cpp11::array &normal); + const cpp11::array& cov, + cpp11::array &normal); + }; diff --git a/Solver_interface/doc/Solver_interface/CGAL/Internal_vcm_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Internal_vcm_traits.h new file mode 100644 index 00000000000..0af6d0bbcae --- /dev/null +++ b/Solver_interface/doc/Solver_interface/CGAL/Internal_vcm_traits.h @@ -0,0 +1,46 @@ +namespace CGAL { + +/*! +\ingroup PkgSolver + +The class `Internal_vcm_traits` provides an internal implementation for the diagonalization of Variance-Covariance Matrices. + +\cgalModels `VCMTraits` + + +`FT`: floating type + +`dim`: dimension of the matrices and vectors + +Example +-------------- + +*/ + + + +template +class Internal_vcm_traits{ + +public: + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues); + + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors); + + static bool + extract_largest_eigenvector_of_covariance_matrix ( + const cpp11::array& cov, + cpp11::array &normal); + + +}; + +} // namespace CGAL + diff --git a/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h b/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h index b2e30246aaf..1247f669a9a 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h @@ -12,6 +12,7 @@ covariance matrices represented by an array `a` as follows: \cgalHasModel `CGAL::Eigen_vcm_traits` */ +template class VCMTraits { public: @@ -20,15 +21,27 @@ public: /// \return `true` if the operation was successful and `false` otherwise. static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues); + const cpp11::array& cov, + cpp11::array& eigenvalues); + + /// fill `eigenvalues` with the eigenvalues and `eigenvectors` with + /// the eigenvectors of the covariance matrix represented by `cov`. + /// Eigenvalues are sorted by increasing order. + /// \return `true` if the operation was successful and `false` + /// otherwise. + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors); + /// Extract the eigenvector associated to the largest eigenvalue /// of the covariance matrix represented by `cov`. /// \return `true` if the operation was successful and `false` otherwise. static bool extract_largest_eigenvector_of_covariance_matrix ( - const cpp11::array& cov, - cpp11::array &normal); + const cpp11::array& cov, + cpp11::array &normal); }; From 4737c1169be5668b75a29b0f2e9392a5836f0548 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 25 Aug 2015 16:16:09 +0200 Subject: [PATCH 29/61] Replace template name "degree" by "dim" --- .../include/CGAL/Eigen_vcm_traits.h | 38 +++++++++---------- .../include/CGAL/Internal_vcm_traits.h | 26 ++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Solver_interface/include/CGAL/Eigen_vcm_traits.h b/Solver_interface/include/CGAL/Eigen_vcm_traits.h index 7ab5bc1627a..edc7de0d763 100644 --- a/Solver_interface/include/CGAL/Eigen_vcm_traits.h +++ b/Solver_interface/include/CGAL/Eigen_vcm_traits.h @@ -31,22 +31,22 @@ namespace CGAL { /// A model of the concept `VCMTraits` using \ref thirdpartyEigen. /// \cgalModels `VCMTraits` -template +template class Eigen_vcm_traits{ - typedef Eigen::Matrix Matrix; - typedef Eigen::Matrix Vector; + typedef Eigen::Matrix Matrix; + typedef Eigen::Matrix Vector; // Construct the covariance matrix static Matrix construct_covariance_matrix - (const cpp11::array& cov) { + (const cpp11::array& cov) { Matrix m; - for (std::size_t i = 0; i < degree; ++ i) - for (std::size_t j = i; j < degree; ++ j) + for (std::size_t i = 0; i < dim; ++ i) + for (std::size_t j = i; j < dim; ++ j) { - m(i,j) = static_cast(cov[(degree * i) + j - ((i * (i+1)) / 2)]); + m(i,j) = static_cast(cov[(dim * i) + j - ((i * (i+1)) / 2)]); if (i != j) m(j,i) = m(i,j); } @@ -74,8 +74,8 @@ class Eigen_vcm_traits{ public: static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues) + const cpp11::array& cov, + cpp11::array& eigenvalues) { Matrix m = construct_covariance_matrix(cov); @@ -86,7 +86,7 @@ public: if (res) { - for (std::size_t i = 0; i < degree; ++ i) + for (std::size_t i = 0; i < dim; ++ i) eigenvalues[i] = static_cast(eigenvalues_[i]); } @@ -95,9 +95,9 @@ public: static bool diagonalize_selfadjoint_covariance_matrix( - const cpp11::array& cov, - cpp11::array& eigenvalues, - cpp11::array& eigenvectors) + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors) { Matrix m = construct_covariance_matrix(cov); @@ -108,12 +108,12 @@ public: if (res) { - for (std::size_t i = 0; i < degree; ++ i) + for (std::size_t i = 0; i < dim; ++ i) { eigenvalues[i] = static_cast(eigenvalues_[i]); - for (std::size_t j = 0; j < degree; ++ j) - eigenvectors[degree*i + j]=static_cast(eigenvectors_(j,i)); + for (std::size_t j = 0; j < dim; ++ j) + eigenvectors[dim*i + j]=static_cast(eigenvectors_(j,i)); } } @@ -123,8 +123,8 @@ public: // Extract the eigenvector associated to the largest eigenvalue static bool extract_largest_eigenvector_of_covariance_matrix ( - const cpp11::array& cov, - cpp11::array &normal) + const cpp11::array& cov, + cpp11::array &normal) { // Construct covariance matrix Matrix m = construct_covariance_matrix(cov); @@ -137,7 +137,7 @@ public: } // Eigenvalues are already sorted by increasing order - for (unsigned int i = 0; i < degree; ++ i) + for (unsigned int i = 0; i < dim; ++ i) normal[i] = static_cast (eigenvectors(i,0)); return true; diff --git a/Solver_interface/include/CGAL/Internal_vcm_traits.h b/Solver_interface/include/CGAL/Internal_vcm_traits.h index 11ce707175b..57f3bc10735 100644 --- a/Solver_interface/include/CGAL/Internal_vcm_traits.h +++ b/Solver_interface/include/CGAL/Internal_vcm_traits.h @@ -8,42 +8,42 @@ namespace CGAL { /// A model of the concept `VCMTraits` /// \cgalModels `VCMTraits` -template +template class Internal_vcm_traits{ public: static bool diagonalize_selfadjoint_covariance_matrix - (const cpp11::array& cov, - cpp11::array& eigenvalues) + (const cpp11::array& cov, + cpp11::array& eigenvalues) { - cpp11::array eigenvectors; + cpp11::array eigenvectors; return diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); } // Extract the eigenvector associated to the largest eigenvalue static bool extract_largest_eigenvector_of_covariance_matrix - (const cpp11::array& cov, - cpp11::array &normal) + (const cpp11::array& cov, + cpp11::array &normal) { - cpp11::array eigenvalues; - cpp11::array eigenvectors; + cpp11::array eigenvalues; + cpp11::array eigenvectors; diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); - for (std::size_t i = 0; i < degree; ++ i) + for (std::size_t i = 0; i < dim; ++ i) normal[i] = static_cast (eigenvectors(i)); return true; } static bool diagonalize_selfadjoint_covariance_matrix - (const cpp11::array& mat, - cpp11::array& eigen_values, - cpp11::array& eigen_vectors) + (const cpp11::array& mat, + cpp11::array& eigen_values, + cpp11::array& eigen_vectors) { - const int n = degree; + const int n = dim; const int MAX_ITER = 100; static const FT EPSILON = (FT)0.00001; From 7ed34cd138dcdbd61004a3c66f14db2acca9a75a Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 25 Aug 2015 17:33:24 +0200 Subject: [PATCH 30/61] Propagating change of API from eigen_symmetric to new Internal_vcm_traits to PCA 2D functions. --- .../CGAL/linear_least_squares_fitting_2.h | 39 ++++++++++++---- .../linear_least_squares_fitting_circles_2.h | 46 +++++++++++-------- .../linear_least_squares_fitting_points_2.h | 34 +++++++++----- ...inear_least_squares_fitting_rectangles_2.h | 36 +++++++++------ .../linear_least_squares_fitting_segments_2.h | 27 ++++++----- ...linear_least_squares_fitting_triangles_2.h | 37 +++++++++------ ..._linear_least_squares_fitting_points_2.cpp | 23 ++++++++-- 7 files changed, 159 insertions(+), 83 deletions(-) diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h index 3ef8b8ca794..c2cdea69c5c 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h @@ -29,6 +29,11 @@ #include #include #include +#include + +#ifdef CGAL_EIGEN3_ENABLED +#include +#endif #include @@ -36,7 +41,8 @@ namespace CGAL { template < typename InputIterator, typename Kernel, - typename Tag> + typename Tag, + typename Vcm_traits> inline typename Kernel::FT linear_least_squares_fitting_2(InputIterator first, @@ -44,35 +50,44 @@ linear_least_squares_fitting_2(InputIterator first, typename Kernel::Line_2& line, typename Kernel::Point_2& centroid, const Tag& tag, - const Kernel& kernel) + const Kernel& kernel, + const Vcm_traits vcm_traits) { typedef typename std::iterator_traits::value_type Value_type; return internal::linear_least_squares_fitting_2(first, beyond, line, - centroid,(Value_type*)NULL,kernel,tag); + centroid,(Value_type*)NULL,kernel,tag, + vcm_traits); } // deduces the kernel from the points in container. +// Use default Vcm_traits template < typename InputIterator, typename Line, typename Point, - typename Tag> + typename Tag> inline typename Kernel_traits::Kernel::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, Line& line, Point& centroid, - const Tag& tag) + const Tag& tag) { typedef typename std::iterator_traits::value_type Value_type; typedef typename Kernel_traits::Kernel Kernel; - return CGAL::linear_least_squares_fitting_2(first,beyond,line,centroid,tag,Kernel()); + return CGAL::linear_least_squares_fitting_2 + (first,beyond,line,centroid,tag,Kernel(), +#ifdef CGAL_EIGEN3_ENABLED + Eigen_vcm_traits() +#else + Internal_vcm_traits() +#endif + ); } - template < typename InputIterator, typename Line, - typename Tag > + typename Tag> inline typename Kernel_traits::Kernel::FT linear_least_squares_fitting_2(InputIterator first, @@ -83,7 +98,13 @@ linear_least_squares_fitting_2(InputIterator first, typedef typename std::iterator_traits::value_type Value_type; typedef typename Kernel_traits::Kernel Kernel; typename Kernel::Point_2 centroid; // unused - return CGAL::linear_least_squares_fitting_2(first,beyond,line,centroid,tag,Kernel()); + return CGAL::linear_least_squares_fitting_2(first,beyond,line,centroid,tag,Kernel(), +#ifdef CGAL_EIGEN3_ENABLED + Eigen_vcm_traits() +#else + Internal_vcm_traits() +#endif + ); } diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h index dd9bc675e70..126e861f569 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h @@ -40,7 +40,7 @@ namespace internal { // 0 is worst (isotropic case, returns a line with horizontal // direction by default) -template < typename InputIterator, typename K > +template < typename InputIterator, typename K, typename Vcm_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -48,7 +48,8 @@ linear_least_squares_fitting_2(InputIterator first, typename K::Point_2& c, // centroid const typename K::Circle_2*,// used for indirection const K&, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits&) { // types typedef typename K::FT FT; @@ -67,11 +68,11 @@ linear_least_squares_fitting_2(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 + // 0 1 + // 2 //Final combined covariance matrix for all circles and their combined mass FT mass = 0.0; - FT covariance[3] = {0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0. }}; // assemble 2nd order moment about the origin. FT temp[4] = {0.25, 0.0, @@ -125,11 +126,13 @@ linear_least_squares_fitting_2(InputIterator first, std::pair eigen_values; std::pair eigen_vectors; // internal::eigen_symmetric_2(final_cov, eigen_vectors, eigen_values); - FT eigen_vectors1[4]; - FT eigen_values1[2]; - eigen_symmetric(covariance,2, eigen_vectors1, eigen_values1); - eigen_values = std::make_pair(eigen_values1[0],eigen_values1[1]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[0],eigen_vectors1[1]),Vector(eigen_vectors1[2],eigen_vectors1[3])); + CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + Vcm_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values1, eigen_vectors1); + + eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); + eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly if(eigen_values.first != eigen_values.second) { @@ -148,7 +151,7 @@ linear_least_squares_fitting_2(InputIterator first, } // end linear_least_squares_fitting_2 for circle set with 2D tag -template < typename InputIterator, typename K > +template < typename InputIterator, typename K, typename Vcm_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -156,7 +159,8 @@ linear_least_squares_fitting_2(InputIterator first, typename K::Point_2& c, // centroid const typename K::Circle_2*,// used for indirection const K&, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& ) { // types typedef typename K::FT FT; @@ -174,11 +178,11 @@ linear_least_squares_fitting_2(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 + // 0 1 + // 2 //Final combined covariance matrix for all circles and their combined mass FT mass = 0.0; - FT covariance[3] = {0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0. }}; // assemble 2nd order moment about the origin. FT temp[4] = {1.0, 0.0, @@ -231,11 +235,13 @@ linear_least_squares_fitting_2(InputIterator first, std::pair eigen_values; std::pair eigen_vectors; // internal::eigen_symmetric_2(final_cov, eigen_vectors, eigen_values); - FT eigen_vectors1[4]; - FT eigen_values1[2]; - eigen_symmetric(covariance,2, eigen_vectors1, eigen_values1); - eigen_values = std::make_pair(eigen_values1[0],eigen_values1[1]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[0],eigen_vectors1[1]),Vector(eigen_vectors1[2],eigen_vectors1[3])); + CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + Vcm_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values1, eigen_vectors1); + + eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); + eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly if(eigen_values.first != eigen_values.second) { diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h index 7d1d6a9036e..4b43217ce11 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h @@ -23,6 +23,11 @@ #include #include #include +#include + +#ifdef CGAL_EIGEN3_ENABLED +#include +#endif #include #include @@ -37,7 +42,8 @@ namespace internal { // 0 is worst (isotropic case, returns a line with horizontal // direction by default). template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits> typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -45,7 +51,8 @@ linear_least_squares_fitting_2(InputIterator first, typename K::Point_2& c, // centroid const typename K::Point_2*,// used for indirection const K&, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits&) { // types typedef typename K::FT FT; @@ -63,9 +70,11 @@ linear_least_squares_fitting_2(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - FT covariance[3] = {0,0,0}; + // 0 1 + // 2 + + CGAL::cpp11::array covariance = {{ 0., 0., 0. }}; + for(InputIterator it = first; it != beyond; it++) @@ -78,18 +87,19 @@ linear_least_squares_fitting_2(InputIterator first, } // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - std::pair eigen_values; - std::pair eigen_vectors; - internal::eigen_symmetric_2(covariance, eigen_vectors, eigen_values); + CGAL::cpp11::array eigen_values = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; + Vcm_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values, eigen_vectors); // check unicity and build fitting line accordingly - if(eigen_values.first != eigen_values.second) + if(eigen_values[0] != eigen_values[1]) { // regular case - line = Line(c, eigen_vectors.first); - return (FT)1.0 - eigen_values.second / eigen_values.first; + line = Line(c, Vector (eigen_vectors[2], eigen_vectors[3])); + return (FT)1.0 - eigen_values[0] / eigen_values[1]; } else { diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h index a1879152bf7..2fdeadc0a8f 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h @@ -40,7 +40,7 @@ namespace internal { // 0 is worst (isotropic case, returns a line with horizontal // direction by default) -template < typename InputIterator, typename K > +template < typename InputIterator, typename K, typename Vcm_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -48,7 +48,8 @@ linear_least_squares_fitting_2(InputIterator first, typename K::Point_2& c, // centroid const typename K::Iso_rectangle_2*,// used for indirection const K&, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits&) { // types typedef typename K::FT FT; @@ -70,7 +71,7 @@ linear_least_squares_fitting_2(InputIterator first, // 1 2 //Final combined covariance matrix for all rectangles and their combined mass FT mass = 0.0; - FT covariance[3] = {0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0. }}; // assemble 2nd order moment about the origin. FT temp[4] = {1/3.0, 0.25, @@ -127,11 +128,13 @@ linear_least_squares_fitting_2(InputIterator first, // eigen vectors are sorted in accordance. std::pair eigen_values; std::pair eigen_vectors; - FT eigen_vectors1[4]; - FT eigen_values1[2]; - eigen_symmetric(covariance,2, eigen_vectors1, eigen_values1); - eigen_values = std::make_pair(eigen_values1[0],eigen_values1[1]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[0],eigen_vectors1[1]),Vector(eigen_vectors1[2],eigen_vectors1[3])); + CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + Vcm_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values1, eigen_vectors1); + + eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); + eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly if(eigen_values.first != eigen_values.second) @@ -150,7 +153,7 @@ linear_least_squares_fitting_2(InputIterator first, } } // end linear_least_squares_fitting_2 for rectangle set with 2D tag -template < typename InputIterator, typename K > +template < typename InputIterator, typename K, typename Vcm_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -158,7 +161,8 @@ linear_least_squares_fitting_2(InputIterator first, typename K::Point_2& c, // centroid const typename K::Iso_rectangle_2*,// used for indirection const K&, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { // types typedef typename K::Iso_rectangle_2 Iso_rectangle; @@ -179,13 +183,15 @@ linear_least_squares_fitting_2(InputIterator first, segments.push_back(Segment_2(t[3],t[0])); } - return linear_least_squares_fitting_2(segments.begin(),segments.end(),line,c,K(),tag); + return linear_least_squares_fitting_2(segments.begin(),segments.end(),line,c,K(),tag, + vcm_traits); } // end linear_least_squares_fitting_2 for rectangle set with 1D tag template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -193,7 +199,8 @@ linear_least_squares_fitting_2(InputIterator first, typename K::Point_2& c, // centroid const typename K::Iso_rectangle_2*,// used for indirection const K&, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { // types typedef typename K::Iso_rectangle_2 Iso_rectangle; @@ -214,7 +221,8 @@ linear_least_squares_fitting_2(InputIterator first, points.push_back(Point_2(t[3])); } - return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,K(),tag); + return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,K(),tag, + vcm_traits); } // end linear_least_squares_fitting_2 for rectangle set with 0D tag diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h index e2c3029b4df..0c72fd92edf 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h @@ -40,7 +40,7 @@ namespace internal { // 0 is worst (isotropic case, returns a line with horizontal // direction by default) -template < typename InputIterator, typename K > +template < typename InputIterator, typename K, typename Vcm_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -48,7 +48,8 @@ linear_least_squares_fitting_2(InputIterator first, typename K::Point_2& c, // centroid const typename K::Segment_2*,// used for indirection const K&, // kernel - const CGAL::Dimension_tag<1>& tag = CGAL::Dimension_tag<1>()) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits&) { // types typedef typename K::FT FT; @@ -69,7 +70,7 @@ linear_least_squares_fitting_2(InputIterator first, // 1 2 //Final combined covariance matrix for all segments and their combined mass FT mass = 0.0; - FT covariance[3] = {0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0. }}; // assemble 2nd order moment about the origin. FT temp[4] = {1.0, 0.5, 0.5, 1.0}; @@ -116,11 +117,13 @@ linear_least_squares_fitting_2(InputIterator first, std::pair eigen_values; std::pair eigen_vectors; // internal::eigen_symmetric_2(covariance, eigen_vectors, eigen_values); - FT eigen_vectors1[4]; - FT eigen_values1[2]; - eigen_symmetric(covariance,2, eigen_vectors1, eigen_values1); - eigen_values = std::make_pair(eigen_values1[0],eigen_values1[1]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[0],eigen_vectors1[1]),Vector(eigen_vectors1[2],eigen_vectors1[3])); + CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + Vcm_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values1, eigen_vectors1); + + eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); + eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly if(eigen_values.first != eigen_values.second) { @@ -138,7 +141,7 @@ linear_least_squares_fitting_2(InputIterator first, } } // end linear_least_squares_fitting_2 for segment set with 1D tag -template < typename InputIterator, typename K > +template < typename InputIterator, typename K, typename Vcm_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -146,7 +149,8 @@ linear_least_squares_fitting_2(InputIterator first, typename K::Point_2& c, // centroid const typename K::Segment_2*,// used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { // types typedef typename K::Point_2 Point; @@ -164,7 +168,8 @@ linear_least_squares_fitting_2(InputIterator first, points.push_back(s[0]); points.push_back(s[1]); } - return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,k,(Point*)NULL,tag); + return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,k,(Point*)NULL,tag, + vcm_traits); } // end linear_least_squares_fitting_2 for segment set with 1D tag diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h index 7bd3d777d9d..b6529c8fa76 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h @@ -41,7 +41,7 @@ namespace internal { // direction by default) template < typename InputIterator, - typename Kernel > + typename Kernel, typename Vcm_traits > typename Kernel::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -49,7 +49,8 @@ linear_least_squares_fitting_2(InputIterator first, typename Kernel::Point_2& c, // centroid const typename Kernel::Triangle_2*,// used for indirection const Kernel&, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits&) { // types typedef typename Kernel::FT FT; @@ -71,7 +72,7 @@ linear_least_squares_fitting_2(InputIterator first, // 1 2 //Final combined covariance matrix for all triangles and their combined mass FT mass = 0.0; - FT covariance[3] = {0.0, 0.0, 0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0. }}; // assemble the 2nd order moment about the origin. FT temp[4] = {1/12.0, 1/24.0, @@ -127,11 +128,13 @@ linear_least_squares_fitting_2(InputIterator first, // eigen vectors are sorted in accordance. std::pair eigen_values; std::pair eigen_vectors; - FT eigen_vectors1[4]; - FT eigen_values1[2]; - eigen_symmetric(covariance,2, eigen_vectors1, eigen_values1); - eigen_values = std::make_pair(eigen_values1[0],eigen_values1[1]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[0],eigen_vectors1[1]),Vector(eigen_vectors1[2],eigen_vectors1[3])); + CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + Vcm_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values1, eigen_vectors1); + + eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); + eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly if(eigen_values.first != eigen_values.second) { @@ -150,7 +153,8 @@ linear_least_squares_fitting_2(InputIterator first, } // end linear_least_squares_fitting_2 for triangle set with 2D tag template < typename InputIterator, - typename Kernel > + typename Kernel, + typename Vcm_traits > typename Kernel::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -158,7 +162,8 @@ linear_least_squares_fitting_2(InputIterator first, typename Kernel::Point_2& c, // centroid const typename Kernel::Triangle_2*,// used for indirection const Kernel&, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { // types typedef typename Kernel::Triangle_2 Triangle; @@ -178,12 +183,14 @@ linear_least_squares_fitting_2(InputIterator first, segments.push_back(Segment(t[2],t[0])); } - return linear_least_squares_fitting_2(segments.begin(),segments.end(),line,c,tag,Kernel()); + return linear_least_squares_fitting_2(segments.begin(),segments.end(),line,c,tag,Kernel(), + vcm_traits); } // end linear_least_squares_fitting_2 for triangle set with 1D tag template < typename InputIterator, - typename Kernel > + typename Kernel, + typename Vcm_traits > typename Kernel::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -191,7 +198,8 @@ linear_least_squares_fitting_2(InputIterator first, typename Kernel::Point_2& c, // centroid const typename Kernel::Triangle_2*,// used for indirection const Kernel&, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { // types @@ -212,7 +220,8 @@ linear_least_squares_fitting_2(InputIterator first, points.push_back(Point(t[2])); } - return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,tag,Kernel()); + return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,tag,Kernel(), + vcm_traits); } // end linear_least_squares_fitting_2 for triangle set with 0D tag diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp index 429a97a236a..86bc9a4327d 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp @@ -3,6 +3,11 @@ #include #include #include +#include + +#ifdef CGAL_EIGEN3_ENABLED +#include +#endif #include #include @@ -31,7 +36,14 @@ void test_2D() FT quality; quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); - quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k); + quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() +#endif + ); + std::cout << "done (quality: " << quality << ")" << std::endl; if(!line.is_horizontal()) @@ -71,8 +83,13 @@ void test_2D_point_set(const unsigned int nb_points) FT quality; quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); - quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k); - + quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() +#endif + ); std::cout << "done (quality: " << quality << ")" << std::endl; if(!line.is_horizontal()) From 1328261e6088d11a0125a3c0c24eb1480057057e Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 11:21:53 +0200 Subject: [PATCH 31/61] Propagating change of API from eigen_symmetric to new Internal_vcm_traits to PCA 3D functions. --- .../include/CGAL/PCA_util.h | 176 +++++++++--------- .../CGAL/linear_least_squares_fitting_3.h | 44 +++-- .../linear_least_squares_fitting_cuboids_3.h | 77 +++++--- .../linear_least_squares_fitting_points_3.h | 21 ++- .../linear_least_squares_fitting_segments_3.h | 38 ++-- .../linear_least_squares_fitting_spheres_3.h | 40 ++-- ...inear_least_squares_fitting_tetrahedra_3.h | 74 +++++--- ...linear_least_squares_fitting_triangles_3.h | 56 ++++-- ..._linear_least_squares_fitting_points_3.cpp | 22 ++- ...inear_least_squares_fitting_segments_3.cpp | 22 ++- ...linear_least_squares_fitting_spheres_3.cpp | 19 +- 11 files changed, 371 insertions(+), 218 deletions(-) diff --git a/Principal_component_analysis/include/CGAL/PCA_util.h b/Principal_component_analysis/include/CGAL/PCA_util.h index 5a4b3b5e0ee..f26e69bf28f 100644 --- a/Principal_component_analysis/include/CGAL/PCA_util.h +++ b/Principal_component_analysis/include/CGAL/PCA_util.h @@ -52,7 +52,7 @@ template < typename InputIterator, void assemble_covariance_matrix_3(InputIterator first, InputIterator beyond, - typename K::FT covariance[6], // covariance matrix + CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid const K& , // kernel const typename K::Point_3*, // used for indirection @@ -63,9 +63,9 @@ assemble_covariance_matrix_3(InputIterator first, typedef typename K::Vector_3 Vector; // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 + // 0 1 2 + // 3 4 + // 5 covariance[0] = covariance[1] = covariance[2] = covariance[3] = covariance[4] = covariance[5] = (FT)0.0; for(InputIterator it = first; @@ -76,8 +76,8 @@ assemble_covariance_matrix_3(InputIterator first, Vector d = p - c; covariance[0] += d.x() * d.x(); covariance[1] += d.x() * d.y(); - covariance[2] += d.y() * d.y(); - covariance[3] += d.x() * d.z(); + covariance[2] += d.x() * d.z(); + covariance[3] += d.y() * d.y(); covariance[4] += d.y() * d.z(); covariance[5] += d.z() * d.z(); } @@ -88,8 +88,8 @@ template < typename InputIterator, typename K > void assemble_covariance_matrix_3(InputIterator first, - InputIterator beyond, - typename K::FT covariance[6], // covariance matrix + InputIterator beyond, + CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid const K&, // kernel const typename K::Triangle_3*,// used for indirection @@ -102,9 +102,9 @@ assemble_covariance_matrix_3(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 + // 0 1 2 + // 3 4 + // 5 //Final combined covariance matrix for all triangles and their combined mass FT mass = 0.0; @@ -141,8 +141,8 @@ assemble_covariance_matrix_3(InputIterator first, // and add to covariance matrix covariance[0] += transformation[0][0]; covariance[1] += transformation[1][0]; - covariance[2] += transformation[1][1]; - covariance[3] += transformation[2][0]; + covariance[2] += transformation[2][0]; + covariance[3] += transformation[1][1]; covariance[4] += transformation[2][1]; covariance[5] += transformation[2][2]; @@ -153,8 +153,8 @@ assemble_covariance_matrix_3(InputIterator first, // the center of mass to get the covariance. covariance[0] += mass * (-1.0 * c.x() * c.x()); covariance[1] += mass * (-1.0 * c.x() * c.y()); - covariance[2] += mass * (-1.0 * c.y() * c.y()); - covariance[3] += mass * (-1.0 * c.z() * c.x()); + covariance[2] += mass * (-1.0 * c.z() * c.x()); + covariance[3] += mass * (-1.0 * c.y() * c.y()); covariance[4] += mass * (-1.0 * c.z() * c.y()); covariance[5] += mass * (-1.0 * c.z() * c.z()); @@ -165,8 +165,8 @@ template < typename InputIterator, typename K > void assemble_covariance_matrix_3(InputIterator first, - InputIterator beyond, - typename K::FT covariance[6], // covariance matrix + InputIterator beyond, + CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid const K& , // kernel const typename K::Iso_cuboid_3*,// used for indirection @@ -179,9 +179,9 @@ assemble_covariance_matrix_3(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 + // 0 1 2 + // 3 4 + // 5 // final combined covariance matrix for all cuboids and their combined mass FT mass = (FT)0.0; @@ -227,8 +227,8 @@ assemble_covariance_matrix_3(InputIterator first, // and add to covariance matrix covariance[0] += transformation[0][0] + volume * (2*x0*xav0 + x0*x0); covariance[1] += transformation[1][0] + volume * (xav0*y0 + yav0*x0 + x0*y0); - covariance[2] += transformation[1][1] + volume * (2*y0*yav0 + y0*y0); - covariance[3] += transformation[2][0] + volume * (x0*zav0 + xav0*z0 + x0*z0); + covariance[2] += transformation[2][0] + volume * (x0*zav0 + xav0*z0 + x0*z0); + covariance[3] += transformation[1][1] + volume * (2*y0*yav0 + y0*y0); covariance[4] += transformation[2][1] + volume * (yav0*z0 + y0*zav0 + z0*y0); covariance[5] += transformation[2][2] + volume * (2*zav0*z0 + z0*z0); @@ -239,8 +239,8 @@ assemble_covariance_matrix_3(InputIterator first, // the center of mass to get the covariance. covariance[0] += mass * (- c.x() * c.x()); covariance[1] += mass * (- c.x() * c.y()); - covariance[2] += mass * (- c.y() * c.y()); - covariance[3] += mass * (- c.z() * c.x()); + covariance[2] += mass * (- c.z() * c.x()); + covariance[3] += mass * (- c.y() * c.y()); covariance[4] += mass * (- c.z() * c.y()); covariance[5] += mass * (- c.z() * c.z()); } @@ -251,7 +251,7 @@ template < typename InputIterator, void assemble_covariance_matrix_3(InputIterator first, InputIterator beyond, - typename K::FT covariance[6], // covariance matrix + CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid const K& , // kernel const typename K::Iso_cuboid_3*,// used for indirection @@ -264,9 +264,9 @@ assemble_covariance_matrix_3(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 + // 0 1 2 + // 3 4 + // 5 //Final combined covariance matrix for all cuboids and their combined mass FT mass = (FT)0.0; @@ -319,8 +319,8 @@ assemble_covariance_matrix_3(InputIterator first, // and add to covariance matrix covariance[0] += transformation[0][0] + area * (2*x0*xav0 + x0*x0); covariance[1] += transformation[1][0] + area * (xav0*y0 + yav0*x0 + x0*y0); - covariance[2] += transformation[1][1] + area * (2*y0*yav0 + y0*y0); - covariance[3] += transformation[2][0] + area * (x0*zav0 + xav0*z0 + x0*z0); + covariance[2] += transformation[2][0] + area * (x0*zav0 + xav0*z0 + x0*z0); + covariance[3] += transformation[1][1] + area * (2*y0*yav0 + y0*y0); covariance[4] += transformation[2][1] + area * (yav0*z0 + y0*zav0 + z0*y0); covariance[5] += transformation[2][2] + area * (2*zav0*z0 + z0*z0); @@ -331,8 +331,8 @@ assemble_covariance_matrix_3(InputIterator first, // the center of mass to get the covariance. covariance[0] += mass * (-1.0 * c.x() * c.x()); covariance[1] += mass * (-1.0 * c.x() * c.y()); - covariance[2] += mass * (-1.0 * c.y() * c.y()); - covariance[3] += mass * (-1.0 * c.z() * c.x()); + covariance[2] += mass * (-1.0 * c.z() * c.x()); + covariance[3] += mass * (-1.0 * c.y() * c.y()); covariance[4] += mass * (-1.0 * c.z() * c.y()); covariance[5] += mass * (-1.0 * c.z() * c.z()); @@ -344,7 +344,7 @@ template < typename InputIterator, void assemble_covariance_matrix_3(InputIterator first, InputIterator beyond, - typename K::FT covariance[6], // covariance matrix + CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid const K&, // kernel const typename K::Sphere_3*, // used for indirection @@ -357,9 +357,9 @@ assemble_covariance_matrix_3(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 + // 0 1 2 + // 3 4 + // 5 //Final combined covariance matrix for all spheres and their combined mass FT mass = 0.0; @@ -402,8 +402,8 @@ assemble_covariance_matrix_3(InputIterator first, // and add to covariance matrix covariance[0] += transformation[0][0] + volume * x0*x0; covariance[1] += transformation[1][0] + volume * x0*y0; - covariance[2] += transformation[1][1] + volume * y0*y0; - covariance[3] += transformation[2][0] + volume * x0*z0; + covariance[2] += transformation[2][0] + volume * x0*z0; + covariance[3] += transformation[1][1] + volume * y0*y0; covariance[4] += transformation[2][1] + volume * z0*y0; covariance[5] += transformation[2][2] + volume * z0*z0; @@ -414,8 +414,8 @@ assemble_covariance_matrix_3(InputIterator first, // the center of mass to get the covariance. covariance[0] += mass * (-1.0 * c.x() * c.x()); covariance[1] += mass * (-1.0 * c.x() * c.y()); - covariance[2] += mass * (-1.0 * c.y() * c.y()); - covariance[3] += mass * (-1.0 * c.z() * c.x()); + covariance[2] += mass * (-1.0 * c.z() * c.x()); + covariance[3] += mass * (-1.0 * c.y() * c.y()); covariance[4] += mass * (-1.0 * c.z() * c.y()); covariance[5] += mass * (-1.0 * c.z() * c.z()); @@ -426,7 +426,7 @@ template < typename InputIterator, void assemble_covariance_matrix_3(InputIterator first, InputIterator beyond, - typename K::FT covariance[6], // covariance matrix + CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid const K&, // kernel const typename K::Sphere_3*, // used for indirection @@ -439,9 +439,9 @@ assemble_covariance_matrix_3(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 + // 0 1 2 + // 3 4 + // 5 //Final combined covariance matrix for all spheres and their combined mass FT mass = 0.0; @@ -485,8 +485,8 @@ assemble_covariance_matrix_3(InputIterator first, // and add to covariance matrix covariance[0] += transformation[0][0] + area * x0*x0; covariance[1] += transformation[1][0] + area * x0*y0; - covariance[2] += transformation[1][1] + area * y0*y0; - covariance[3] += transformation[2][0] + area * x0*z0; + covariance[2] += transformation[2][0] + area * x0*z0; + covariance[3] += transformation[1][1] + area * y0*y0; covariance[4] += transformation[2][1] + area * z0*y0; covariance[5] += transformation[2][2] + area * z0*z0; @@ -497,8 +497,8 @@ assemble_covariance_matrix_3(InputIterator first, // the center of mass to get the covariance. covariance[0] += mass * (-1.0 * c.x() * c.x()); covariance[1] += mass * (-1.0 * c.x() * c.y()); - covariance[2] += mass * (-1.0 * c.y() * c.y()); - covariance[3] += mass * (-1.0 * c.z() * c.x()); + covariance[2] += mass * (-1.0 * c.z() * c.x()); + covariance[3] += mass * (-1.0 * c.y() * c.y()); covariance[4] += mass * (-1.0 * c.z() * c.y()); covariance[5] += mass * (-1.0 * c.z() * c.z()); @@ -510,7 +510,7 @@ template < typename InputIterator, void assemble_covariance_matrix_3(InputIterator first, InputIterator beyond, - typename K::FT covariance[6], // covariance matrix + CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid const K& , // kernel const typename K::Tetrahedron_3*,// used for indirection @@ -523,9 +523,9 @@ assemble_covariance_matrix_3(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 + // 0 1 2 + // 3 4 + // 5 //Final combined covariance matrix for all tetrahedrons and their combined mass FT mass = 0.0; @@ -571,8 +571,8 @@ assemble_covariance_matrix_3(InputIterator first, // and add to covariance matrix covariance[0] += transformation[0][0] + volume * (2*x0*xav0 + x0*x0); covariance[1] += transformation[1][0] + volume * (xav0*y0 + yav0*x0 + x0*y0); - covariance[2] += transformation[1][1] + volume * (2*y0*yav0 + y0*y0); - covariance[3] += transformation[2][0] + volume * (x0*zav0 + xav0*z0 + x0*z0); + covariance[2] += transformation[2][0] + volume * (x0*zav0 + xav0*z0 + x0*z0); + covariance[3] += transformation[1][1] + volume * (2*y0*yav0 + y0*y0); covariance[4] += transformation[2][1] + volume * (yav0*z0 + y0*zav0 + z0*y0); covariance[5] += transformation[2][2] + volume * (2*zav0*z0 + z0*z0); @@ -583,8 +583,8 @@ assemble_covariance_matrix_3(InputIterator first, // the center of mass to get the covariance. covariance[0] += mass * (-1.0 * c.x() * c.x()); covariance[1] += mass * (-1.0 * c.x() * c.y()); - covariance[2] += mass * (-1.0 * c.y() * c.y()); - covariance[3] += mass * (-1.0 * c.z() * c.x()); + covariance[2] += mass * (-1.0 * c.z() * c.x()); + covariance[3] += mass * (-1.0 * c.y() * c.y()); covariance[4] += mass * (-1.0 * c.z() * c.y()); covariance[5] += mass * (-1.0 * c.z() * c.z()); } @@ -595,7 +595,7 @@ template < typename InputIterator, void assemble_covariance_matrix_3(InputIterator first, InputIterator beyond, - typename K::FT covariance[6], // covariance matrix + CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid const K& , // kernel const typename K::Segment_3*,// used for indirection @@ -608,9 +608,9 @@ assemble_covariance_matrix_3(InputIterator first, // assemble covariance matrix as a semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 + // 0 1 2 + // 3 4 + // 5 //Final combined covariance matrix for all segments and their combined mass FT mass = 0.0; @@ -648,8 +648,8 @@ assemble_covariance_matrix_3(InputIterator first, // and add to covariance matrix covariance[0] += transformation[0][0]; covariance[1] += transformation[1][0]; - covariance[2] += transformation[1][1]; - covariance[3] += transformation[2][0]; + covariance[2] += transformation[2][0]; + covariance[3] += transformation[1][1]; covariance[4] += transformation[2][1]; covariance[5] += transformation[2][2]; @@ -660,8 +660,8 @@ assemble_covariance_matrix_3(InputIterator first, // the center of mass to get the covariance. covariance[0] += mass * (-1.0 * c.x() * c.x()); covariance[1] += mass * (-1.0 * c.x() * c.y()); - covariance[2] += mass * (-1.0 * c.y() * c.y()); - covariance[3] += mass * (-1.0 * c.z() * c.x()); + covariance[2] += mass * (-1.0 * c.z() * c.x()); + covariance[3] += mass * (-1.0 * c.y() * c.y()); covariance[4] += mass * (-1.0 * c.z() * c.y()); covariance[5] += mass * (-1.0 * c.z() * c.z()); @@ -671,23 +671,27 @@ assemble_covariance_matrix_3(InputIterator first, // compute the eigen values and vectors of the covariance // matrix and deduces the best linear fitting plane. // returns fitting quality -template < typename K > +template < typename K, typename Vcm_traits > typename K::FT -fitting_plane_3(const typename K::FT covariance[6], // covariance matrix +fitting_plane_3(CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid typename K::Plane_3& plane, // best fit plane - const K& ) // kernel + const K&, // kernel + const Vcm_traits& ) // Vcm traits { typedef typename K::FT FT; typedef typename K::Plane_3 Plane; typedef typename K::Vector_3 Vector; // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - FT eigen_values[3]; - FT eigen_vectors[9]; - eigen_symmetric(covariance,3,eigen_vectors,eigen_values); + CGAL::cpp11::array eigen_values = {{ 0. , 0., 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0., + 0., 0., 0., + 0., 0., 0. }}; + Vcm_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values, eigen_vectors); // degenerate case if(eigen_values[0] == eigen_values[1] && @@ -700,11 +704,11 @@ fitting_plane_3(const typename K::FT covariance[6], // covariance matrix } else // regular and line case { - Vector normal(eigen_vectors[6], - eigen_vectors[7], - eigen_vectors[8]); + Vector normal(eigen_vectors[0], + eigen_vectors[1], + eigen_vectors[2]); plane = Plane(c,normal); - return FT(1) - eigen_values[2] / eigen_values[1]; + return FT(1) - eigen_values[0] / eigen_values[1]; } // end regular case } @@ -712,23 +716,27 @@ fitting_plane_3(const typename K::FT covariance[6], // covariance matrix // matrix and deduces the best linear fitting line // (this is an internal function) // returns fitting quality -template < typename K > +template < typename K, typename Vcm_traits > typename K::FT -fitting_line_3(const typename K::FT covariance[6], // covariance matrix +fitting_line_3(CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid typename K::Line_3& line, // best fit line - const K&) // kernel + const K&, // kernel + const Vcm_traits& ) // Vcm traits { typedef typename K::FT FT; typedef typename K::Line_3 Line; typedef typename K::Vector_3 Vector; // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - FT eigen_values[3]; - FT eigen_vectors[9]; - eigen_symmetric(covariance,3,eigen_vectors,eigen_values); + CGAL::cpp11::array eigen_values = {{ 0. , 0., 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0., + 0., 0., 0., + 0., 0., 0. }}; + Vcm_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values, eigen_vectors); // isotropic case (infinite number of directions) if(eigen_values[0] == eigen_values[1] && @@ -742,9 +750,9 @@ fitting_line_3(const typename K::FT covariance[6], // covariance matrix else { // regular case - Vector direction(eigen_vectors[0],eigen_vectors[1],eigen_vectors[2]); + Vector direction(eigen_vectors[6],eigen_vectors[7],eigen_vectors[8]); line = Line(c,direction); - return (FT)1.0 - eigen_values[1] / eigen_values[0]; + return (FT)1.0 - eigen_values[1] / eigen_values[2]; } } diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h index 553fb285900..b842bfc2b68 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h @@ -21,8 +21,6 @@ #define CGAL_LINEAR_LEAST_SQUARES_FITTING_3_H #include -//#include -//#include #include #include @@ -31,6 +29,11 @@ #include #include +#include +#ifdef CGAL_EIGEN3_ENABLED +#include +#endif + #include #include @@ -42,7 +45,8 @@ namespace CGAL { template < typename InputIterator, typename Object, typename Kernel, - typename Tag > + typename Tag, + typename Vcm_traits > inline typename Kernel::FT linear_least_squares_fitting_3(InputIterator first, @@ -50,32 +54,43 @@ linear_least_squares_fitting_3(InputIterator first, Object& object, // plane or line typename Kernel::Point_3& centroid, const Tag& tag, // dimension tag, ranges from 0 to 3 - const Kernel& kernel) + const Kernel& kernel, + const Vcm_traits vcm_traits) { typedef typename std::iterator_traits::value_type Value_type; return internal::linear_least_squares_fitting_3(first, beyond, object, - centroid, (Value_type*) NULL, kernel, tag); + centroid, (Value_type*) NULL, kernel, tag, + vcm_traits); } // deduces kernel from value type of input iterator +// use default Vcm_traits template < typename InputIterator, typename Object, - typename Point, - typename Tag> + typename Point, + typename Tag > inline typename Kernel_traits::Kernel::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, Object& object, // plane or line Point& centroid, - const Tag& tag) // dimension tag, ranges from 0 to 3 + const Tag& tag) // dimension tag, ranges from 0 to 3 { typedef typename std::iterator_traits::value_type Value_type; typedef typename Kernel_traits::Kernel Kernel; - return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag,Kernel()); + return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag,Kernel(), +#ifdef CGAL_EIGEN3_ENABLED + Eigen_vcm_traits() +#else + Internal_vcm_traits() +#endif + ); + } // deduces kernel and does not write centroid +// use default Vcm_traits template < typename InputIterator, typename Object, typename Tag> @@ -84,12 +99,19 @@ typename Kernel_traits::Kernel::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, Object& object, // plane or line - const Tag& tag) // dimension tag, ranges from 0 to 3 + const Tag& tag) // dimension tag, ranges from 0 to 3 { typedef typename std::iterator_traits::value_type Value_type; typedef typename Kernel_traits::Kernel Kernel; typename Kernel::Point_3 centroid; // not used by caller - return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag); + return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag,Kernel(), +#ifdef CGAL_EIGEN3_ENABLED + Eigen_vcm_traits() +#else + Internal_vcm_traits() +#endif + ); + } } //namespace CGAL diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h index 4bfcbdf601c..b34af34f114 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -36,7 +35,8 @@ namespace internal { // fits a plane to a 3D cuboid set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -44,7 +44,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<3>& tag) + const CGAL::Dimension_tag<3>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -56,18 +57,19 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,k,tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Iso_cuboid*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k); + return fitting_plane_3(covariance,c,plane,k,vcm_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a plane to a 3D cuboid set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -75,7 +77,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -87,18 +90,19 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,k,tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Iso_cuboid*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k); + return fitting_plane_3(covariance,c,plane,k,vcm_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a plane to a 3D cuboid set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -106,7 +110,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Segment_3 Segment; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -135,13 +140,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag); + return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a plane to a 3D cuboid set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -149,7 +156,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Point_3 Point; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -174,13 +182,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag); + return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a line to a 3D cuboid set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -188,7 +198,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<3>& tag) + const CGAL::Dimension_tag<3>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -200,17 +211,18 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,k,tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Iso_cuboid*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k); + return fitting_line_3(covariance,c,line,k,vcm_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a line to a 3D cuboid set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -218,7 +230,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -230,18 +243,19 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,k,tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Iso_cuboid*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k); + return fitting_line_3(covariance,c,line,k,vcm_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a line to a 3D cuboid set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -249,7 +263,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Segment_3 Segment; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -278,13 +293,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting line - return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag); + return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a line to a 3D cuboid set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -292,7 +309,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Point_3 Point; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -317,7 +335,8 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting line - return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag); + return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_cuboids_3 diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_3.h index 15355929e91..ee9603d9cbd 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_3.h @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -35,7 +34,8 @@ namespace internal { // 1 is best (zero variance orthogonally to the fitting line) // 0 is worst (isotropic case, returns a plane with default direction) template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -43,7 +43,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Point_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Point_3 Point; @@ -55,11 +56,11 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6]; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Point*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k); + return fitting_plane_3(covariance,c,plane,k,vcm_traits); } // end fit plane to point set // fits a line to a 3D point set @@ -67,7 +68,8 @@ linear_least_squares_fitting_3(InputIterator first, // 1 is best (zero variance orthogonally to the fitting line) // 0 is worst (isotropic case, returns a line along x axis) template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -75,7 +77,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Point_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Point_3 Point; @@ -87,11 +90,11 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6]; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Point*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k); + return fitting_line_3(covariance,c,line,k,vcm_traits); } // end fit line to point set } // end namespace internal diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h index 1be447a36a9..395fccbd84d 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h @@ -35,7 +35,8 @@ namespace internal { // fits a plane to a 3D segment set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -43,7 +44,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Segment_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Segment_3 Segment; @@ -55,17 +57,18 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,k,tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Segment*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k); + return fitting_plane_3(covariance,c,plane,k,vcm_traits); } // end linear_least_squares_fitting_segments_3 // fits a plane to a 3D segment set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -73,7 +76,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Segment_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Segment_3 Segment; typedef typename K::Point_3 Point; @@ -92,13 +96,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag); + return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_segments_3 // fits a line to a 3D segment set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -106,7 +112,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Segment_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Segment_3 Segment; @@ -118,17 +125,18 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,k,tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Segment*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k); + return fitting_line_3(covariance,c,line,k,vcm_traits); } // end linear_least_squares_fitting_segments_3 // fits a plane to a 3D segment set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -136,7 +144,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Segment_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Segment_3 Segment; typedef typename K::Point_3 Point; @@ -155,7 +164,8 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag); + return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_segments_3 diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h index 1ae42e2957e..1af06f17457 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h @@ -33,7 +33,8 @@ namespace internal { // fits a plane to a set of 3D balls (3D) template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -41,7 +42,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Sphere_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<3>& tag) + const CGAL::Dimension_tag<3>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Sphere_3 Sphere; @@ -53,17 +55,18 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Sphere*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k); + return fitting_plane_3(covariance,c,plane,k,vcm_traits); } // end linear_least_squares_fitting_spheres_3 // fits a plane to a 3D sphere set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -71,7 +74,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Sphere_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Sphere_3 Sphere; @@ -83,18 +87,19 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Sphere*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k); + return fitting_plane_3(covariance,c,plane,k,vcm_traits); } // end linear_least_squares_fitting_spheres_3 // fits a line to a 3D ball set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -102,7 +107,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Sphere_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<3>& tag) + const CGAL::Dimension_tag<3>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Sphere_3 Sphere; @@ -114,18 +120,19 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Sphere*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k); + return fitting_line_3(covariance,c,line,k,vcm_traits); } // end linear_least_squares_fitting_spheres_3 // fits a line to a 3D sphere set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -133,7 +140,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Sphere_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Sphere_3 Sphere; @@ -145,11 +153,11 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Sphere*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k); + return fitting_line_3(covariance,c,line,k,vcm_traits); } // end linear_least_squares_fitting_spheres_3 diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h index c87fcd3a470..67a8c122456 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h @@ -37,7 +37,8 @@ namespace internal { // fits a plane to a 3D tetrahedron set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -45,7 +46,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<3>& tag) + const CGAL::Dimension_tag<3>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Tetrahedron_3 Tetrahedron; @@ -57,16 +59,17 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Tetrahedron*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k); + return fitting_plane_3(covariance,c,plane,k,vcm_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a plane to a 3D tetrahedron set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -74,7 +77,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Triangle_3 Triangle; @@ -95,13 +99,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(triangles.begin(),triangles.end(),plane,c,(Triangle*)NULL,k,tag); + return linear_least_squares_fitting_3(triangles.begin(),triangles.end(),plane,c,(Triangle*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a plane to a 3D tetrahedron set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -109,7 +115,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Segment_3 Segment; @@ -133,13 +140,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag); + return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a plane to a 3D tetrahedron set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -147,7 +156,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Point_3 Point; @@ -168,13 +178,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag); + return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a line to a 3D tetrahedron set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -182,7 +194,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<3>& tag) + const CGAL::Dimension_tag<3>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Tetrahedron_3 Tetrahedron; @@ -194,17 +207,18 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Tetrahedron*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k); + return fitting_line_3(covariance,c,line,k,vcm_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a line to a 3D tetrahedron set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -212,7 +226,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Triangle_3 Triangle; @@ -233,13 +248,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting line - return linear_least_squares_fitting_3(triangles.begin(),triangles.end(),line,c,(Triangle*)NULL,k,tag); + return linear_least_squares_fitting_3(triangles.begin(),triangles.end(),line,c,(Triangle*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a line to a 3D tetrahedron set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -247,7 +264,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Segment_3 Segment; @@ -270,13 +288,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting line - return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag); + return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a line to a 3D tetrahedron set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -284,7 +304,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Point_3 Point; @@ -305,7 +326,8 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting line - return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag); + return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_tetrahedra_3 diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h index aca731b7191..e30a2256144 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h @@ -34,7 +34,8 @@ namespace internal { // fits a plane to a 3D triangle set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -42,7 +43,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Triangle_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Triangle_3 Triangle; @@ -54,17 +56,18 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Triangle*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k); + return fitting_plane_3(covariance,c,plane,k,vcm_traits); } // end linear_least_squares_fitting_triangles_3 // fits a plane to a 3D triangle set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -72,7 +75,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Triangle_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Triangle_3 Triangle; typedef typename K::Segment_3 Segment; @@ -92,13 +96,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag); + return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_triangles_3 // fits a plane to a 3D triangle set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -106,7 +112,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Triangle_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Triangle_3 Triangle; typedef typename K::Point_3 Point; @@ -125,13 +132,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting plane - return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag); + return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_triangles_3 // fits a line to a 3D triangle set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -139,7 +148,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Triangle_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<2>& tag) + const CGAL::Dimension_tag<2>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::FT FT; typedef typename K::Triangle_3 Triangle; @@ -151,17 +161,18 @@ linear_least_squares_fitting_3(InputIterator first, c = centroid(first,beyond,K(),tag); // assemble covariance matrix - FT covariance[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Triangle*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k); + return fitting_line_3(covariance,c,line,k,vcm_traits); } // end linear_least_squares_fitting_triangles_3 // fits a line to a 3D triangle set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -169,7 +180,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Triangle_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<1>& tag) + const CGAL::Dimension_tag<1>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Triangle_3 Triangle; typedef typename K::Segment_3 Segment; @@ -189,13 +201,15 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting line - return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag); + return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_triangles_3 // fits a line to a 3D triangle set template < typename InputIterator, - typename K > + typename K, + typename Vcm_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -203,7 +217,8 @@ linear_least_squares_fitting_3(InputIterator first, typename K::Point_3& c, // centroid const typename K::Triangle_3*, // used for indirection const K& k, // kernel - const CGAL::Dimension_tag<0>& tag) + const CGAL::Dimension_tag<0>& tag, + const Vcm_traits& vcm_traits) { typedef typename K::Triangle_3 Triangle; typedef typename K::Point_3 Point; @@ -222,7 +237,8 @@ linear_least_squares_fitting_3(InputIterator first, } // compute fitting line - return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag); + return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag, + vcm_traits); } // end linear_least_squares_fitting_triangles_3 diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp index 060e5c8e770..f39794f2756 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp @@ -3,6 +3,11 @@ #include #include +#include +#ifdef CGAL_EIGEN3_ENABLED +#include +#endif + #include #include @@ -43,13 +48,26 @@ void fit_point_set(std::list& points, std::cout << "fit 3D line..."; quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); - quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),kernel); + quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),kernel, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() +#endif + ); + std::cout << "done (quality: " << quality << ")" << std::endl; std::cout << "fit 3D plane..."; quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>()); - quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>(),kernel); + quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>(),kernel, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() +#endif + ); std::cout << "done (quality: " << quality << ")" << std::endl; } diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp index 11ee3dda03f..3d774c7e782 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp @@ -5,6 +5,10 @@ #include #include #include +#include +#ifdef CGAL_EIGEN3_ENABLED +#include +#endif #include #include @@ -34,11 +38,25 @@ FT fit_set(std::list& segments, quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>()); - quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>(),kernel); + quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>(),kernel, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() +#endif + ); + quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>()); - quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>(),kernel); + quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>(),kernel, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() +#endif + ); + return quality; } diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp index 0867a9f85e6..2c6eb36230f 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp @@ -34,19 +34,28 @@ int main(void) Kernel kernel; Point centroid; +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits vcm_traits; +#else + CGAL::Internal_vcm_traits vcm_traits; +#endif + linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>()); - linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>(),kernel); - linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>(),kernel); - + linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>(),kernel, + vcm_traits); + linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>(),kernel, + vcm_traits); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>()); - linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>(),kernel); - linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>(),kernel); + linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>(),kernel, + vcm_traits); + linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>(),kernel, + vcm_traits); return 0; } From 792f6bd20377af9114f30c9c9f28f17389a583de Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 11:29:52 +0200 Subject: [PATCH 32/61] Clean old eigen.h API --- Principal_component_analysis/include/CGAL/PCA_util.h | 1 - .../include/CGAL/linear_least_squares_fitting_circles_2.h | 8 ++------ .../CGAL/linear_least_squares_fitting_rectangles_2.h | 4 +--- .../CGAL/linear_least_squares_fitting_segments_2.h | 5 +---- .../CGAL/linear_least_squares_fitting_segments_3.h | 1 - .../include/CGAL/linear_least_squares_fitting_spheres_3.h | 1 - .../CGAL/linear_least_squares_fitting_tetrahedra_3.h | 1 - .../CGAL/linear_least_squares_fitting_triangles_2.h | 4 +--- .../CGAL/linear_least_squares_fitting_triangles_3.h | 1 - 9 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Principal_component_analysis/include/CGAL/PCA_util.h b/Principal_component_analysis/include/CGAL/PCA_util.h index f26e69bf28f..a872bdfff43 100644 --- a/Principal_component_analysis/include/CGAL/PCA_util.h +++ b/Principal_component_analysis/include/CGAL/PCA_util.h @@ -20,7 +20,6 @@ #ifndef CGAL_LINEAR_LEAST_SQUARES_FITTING_UTIL_H #define CGAL_LINEAR_LEAST_SQUARES_FITTING_UTIL_H -#include #include #include diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h index 126e861f569..147c6af98b8 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h @@ -22,8 +22,6 @@ #include #include -#include -#include #include #include @@ -121,11 +119,10 @@ linear_least_squares_fitting_2(InputIterator first, covariance[2] += mass * (-1.0 * c.y() * c.y()); // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. std::pair eigen_values; std::pair eigen_vectors; - // internal::eigen_symmetric_2(final_cov, eigen_vectors, eigen_values); CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; Vcm_traits::diagonalize_selfadjoint_covariance_matrix @@ -230,11 +227,10 @@ linear_least_squares_fitting_2(InputIterator first, covariance[2] += mass * (-1.0 * c.y() * c.y()); // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. std::pair eigen_values; std::pair eigen_vectors; - // internal::eigen_symmetric_2(final_cov, eigen_vectors, eigen_values); CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; Vcm_traits::diagonalize_selfadjoint_covariance_matrix diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h index 2fdeadc0a8f..d8d0beece5d 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h @@ -22,8 +22,6 @@ #include #include -#include -#include #include #include @@ -124,7 +122,7 @@ linear_least_squares_fitting_2(InputIterator first, covariance[2] += mass * (-1.0 * c.y() * c.y()); // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. std::pair eigen_values; std::pair eigen_vectors; diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h index 0c72fd92edf..aeb740a4cb6 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h @@ -22,8 +22,6 @@ #include #include -#include -#include #include #include @@ -112,11 +110,10 @@ linear_least_squares_fitting_2(InputIterator first, covariance[2] += mass * (-1.0 * c.y() * c.y()); // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. std::pair eigen_values; std::pair eigen_vectors; - // internal::eigen_symmetric_2(covariance, eigen_vectors, eigen_values); CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; Vcm_traits::diagonalize_selfadjoint_covariance_matrix diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h index 395fccbd84d..1bce41e923b 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h index 1af06f17457..2a45ee6111b 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h index 67a8c122456..2aea4ed6926 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h index b6529c8fa76..8cd85dcd167 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h @@ -22,8 +22,6 @@ #include #include -#include -#include #include #include @@ -124,7 +122,7 @@ linear_least_squares_fitting_2(InputIterator first, // std::cout<<"cov: "< eigen_values; std::pair eigen_vectors; diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h index e30a2256144..aabc8fe0b1b 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h @@ -22,7 +22,6 @@ #include #include -#include #include #include From 6c77cc817a8a1b80a5352dea00a84fc219fb89ff Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 11:55:04 +0200 Subject: [PATCH 33/61] Propagating change of eigen API in Bounding_volumes package --- .../Approximate_min_ellipsoid_d_impl.h | 87 +++++++++++-------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h index d6cbb4ade8b..9c55b1bb92b 100644 --- a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h +++ b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h @@ -18,8 +18,12 @@ // // Author(s) : Kaspar Fischer -#include -#include + +#ifdef CGAL_EIGEN3_ENABLED +#include +#else +#include +#endif #include @@ -150,34 +154,37 @@ namespace CGAL { { CGAL_APPEL_ASSERT(d==2); - typedef Simple_cartesian K; - typedef Vector_2 Vector_2; - // write matrix M' as [ a, b; b, c ]: - const double matrix[3] = { E->matrix(0, 0), // a - E->matrix(0, 1), // b - E->matrix(1, 1) }; // c - - std::pair eigenvectors; // Note: not neces. normalized. - std::pair eigenvalues; // Note: sorted descendent. - internal::eigen_symmetric_2(matrix, eigenvectors, eigenvalues); + const CGAL::cpp11::array matrix = {{ E->matrix(0, 0), // a + E->matrix(0, 1), // b + E->matrix(1, 1) }}; // c + CGAL::cpp11::array eigenvectors; // Note: not neces. normalized. + CGAL::cpp11::array eigenvalues; // Note: sorted ascendent. + +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits::diagonalize_selfadjoint_covariance_matrix + (matrix, eigenvalues, eigenvectors); +#else + CGAL::Internal_vcm_traits::diagonalize_selfadjoint_covariance_matrix + (matrix, eigenvalues, eigenvectors); +#endif // normalize eigenvectors: - double l1=1.0/std::sqrt(eigenvectors.first.x()*eigenvectors.first.x()+ - eigenvectors.first.y()*eigenvectors.first.y()); - double l2=1.0/std::sqrt(eigenvectors.second.x()*eigenvectors.second.x()+ - eigenvectors.second.y()*eigenvectors.second.y()); + double l1=1.0/std::sqrt(eigenvectors[2]*eigenvectors[2]+ + eigenvectors[3]*eigenvectors[3]); + double l2=1.0/std::sqrt(eigenvectors[0]*eigenvectors[0]+ + eigenvectors[1]*eigenvectors[1]); // store axes lengths: - lengths_.push_back(std::sqrt(factor/eigenvalues.first)); - lengths_.push_back(std::sqrt(factor/eigenvalues.second)); + lengths_.push_back(std::sqrt(factor/eigenvalues[1])); + lengths_.push_back(std::sqrt(factor/eigenvalues[0])); // store directions: directions_.resize(2); - directions_[0].push_back(eigenvectors.first.x()*l1); - directions_[0].push_back(eigenvectors.first.y()*l1); - directions_[1].push_back(eigenvectors.second.x()*l2); - directions_[1].push_back(eigenvectors.second.y()*l2); + directions_[0].push_back(eigenvectors[2]*l1); + directions_[0].push_back(eigenvectors[3]*l1); + directions_[1].push_back(eigenvectors[0]*l2); + directions_[1].push_back(eigenvectors[1]*l2); } template @@ -192,16 +199,22 @@ namespace CGAL { // M' = [ b d e ] // [ c e f ] // - const double matrix[6] = { E->matrix(0, 0), // a - E->matrix(0, 1), // b - E->matrix(1, 1), // d - E->matrix(0, 2), // c - E->matrix(1, 2), // e - E->matrix(2, 2) }; // f + const CGAL::cpp11::array matrix = {{ E->matrix(0, 0), // a + E->matrix(0, 1), // b + E->matrix(0, 2), // c + E->matrix(1, 1), // d + E->matrix(1, 2), // e + E->matrix(2, 2) }}; // f - double eigenvectors[3 * 3]; // Note: not necessarily normalized. - double eigenvalues[3]; // Note: sorted descendent. - internal::eigen_symmetric(matrix, 3, eigenvectors, eigenvalues); + CGAL::cpp11::array eigenvectors; // Note: not necessarily normalized. + CGAL::cpp11::array eigenvalues; // Note: sorted ascendent. +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits::diagonalize_selfadjoint_covariance_matrix + (matrix, eigenvalues, eigenvectors); +#else + CGAL::Internal_vcm_traits::diagonalize_selfadjoint_covariance_matrix + (matrix, eigenvalues, eigenvectors); +#endif // normalize eigenvectors: double l1 = 1.0/std::sqrt(eigenvectors[0] * eigenvectors[0]+ // x^2 @@ -220,15 +233,15 @@ namespace CGAL { // store directions: directions_.resize(3); - directions_[0].push_back(eigenvectors[0]*l1); - directions_[0].push_back(eigenvectors[1]*l1); - directions_[0].push_back(eigenvectors[2]*l1); + directions_[0].push_back(eigenvectors[6]*l3); + directions_[0].push_back(eigenvectors[7]*l3); + directions_[0].push_back(eigenvectors[8]*l3); directions_[1].push_back(eigenvectors[3]*l2); directions_[1].push_back(eigenvectors[4]*l2); directions_[1].push_back(eigenvectors[5]*l2); - directions_[2].push_back(eigenvectors[6]*l3); - directions_[2].push_back(eigenvectors[7]*l3); - directions_[2].push_back(eigenvectors[8]*l3); + directions_[2].push_back(eigenvectors[0]*l1); + directions_[2].push_back(eigenvectors[1]*l1); + directions_[2].push_back(eigenvectors[2]*l1); } template From bd7ea48403511951cc89f389912afc9dd5f11b1b Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 14:01:47 +0200 Subject: [PATCH 34/61] Propagating API change to Point_set_processing package (vcm_estimate_*) --- .../include/CGAL/vcm_estimate_edges.h | 11 +++++++--- .../include/CGAL/vcm_estimate_normals.h | 22 +++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h b/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h index 2a688da8c41..f42bf2c3e2d 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h @@ -66,15 +66,20 @@ vcm_is_on_feature_edge (cpp11::array &cov, -#ifdef CGAL_EIGEN3_ENABLED template bool vcm_is_on_feature_edge (cpp11::array &cov, double threshold) { - return vcm_is_on_feature_edge(cov, threshold, Eigen_vcm_traits()); -} + return vcm_is_on_feature_edge(cov, threshold, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() #endif + ); + +} } // namespace CGAL diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 51c5f37b6b1..bb02a0b3205 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -34,6 +34,8 @@ #ifdef CGAL_EIGEN3_ENABLED #include +#else +#include #endif #include @@ -440,7 +442,6 @@ vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input } -#ifdef CGAL_EIGEN3_ENABLED template < typename ForwardIterator, typename PointPMap, typename NormalPMap @@ -453,7 +454,13 @@ vcm_estimate_normals (ForwardIterator first, double offset_radius, double convolution_radius) { - vcm_estimate_normals(first, beyond, point_pmap, normal_pmap, offset_radius, convolution_radius, Eigen_vcm_traits()); + vcm_estimate_normals(first, beyond, point_pmap, normal_pmap, offset_radius, convolution_radius, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() +#endif + ); } template < typename ForwardIterator, @@ -468,9 +475,16 @@ vcm_estimate_normals (ForwardIterator first, double offset_radius, unsigned int nb_neighbors_convolve) { - vcm_estimate_normals(first, beyond, point_pmap, normal_pmap, offset_radius, nb_neighbors_convolve, Eigen_vcm_traits()); -} + vcm_estimate_normals(first, beyond, point_pmap, normal_pmap, offset_radius, nb_neighbors_convolve, +#ifdef CGAL_EIGEN3_ENABLED + CGAL::Eigen_vcm_traits() +#else + CGAL::Internal_vcm_traits() #endif + ); + +} + /// @cond SKIP_IN_MANUAL // This variant creates a default point property map = Identity_property_map From 7e50599ffa0ffcee2b0f0b122c9b24ef3d54f5eb Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 14:22:19 +0200 Subject: [PATCH 35/61] Update doc and example with Eigen_vcm_traits API --- .../doc/Solver_interface/Concepts/VCMTraits.h | 6 +- .../doc/Solver_interface/Solver_interface.txt | 65 ++++++++++++------- .../doc/Solver_interface/examples.txt | 2 +- .../examples/Solver_interface/CMakeLists.txt | 2 +- ...ance_matrix.cpp => diagonalize_matrix.cpp} | 13 +++- 5 files changed, 58 insertions(+), 30 deletions(-) rename Solver_interface/examples/Solver_interface/{eigen_variance_covariance_matrix.cpp => diagonalize_matrix.cpp} (80%) diff --git a/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h b/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h index 1247f669a9a..c869cfea62a 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h @@ -1,8 +1,10 @@ /*! \ingroup PkgSolverConcepts \cgalConcept -Concept providing functions to extract eigenvectors and eigenvalue from -covariance matrices represented by an array `a` as follows: + +Concept providing functions to extract eigenvectors and eigenvalue +from covariance matrices represented by an array `a`. For example, a +matrix of dimension 3 is defined as follows:
    \f$ \begin{bmatrix} a[0] & a[1] & a[2] \\ diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index ed50799101c..2ba533d96a0 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -10,14 +10,52 @@ namespace CGAL { Several \cgal packages have to solve linear systems with dense or sparse matrices. -This package provides concepts and models for that purpose. The models we provide -all use the \ref thirdpartyEigen library. It is straightforward to develop +This package provides concepts and models for that purpose. Most of the models we provide + use the \ref thirdpartyEigen library. It is straightforward to develop equivalent models for other solvers, for example those found in the Intel Math Kernel Library (MKL). +\section SectionSolverVCM Matrix Diagonalization -\section SectionSolverEigenSparse Eigen Sparse Solvers +The concept `VCMTraits` defines an interface for the +diagonalization and computation of eigenvectors and eigenvalues of a +symmetric matrix. `T` is the number type and `dim` is the dimension of +the matrices and vector (set to 3 by default). We provide two models +for this concept: + +- `Eigen_vcm_traits` uses the \ref thirdpartyEigen library. +- `Internal_vcm_traits` is an internal implementation that does not +depend on another library. + +Although both models achieve the same computation, +`Eigen_vcm_traits` is faster and should thus be used if the \ref +thirdpartyEigen library is available. + +This is an example of an eigendecomposition of a matrix using this +class: + +\cgalExample{Solver_interface/diagonalize_matrix.cpp} + + +\section SectionSolverSVD Singular Value Decomposition + +The concept `SvdTraits` defines an interface for solving in the least +square sense a linear system with a singular value decomposition. The +field type is `double`. + +The class `Eigen_svd` provides an implementation of `SvdTraits` using +the \ref thirdpartyEigen library. + +Here is a simple example that shows how to handle matrices, vectors +and this solver: + +\cgalExample{Solver_interface/eigen_singular_value_decomposition.cpp} + + + + +\section SectionSolverSparse Sparse Solvers An interface to all sparse solvers from the \ref thirdpartyEigen library is provided through the class @@ -49,27 +87,6 @@ the solver: \cgalExample{Solver_interface/eigen_sparse_solvers.cpp} -\section SectionSolverEigenSVD Eigen Singular Value Decomposition - -The class `Eigen_svd` provides an algorithm to solve in the least -square sense a linear system with a singular value decomposition using -\ref thirdpartyEigen. The field type is `double`. - -Here is a simple example that shows how to handle matrices, vectors -and this solver: - -\cgalExample{Solver_interface/eigen_singular_value_decomposition.cpp} - -\section SectionSolverEigenVCM Variance Covariance Matrix - -The class `Eigen_vcm_traits` provides an interface to the -selfadjoint solver of the \ref thirdpartyEigen library. - -This is an example of an eigendecomposition of a matrix using this -class: - -\cgalExample{Solver_interface/eigen_variance_covariance_matrix.cpp} - diff --git a/Solver_interface/doc/Solver_interface/examples.txt b/Solver_interface/doc/Solver_interface/examples.txt index 2d2b127bd9c..fb6339dba64 100644 --- a/Solver_interface/doc/Solver_interface/examples.txt +++ b/Solver_interface/doc/Solver_interface/examples.txt @@ -1,5 +1,5 @@ /*! +\example Solver_interface/diagonalize_matrix.cpp \example Solver_interface/eigen_singular_value_decomposition.cpp -\example Solver_interface/eigen_variance_covariance_matrix.cpp \example Solver_interface/eigen_sparse_solvers.cpp */ diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index 2d6de0e3734..f76d7de6140 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -25,7 +25,7 @@ if ( CGAL_FOUND ) include_directories (BEFORE "../include") create_single_source_cgal_program( "eigen_singular_value_decomposition.cpp" ) - create_single_source_cgal_program( "eigen_variance_covariance_matrix.cpp" ) + create_single_source_cgal_program( "diagonalize_matrix.cpp" ) create_single_source_cgal_program( "eigen_sparse_solvers.cpp" ) else() diff --git a/Solver_interface/examples/Solver_interface/eigen_variance_covariance_matrix.cpp b/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp similarity index 80% rename from Solver_interface/examples/Solver_interface/eigen_variance_covariance_matrix.cpp rename to Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp index 46ce3680908..b092ff87fcf 100644 --- a/Solver_interface/examples/Solver_interface/eigen_variance_covariance_matrix.cpp +++ b/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp @@ -1,12 +1,21 @@ -#include +#include + +#ifdef CGAL_EIGEN3_ENABLED #include +#else +#include +#endif typedef double FT; typedef CGAL::cpp11::array Eigen_matrix; typedef CGAL::cpp11::array Eigen_vector; typedef CGAL::cpp11::array Eigen_three_vectors; -typedef CGAL::Eigen_vcm_traits Vcm_traits; +#ifdef CGAL_EIGEN3_ENABLED +typedef CGAL::Eigen_vcm_traits Vcm_traits; +#else +typedef CGAL::Internal_vcm_traits Vcm_traits; +#endif int main(void) { From 8a46d3cd5e5ddd22fba94f15d2ea20cc707eef61 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 14:48:11 +0200 Subject: [PATCH 36/61] Include Lapack svd in Solver interface (another model for SvdTraits) --- .../doc/Documentation/Installation.txt | 9 +++++++++ .../doc/Solver_interface/Solver_interface.txt | 8 ++++---- .../doc/Solver_interface/examples.txt | 2 +- .../examples/Solver_interface/CMakeLists.txt | 2 +- ...on.cpp => singular_value_decomposition.cpp} | 18 +++++++++++++----- .../include/CGAL/Lapack_svd.h | 0 6 files changed, 28 insertions(+), 11 deletions(-) rename Solver_interface/examples/Solver_interface/{eigen_singular_value_decomposition.cpp => singular_value_decomposition.cpp} (67%) rename Jet_fitting_3/include/CGAL/Lapack/Linear_algebra_lapack.h => Solver_interface/include/CGAL/Lapack_svd.h (100%) diff --git a/Documentation/doc/Documentation/Installation.txt b/Documentation/doc/Documentation/Installation.txt index 9864272873d..5f1f1cee0d1 100644 --- a/Documentation/doc/Documentation/Installation.txt +++ b/Documentation/doc/Documentation/Installation.txt @@ -508,6 +508,15 @@ and the \ref PkgRidges_3 packages. The \sc{Eigen} web site is `http://eigen.tuxfamily.org`. +\subsection thirdpartyLapack Lapack + +\sc{Lapack} is a `Fortran` library for linear algebra. + +In \cgal, \sc{Lapack} is an alternative to \sc{Eigen} for singular value decomposition for the \ref +kgJet_fitting_3 and the \ref PkgRidges_3 packages. + +The \sc{Lapack} web site is `http://www.netlib.org/lapack/`. + \subsection thirdpartylibQGLViewer libQGLViewer libQGLViewer is a 3D widget based on \sc{Qt} 4's `QGLWidget`. In case of \sc{Qt}5 used, libQGLViewer needs to be recompiled with the proper \sc{Qt}5 version. diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 2ba533d96a0..4a64a994551 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -42,15 +42,15 @@ class: The concept `SvdTraits` defines an interface for solving in the least square sense a linear system with a singular value decomposition. The -field type is `double`. +field type is `double`. We provide two models for this concept: -The class `Eigen_svd` provides an implementation of `SvdTraits` using -the \ref thirdpartyEigen library. +- `Eigen_svd` uses the \ref thirdpartyEigen library. +- `Lapack_svd` uses the \ref thirdpartyLapack library. Here is a simple example that shows how to handle matrices, vectors and this solver: -\cgalExample{Solver_interface/eigen_singular_value_decomposition.cpp} +\cgalExample{Solver_interface/singular_value_decomposition.cpp} diff --git a/Solver_interface/doc/Solver_interface/examples.txt b/Solver_interface/doc/Solver_interface/examples.txt index fb6339dba64..773c9ebbcd9 100644 --- a/Solver_interface/doc/Solver_interface/examples.txt +++ b/Solver_interface/doc/Solver_interface/examples.txt @@ -1,5 +1,5 @@ /*! \example Solver_interface/diagonalize_matrix.cpp -\example Solver_interface/eigen_singular_value_decomposition.cpp +\example Solver_interface/singular_value_decomposition.cpp \example Solver_interface/eigen_sparse_solvers.cpp */ diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index f76d7de6140..90334b642c9 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -24,7 +24,7 @@ if ( CGAL_FOUND ) include_directories (BEFORE "../include") - create_single_source_cgal_program( "eigen_singular_value_decomposition.cpp" ) + create_single_source_cgal_program( "singular_value_decomposition.cpp" ) create_single_source_cgal_program( "diagonalize_matrix.cpp" ) create_single_source_cgal_program( "eigen_sparse_solvers.cpp" ) diff --git a/Solver_interface/examples/Solver_interface/eigen_singular_value_decomposition.cpp b/Solver_interface/examples/Solver_interface/singular_value_decomposition.cpp similarity index 67% rename from Solver_interface/examples/Solver_interface/eigen_singular_value_decomposition.cpp rename to Solver_interface/examples/Solver_interface/singular_value_decomposition.cpp index 439587d59dc..22d829f6f2b 100644 --- a/Solver_interface/examples/Solver_interface/eigen_singular_value_decomposition.cpp +++ b/Solver_interface/examples/Solver_interface/singular_value_decomposition.cpp @@ -1,11 +1,20 @@ #include + +#ifdef CGAL_EIGEN3_ENABLED #include #include #include +typedef CGAL::Eigen_svd Svd; +#else +#ifdef CGAL_LAPACK_ENABLED +#include +typedef CGAL::Lapack_svd Svd; +#endif +#endif -typedef CGAL::Eigen_svd::FT FT; -typedef CGAL::Eigen_svd::Vector Eigen_vector; -typedef CGAL::Eigen_svd::Matrix Eigen_matrix; +typedef Svd::FT FT; +typedef Svd::Vector Eigen_vector; +typedef Svd::Matrix Eigen_matrix; int main(void) { @@ -14,7 +23,6 @@ int main(void) Eigen_vector B (degree); Eigen_matrix M (degree, degree); - // Fill B and M with random numbers for (std::size_t i = 0; i < degree; ++ i) { @@ -24,7 +32,7 @@ int main(void) } // Solve MX=B - std::cout << CGAL::Eigen_svd::solve(M, B) << std::endl; + std::cout << Svd::solve(M, B) << std::endl; // Print result std::cout << "Solution of SVD = [ "; diff --git a/Jet_fitting_3/include/CGAL/Lapack/Linear_algebra_lapack.h b/Solver_interface/include/CGAL/Lapack_svd.h similarity index 100% rename from Jet_fitting_3/include/CGAL/Lapack/Linear_algebra_lapack.h rename to Solver_interface/include/CGAL/Lapack_svd.h From b2897fd69187ade5ab0702ec26e6d8e3b77a48a9 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 15:16:45 +0200 Subject: [PATCH 37/61] Rename eigen_sparse_solvers.cpp by sparse_solvers.cpp (documentation is generic) --- Solver_interface/doc/Solver_interface/Solver_interface.txt | 4 ++-- Solver_interface/doc/Solver_interface/examples.txt | 2 +- Solver_interface/examples/Solver_interface/CMakeLists.txt | 2 +- .../{eigen_sparse_solvers.cpp => sparse_solvers.cpp} | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename Solver_interface/examples/Solver_interface/{eigen_sparse_solvers.cpp => sparse_solvers.cpp} (100%) diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 4a64a994551..99b6e0841b2 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -50,7 +50,7 @@ field type is `double`. We provide two models for this concept: Here is a simple example that shows how to handle matrices, vectors and this solver: -\cgalExample{Solver_interface/singular_value_decomposition.cpp} +\cgalExample{Solver_interface/*$singular_value_decomposition.cpp} @@ -85,7 +85,7 @@ typedef CGAL::Eigen_solver_traits< Eigen::SimplicialCholesky > Dire Here is an example that shows how to fill the sparse matrix and call the solver: -\cgalExample{Solver_interface/eigen_sparse_solvers.cpp} +\cgalExample{Solver_interface/sparse_solvers.cpp} diff --git a/Solver_interface/doc/Solver_interface/examples.txt b/Solver_interface/doc/Solver_interface/examples.txt index 773c9ebbcd9..6f2d6ff1f88 100644 --- a/Solver_interface/doc/Solver_interface/examples.txt +++ b/Solver_interface/doc/Solver_interface/examples.txt @@ -1,5 +1,5 @@ /*! \example Solver_interface/diagonalize_matrix.cpp \example Solver_interface/singular_value_decomposition.cpp -\example Solver_interface/eigen_sparse_solvers.cpp +\example Solver_interface/sparse_solvers.cpp */ diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index 90334b642c9..a379afcb686 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -26,7 +26,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "singular_value_decomposition.cpp" ) create_single_source_cgal_program( "diagonalize_matrix.cpp" ) - create_single_source_cgal_program( "eigen_sparse_solvers.cpp" ) + create_single_source_cgal_program( "sparse_solvers.cpp" ) else() diff --git a/Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp b/Solver_interface/examples/Solver_interface/sparse_solvers.cpp similarity index 100% rename from Solver_interface/examples/Solver_interface/eigen_sparse_solvers.cpp rename to Solver_interface/examples/Solver_interface/sparse_solvers.cpp From e3dbde19f8237d2c30a2b2791166b317b3a71899 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 17:52:38 +0200 Subject: [PATCH 38/61] Doc: precision on eigenvalues order + typo correction --- Solver_interface/doc/Solver_interface/Solver_interface.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 99b6e0841b2..b2102ef6689 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -29,8 +29,9 @@ for this concept: depend on another library. Although both models achieve the same computation, -`Eigen_vcm_traits` is faster and should thus be used if the \ref -thirdpartyEigen library is available. +`Eigen_vcm_traits` is faster and should thus be used if the +\ref thirdpartyEigen library is available. The eigenvalues are stored +in ascending order and eigenvectors are stored in accordance. This is an example of an eigendecomposition of a matrix using this class: @@ -50,7 +51,7 @@ field type is `double`. We provide two models for this concept: Here is a simple example that shows how to handle matrices, vectors and this solver: -\cgalExample{Solver_interface/*$singular_value_decomposition.cpp} +\cgalExample{Solver_interface/singular_value_decomposition.cpp} From 0f65a355539aac2040937ca4bd2f00ebb7c83366 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 26 Aug 2015 17:52:57 +0200 Subject: [PATCH 39/61] Add missing models to lists in doc --- Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h | 3 +-- Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h index 630a682051e..495485fbe83 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h @@ -6,8 +6,7 @@ to solve in the least square sense a linear system with a singular value decomposition \cgalHasModel `CGAL::Eigen_svd` - - \sa `CGAL::Monge_via_jet_fitting` + \cgalHasModel `CGAL::Lapack_svd` */ class SvdTraits { diff --git a/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h b/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h index c869cfea62a..4befedd5e5b 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h @@ -13,6 +13,7 @@ matrix of dimension 3 is defined as follows: \end{bmatrix}\f$
    \cgalHasModel `CGAL::Eigen_vcm_traits` +\cgalHasModel `CGAL::Internal_vcm_traits` */ template class VCMTraits From 28e5432c163c43c0f54971788fe6afc8de8efb22 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 31 Aug 2015 08:08:26 +0200 Subject: [PATCH 40/61] Renaming 'VCM' to 'diagonalize' --- .../Approximate_min_ellipsoid_d_impl.h | 12 ++--- .../include/CGAL/vcm_estimate_edges.h | 8 ++-- .../include/CGAL/vcm_estimate_normals.h | 20 ++++---- .../CGAL/linear_least_squares_fitting_2.h | 20 ++++---- .../CGAL/linear_least_squares_fitting_3.h | 22 ++++----- .../linear_least_squares_fitting_cuboids_3.h | 48 +++++++++---------- .../linear_least_squares_fitting_points_2.h | 10 ++-- .../linear_least_squares_fitting_points_3.h | 12 ++--- ...inear_least_squares_fitting_rectangles_2.h | 18 +++---- .../linear_least_squares_fitting_segments_2.h | 12 ++--- .../linear_least_squares_fitting_segments_3.h | 24 +++++----- .../linear_least_squares_fitting_spheres_3.h | 24 +++++----- ...inear_least_squares_fitting_tetrahedra_3.h | 48 +++++++++---------- ...linear_least_squares_fitting_triangles_2.h | 18 +++---- ...linear_least_squares_fitting_triangles_3.h | 36 +++++++------- ..._linear_least_squares_fitting_points_2.cpp | 12 ++--- ..._linear_least_squares_fitting_points_3.cpp | 12 ++--- ...inear_least_squares_fitting_segments_3.cpp | 12 ++--- ...linear_least_squares_fitting_spheres_3.cpp | 12 ++--- ...cm_traits.h => Eigen_diagonalize_traits.h} | 12 +++-- ...traits.h => Internal_diagonalize_traits.h} | 8 ++-- .../{VCMTraits.h => DiagonalizeTraits.h} | 11 +++-- .../Solver_interface/PackageDescription.txt | 6 ++- .../doc/Solver_interface/Solver_interface.txt | 10 ++-- .../Solver_interface/diagonalize_matrix.cpp | 14 +++--- ...cm_traits.h => Eigen_diagonalize_traits.h} | 12 ++--- ...traits.h => Internal_diagonalize_traits.h} | 12 ++--- 27 files changed, 237 insertions(+), 228 deletions(-) rename Solver_interface/doc/Solver_interface/CGAL/{Eigen_vcm_traits.h => Eigen_diagonalize_traits.h} (78%) rename Solver_interface/doc/Solver_interface/CGAL/{Internal_vcm_traits.h => Internal_diagonalize_traits.h} (78%) rename Solver_interface/doc/Solver_interface/Concepts/{VCMTraits.h => DiagonalizeTraits.h} (84%) rename Solver_interface/include/CGAL/{Eigen_vcm_traits.h => Eigen_diagonalize_traits.h} (93%) rename Solver_interface/include/CGAL/{Internal_vcm_traits.h => Internal_diagonalize_traits.h} (95%) diff --git a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h index 9c55b1bb92b..f740211bf95 100644 --- a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h +++ b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h @@ -20,9 +20,9 @@ #ifdef CGAL_EIGEN3_ENABLED -#include +#include #else -#include +#include #endif #include @@ -162,10 +162,10 @@ namespace CGAL { CGAL::cpp11::array eigenvalues; // Note: sorted ascendent. #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits::diagonalize_selfadjoint_covariance_matrix + CGAL::Eigen_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (matrix, eigenvalues, eigenvectors); #else - CGAL::Internal_vcm_traits::diagonalize_selfadjoint_covariance_matrix + CGAL::Internal_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (matrix, eigenvalues, eigenvectors); #endif @@ -209,10 +209,10 @@ namespace CGAL { CGAL::cpp11::array eigenvectors; // Note: not necessarily normalized. CGAL::cpp11::array eigenvalues; // Note: sorted ascendent. #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits::diagonalize_selfadjoint_covariance_matrix + CGAL::Eigen_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (matrix, eigenvalues, eigenvectors); #else - CGAL::Internal_vcm_traits::diagonalize_selfadjoint_covariance_matrix + CGAL::Internal_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (matrix, eigenvalues, eigenvectors); #endif diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h b/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h index f42bf2c3e2d..09207f859da 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h @@ -39,8 +39,8 @@ namespace CGAL { /// which however would result in selecting more points on sharper regions. /// More details are provided in \cgalCite{cgal:mog-vbcfe-11}. /// -/// \tparam VCM_traits is a model of `VCMTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined -/// then an overload using `Eigen_vcm_traits` is provided and this template parameter can be omitted. +/// \tparam VCM_traits is a model of `DiagonalizeTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined +/// then an overload using `Eigen_diagonalize_traits` is provided and this template parameter can be omitted. /// \sa CGAL::compute_vcm()` /// template @@ -73,9 +73,9 @@ vcm_is_on_feature_edge (cpp11::array &cov, { return vcm_is_on_feature_edge(cov, threshold, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index bb02a0b3205..7d41976f540 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -33,9 +33,9 @@ #include #ifdef CGAL_EIGEN3_ENABLED -#include +#include #else -#include +#include #endif #include @@ -370,8 +370,8 @@ vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input /// @tparam ForwardIterator iterator over input points. /// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = `Kernel::Point_3`. /// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = `Kernel::Vector_3`. -/// \tparam VCM_traits is a model of `VCMTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined -/// then an overload using `Eigen_vcm_traits` is provided and this template parameter can be omitted. +/// \tparam VCM_traits is a model of `DiagonalizeTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined +/// then an overload using `Eigen_diagonalize_traits` is provided and this template parameter can be omitted. // This variant deduces the kernel from the point property map // and uses a radius for the convolution. @@ -411,8 +411,8 @@ vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input /// @tparam ForwardIterator iterator over input points. /// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = `Kernel::Point_3`. /// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = `Kernel::Vector_3`. -/// \tparam VCM_traits is a model of `VCMTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined -/// then an overload using `Eigen_vcm_traits` is provided and this template parameter can be omitted. +/// \tparam VCM_traits is a model of `DiagonalizeTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined +/// then an overload using `Eigen_diagonalize_traits` is provided and this template parameter can be omitted. // This variant deduces the kernel from the point property map // and uses a number of neighbors for the convolution. @@ -456,9 +456,9 @@ vcm_estimate_normals (ForwardIterator first, { vcm_estimate_normals(first, beyond, point_pmap, normal_pmap, offset_radius, convolution_radius, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); } @@ -477,9 +477,9 @@ vcm_estimate_normals (ForwardIterator first, { vcm_estimate_normals(first, beyond, point_pmap, normal_pmap, offset_radius, nb_neighbors_convolve, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h index c2cdea69c5c..30b28a9e1eb 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h @@ -29,10 +29,10 @@ #include #include #include -#include +#include #ifdef CGAL_EIGEN3_ENABLED -#include +#include #endif #include @@ -42,7 +42,7 @@ namespace CGAL { template < typename InputIterator, typename Kernel, typename Tag, - typename Vcm_traits> + typename Diagonalize_traits> inline typename Kernel::FT linear_least_squares_fitting_2(InputIterator first, @@ -51,16 +51,16 @@ linear_least_squares_fitting_2(InputIterator first, typename Kernel::Point_2& centroid, const Tag& tag, const Kernel& kernel, - const Vcm_traits vcm_traits) + const Diagonalize_traits diagonalize_traits) { typedef typename std::iterator_traits::value_type Value_type; return internal::linear_least_squares_fitting_2(first, beyond, line, centroid,(Value_type*)NULL,kernel,tag, - vcm_traits); + diagonalize_traits); } // deduces the kernel from the points in container. -// Use default Vcm_traits +// Use default Diagonalize_traits template < typename InputIterator, typename Line, typename Point, @@ -78,9 +78,9 @@ linear_least_squares_fitting_2(InputIterator first, return CGAL::linear_least_squares_fitting_2 (first,beyond,line,centroid,tag,Kernel(), #ifdef CGAL_EIGEN3_ENABLED - Eigen_vcm_traits() + Eigen_diagonalize_traits() #else - Internal_vcm_traits() + Internal_diagonalize_traits() #endif ); } @@ -100,9 +100,9 @@ linear_least_squares_fitting_2(InputIterator first, typename Kernel::Point_2 centroid; // unused return CGAL::linear_least_squares_fitting_2(first,beyond,line,centroid,tag,Kernel(), #ifdef CGAL_EIGEN3_ENABLED - Eigen_vcm_traits() + Eigen_diagonalize_traits() #else - Internal_vcm_traits() + Internal_diagonalize_traits() #endif ); } diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h index b842bfc2b68..37f33fa180c 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h @@ -29,9 +29,9 @@ #include #include -#include +#include #ifdef CGAL_EIGEN3_ENABLED -#include +#include #endif #include @@ -46,7 +46,7 @@ template < typename InputIterator, typename Object, typename Kernel, typename Tag, - typename Vcm_traits > + typename Diagonalize_traits > inline typename Kernel::FT linear_least_squares_fitting_3(InputIterator first, @@ -55,16 +55,16 @@ linear_least_squares_fitting_3(InputIterator first, typename Kernel::Point_3& centroid, const Tag& tag, // dimension tag, ranges from 0 to 3 const Kernel& kernel, - const Vcm_traits vcm_traits) + const Diagonalize_traits diagonalize_traits) { typedef typename std::iterator_traits::value_type Value_type; return internal::linear_least_squares_fitting_3(first, beyond, object, centroid, (Value_type*) NULL, kernel, tag, - vcm_traits); + diagonalize_traits); } // deduces kernel from value type of input iterator -// use default Vcm_traits +// use default Diagonalize_traits template < typename InputIterator, typename Object, typename Point, @@ -81,16 +81,16 @@ linear_least_squares_fitting_3(InputIterator first, typedef typename Kernel_traits::Kernel Kernel; return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag,Kernel(), #ifdef CGAL_EIGEN3_ENABLED - Eigen_vcm_traits() + Eigen_diagonalize_traits() #else - Internal_vcm_traits() + Internal_diagonalize_traits() #endif ); } // deduces kernel and does not write centroid -// use default Vcm_traits +// use default Diagonalize_traits template < typename InputIterator, typename Object, typename Tag> @@ -106,9 +106,9 @@ linear_least_squares_fitting_3(InputIterator first, typename Kernel::Point_3 centroid; // not used by caller return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag,Kernel(), #ifdef CGAL_EIGEN3_ENABLED - Eigen_vcm_traits() + Eigen_diagonalize_traits() #else - Internal_vcm_traits() + Internal_diagonalize_traits() #endif ); diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h index b34af34f114..2a13fc63a7a 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h @@ -36,7 +36,7 @@ namespace internal { // fits a plane to a 3D cuboid set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -45,7 +45,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<3>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -61,7 +61,7 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Iso_cuboid*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k,vcm_traits); + return fitting_plane_3(covariance,c,plane,k,diagonalize_traits); } // end linear_least_squares_fitting_cuboids_3 @@ -69,7 +69,7 @@ linear_least_squares_fitting_3(InputIterator first, // fits a plane to a 3D cuboid set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -78,7 +78,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -94,7 +94,7 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Iso_cuboid*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k,vcm_traits); + return fitting_plane_3(covariance,c,plane,k,diagonalize_traits); } // end linear_least_squares_fitting_cuboids_3 @@ -102,7 +102,7 @@ linear_least_squares_fitting_3(InputIterator first, // fits a plane to a 3D cuboid set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -111,7 +111,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Segment_3 Segment; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -141,14 +141,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a plane to a 3D cuboid set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -157,7 +157,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Point_3 Point; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -183,14 +183,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a line to a 3D cuboid set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -199,7 +199,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<3>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -215,14 +215,14 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Iso_cuboid*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k,vcm_traits); + return fitting_line_3(covariance,c,line,k,diagonalize_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a line to a 3D cuboid set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -231,7 +231,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -247,7 +247,7 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Iso_cuboid*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k,vcm_traits); + return fitting_line_3(covariance,c,line,k,diagonalize_traits); } // end linear_least_squares_fitting_cuboids_3 @@ -255,7 +255,7 @@ linear_least_squares_fitting_3(InputIterator first, // fits a line to a 3D cuboid set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -264,7 +264,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Segment_3 Segment; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -294,14 +294,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting line return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_cuboids_3 // fits a line to a 3D cuboid set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -310,7 +310,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Iso_cuboid_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Point_3 Point; typedef typename K::Iso_cuboid_3 Iso_cuboid; @@ -336,7 +336,7 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting line return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_cuboids_3 diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h index 4b43217ce11..19a806d222f 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h @@ -23,10 +23,10 @@ #include #include #include -#include +#include #ifdef CGAL_EIGEN3_ENABLED -#include +#include #endif #include @@ -43,7 +43,7 @@ namespace internal { // direction by default). template < typename InputIterator, typename K, - typename Vcm_traits> + typename Diagonalize_traits> typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -52,7 +52,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename K::Point_2*,// used for indirection const K&, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits&) + const Diagonalize_traits&) { // types typedef typename K::FT FT; @@ -91,7 +91,7 @@ linear_least_squares_fitting_2(InputIterator first, // eigen vectors are sorted in accordance. CGAL::cpp11::array eigen_values = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; - Vcm_traits::diagonalize_selfadjoint_covariance_matrix + Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, eigen_values, eigen_vectors); // check unicity and build fitting line accordingly diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_3.h index ee9603d9cbd..06e63cfbcb7 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_3.h @@ -35,7 +35,7 @@ namespace internal { // 0 is worst (isotropic case, returns a plane with default direction) template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -44,7 +44,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Point_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Point_3 Point; @@ -60,7 +60,7 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Point*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k,vcm_traits); + return fitting_plane_3(covariance,c,plane,k,diagonalize_traits); } // end fit plane to point set // fits a line to a 3D point set @@ -69,7 +69,7 @@ linear_least_squares_fitting_3(InputIterator first, // 0 is worst (isotropic case, returns a line along x axis) template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -78,7 +78,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Point_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Point_3 Point; @@ -94,7 +94,7 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Point*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k,vcm_traits); + return fitting_line_3(covariance,c,line,k,diagonalize_traits); } // end fit line to point set } // end namespace internal diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h index d8d0beece5d..b7201b35d13 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h @@ -38,7 +38,7 @@ namespace internal { // 0 is worst (isotropic case, returns a line with horizontal // direction by default) -template < typename InputIterator, typename K, typename Vcm_traits > +template < typename InputIterator, typename K, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -47,7 +47,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename K::Iso_rectangle_2*,// used for indirection const K&, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits&) + const Diagonalize_traits&) { // types typedef typename K::FT FT; @@ -128,7 +128,7 @@ linear_least_squares_fitting_2(InputIterator first, std::pair eigen_vectors; CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; - Vcm_traits::diagonalize_selfadjoint_covariance_matrix + Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, eigen_values1, eigen_vectors1); eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); @@ -151,7 +151,7 @@ linear_least_squares_fitting_2(InputIterator first, } } // end linear_least_squares_fitting_2 for rectangle set with 2D tag -template < typename InputIterator, typename K, typename Vcm_traits > +template < typename InputIterator, typename K, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -160,7 +160,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename K::Iso_rectangle_2*,// used for indirection const K&, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { // types typedef typename K::Iso_rectangle_2 Iso_rectangle; @@ -182,14 +182,14 @@ linear_least_squares_fitting_2(InputIterator first, } return linear_least_squares_fitting_2(segments.begin(),segments.end(),line,c,K(),tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_2 for rectangle set with 1D tag template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -198,7 +198,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename K::Iso_rectangle_2*,// used for indirection const K&, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { // types typedef typename K::Iso_rectangle_2 Iso_rectangle; @@ -220,7 +220,7 @@ linear_least_squares_fitting_2(InputIterator first, } return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,K(),tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_2 for rectangle set with 0D tag diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h index aeb740a4cb6..2fbf05a5e5c 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h @@ -38,7 +38,7 @@ namespace internal { // 0 is worst (isotropic case, returns a line with horizontal // direction by default) -template < typename InputIterator, typename K, typename Vcm_traits > +template < typename InputIterator, typename K, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -47,7 +47,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename K::Segment_2*,// used for indirection const K&, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits&) + const Diagonalize_traits&) { // types typedef typename K::FT FT; @@ -116,7 +116,7 @@ linear_least_squares_fitting_2(InputIterator first, std::pair eigen_vectors; CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; - Vcm_traits::diagonalize_selfadjoint_covariance_matrix + Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, eigen_values1, eigen_vectors1); eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); @@ -138,7 +138,7 @@ linear_least_squares_fitting_2(InputIterator first, } } // end linear_least_squares_fitting_2 for segment set with 1D tag -template < typename InputIterator, typename K, typename Vcm_traits > +template < typename InputIterator, typename K, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -147,7 +147,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename K::Segment_2*,// used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { // types typedef typename K::Point_2 Point; @@ -166,7 +166,7 @@ linear_least_squares_fitting_2(InputIterator first, points.push_back(s[1]); } return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,k,(Point*)NULL,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_2 for segment set with 1D tag diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h index 1bce41e923b..0eb27f2503f 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h @@ -35,7 +35,7 @@ namespace internal { // fits a plane to a 3D segment set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -44,7 +44,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Segment_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Segment_3 Segment; @@ -60,14 +60,14 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Segment*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k,vcm_traits); + return fitting_plane_3(covariance,c,plane,k,diagonalize_traits); } // end linear_least_squares_fitting_segments_3 // fits a plane to a 3D segment set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -76,7 +76,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Segment_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Segment_3 Segment; typedef typename K::Point_3 Point; @@ -96,14 +96,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_segments_3 // fits a line to a 3D segment set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -112,7 +112,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Segment_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Segment_3 Segment; @@ -128,14 +128,14 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Segment*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k,vcm_traits); + return fitting_line_3(covariance,c,line,k,diagonalize_traits); } // end linear_least_squares_fitting_segments_3 // fits a plane to a 3D segment set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -144,7 +144,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Segment_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Segment_3 Segment; typedef typename K::Point_3 Point; @@ -164,7 +164,7 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_segments_3 diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h index 2a45ee6111b..ad6c35fea34 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_spheres_3.h @@ -33,7 +33,7 @@ namespace internal { // fits a plane to a set of 3D balls (3D) template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -42,7 +42,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Sphere_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<3>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Sphere_3 Sphere; @@ -58,14 +58,14 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Sphere*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k,vcm_traits); + return fitting_plane_3(covariance,c,plane,k,diagonalize_traits); } // end linear_least_squares_fitting_spheres_3 // fits a plane to a 3D sphere set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -74,7 +74,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Sphere_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Sphere_3 Sphere; @@ -90,7 +90,7 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Sphere*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k,vcm_traits); + return fitting_plane_3(covariance,c,plane,k,diagonalize_traits); } // end linear_least_squares_fitting_spheres_3 @@ -98,7 +98,7 @@ linear_least_squares_fitting_3(InputIterator first, // fits a line to a 3D ball set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -107,7 +107,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Sphere_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<3>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Sphere_3 Sphere; @@ -124,14 +124,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting line - return fitting_line_3(covariance,c,line,k,vcm_traits); + return fitting_line_3(covariance,c,line,k,diagonalize_traits); } // end linear_least_squares_fitting_spheres_3 // fits a line to a 3D sphere set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -140,7 +140,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Sphere_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Sphere_3 Sphere; @@ -156,7 +156,7 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Sphere*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k,vcm_traits); + return fitting_line_3(covariance,c,line,k,diagonalize_traits); } // end linear_least_squares_fitting_spheres_3 diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h index 2aea4ed6926..bbb6a7b9c26 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h @@ -37,7 +37,7 @@ namespace internal { // fits a plane to a 3D tetrahedron set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -46,7 +46,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<3>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Tetrahedron_3 Tetrahedron; @@ -62,13 +62,13 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Tetrahedron*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k,vcm_traits); + return fitting_plane_3(covariance,c,plane,k,diagonalize_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a plane to a 3D tetrahedron set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -77,7 +77,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Triangle_3 Triangle; @@ -99,14 +99,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(triangles.begin(),triangles.end(),plane,c,(Triangle*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a plane to a 3D tetrahedron set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -115,7 +115,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Segment_3 Segment; @@ -140,14 +140,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a plane to a 3D tetrahedron set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -156,7 +156,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Point_3 Point; @@ -178,14 +178,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a line to a 3D tetrahedron set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -194,7 +194,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<3>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Tetrahedron_3 Tetrahedron; @@ -210,14 +210,14 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Tetrahedron*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k,vcm_traits); + return fitting_line_3(covariance,c,line,k,diagonalize_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a line to a 3D tetrahedron set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -226,7 +226,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Triangle_3 Triangle; @@ -248,14 +248,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting line return linear_least_squares_fitting_3(triangles.begin(),triangles.end(),line,c,(Triangle*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a line to a 3D tetrahedron set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -264,7 +264,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Segment_3 Segment; @@ -288,14 +288,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting line return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_tetrahedrons_3 // fits a line to a 3D tetrahedron set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -304,7 +304,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Tetrahedron_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Tetrahedron_3 Tetrahedron; typedef typename K::Point_3 Point; @@ -326,7 +326,7 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting line return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_tetrahedra_3 diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h index 8cd85dcd167..ee85e40c9c6 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h @@ -39,7 +39,7 @@ namespace internal { // direction by default) template < typename InputIterator, - typename Kernel, typename Vcm_traits > + typename Kernel, typename Diagonalize_traits > typename Kernel::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -48,7 +48,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename Kernel::Triangle_2*,// used for indirection const Kernel&, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits&) + const Diagonalize_traits&) { // types typedef typename Kernel::FT FT; @@ -128,7 +128,7 @@ linear_least_squares_fitting_2(InputIterator first, std::pair eigen_vectors; CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; - Vcm_traits::diagonalize_selfadjoint_covariance_matrix + Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, eigen_values1, eigen_vectors1); eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); @@ -152,7 +152,7 @@ linear_least_squares_fitting_2(InputIterator first, template < typename InputIterator, typename Kernel, - typename Vcm_traits > + typename Diagonalize_traits > typename Kernel::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -161,7 +161,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename Kernel::Triangle_2*,// used for indirection const Kernel&, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { // types typedef typename Kernel::Triangle_2 Triangle; @@ -182,13 +182,13 @@ linear_least_squares_fitting_2(InputIterator first, } return linear_least_squares_fitting_2(segments.begin(),segments.end(),line,c,tag,Kernel(), - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_2 for triangle set with 1D tag template < typename InputIterator, typename Kernel, - typename Vcm_traits > + typename Diagonalize_traits > typename Kernel::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -197,7 +197,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename Kernel::Triangle_2*,// used for indirection const Kernel&, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { // types @@ -219,7 +219,7 @@ linear_least_squares_fitting_2(InputIterator first, } return linear_least_squares_fitting_2(points.begin(),points.end(),line,c,tag,Kernel(), - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_2 for triangle set with 0D tag diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h index aabc8fe0b1b..dc305ea73a6 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_3.h @@ -34,7 +34,7 @@ namespace internal { // fits a plane to a 3D triangle set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -43,7 +43,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Triangle_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Triangle_3 Triangle; @@ -59,14 +59,14 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Triangle*) NULL,tag); // compute fitting plane - return fitting_plane_3(covariance,c,plane,k,vcm_traits); + return fitting_plane_3(covariance,c,plane,k,diagonalize_traits); } // end linear_least_squares_fitting_triangles_3 // fits a plane to a 3D triangle set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -75,7 +75,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Triangle_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Triangle_3 Triangle; typedef typename K::Segment_3 Segment; @@ -96,14 +96,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,c,(Segment*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_triangles_3 // fits a plane to a 3D triangle set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -112,7 +112,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Triangle_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Triangle_3 Triangle; typedef typename K::Point_3 Point; @@ -132,14 +132,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting plane return linear_least_squares_fitting_3(points.begin(),points.end(),plane,c,(Point*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_triangles_3 // fits a line to a 3D triangle set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -148,7 +148,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Triangle_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::FT FT; typedef typename K::Triangle_3 Triangle; @@ -164,14 +164,14 @@ linear_least_squares_fitting_3(InputIterator first, assemble_covariance_matrix_3(first,beyond,covariance,c,k,(Triangle*) NULL,tag); // compute fitting line - return fitting_line_3(covariance,c,line,k,vcm_traits); + return fitting_line_3(covariance,c,line,k,diagonalize_traits); } // end linear_least_squares_fitting_triangles_3 // fits a line to a 3D triangle set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -180,7 +180,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Triangle_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Triangle_3 Triangle; typedef typename K::Segment_3 Segment; @@ -201,14 +201,14 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting line return linear_least_squares_fitting_3(segments.begin(),segments.end(),line,c,(Segment*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_triangles_3 // fits a line to a 3D triangle set template < typename InputIterator, typename K, - typename Vcm_traits > + typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -217,7 +217,7 @@ linear_least_squares_fitting_3(InputIterator first, const typename K::Triangle_3*, // used for indirection const K& k, // kernel const CGAL::Dimension_tag<0>& tag, - const Vcm_traits& vcm_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename K::Triangle_3 Triangle; typedef typename K::Point_3 Point; @@ -237,7 +237,7 @@ linear_least_squares_fitting_3(InputIterator first, // compute fitting line return linear_least_squares_fitting_3(points.begin(),points.end(),line,c,(Point*)NULL,k,tag, - vcm_traits); + diagonalize_traits); } // end linear_least_squares_fitting_triangles_3 diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp index 86bc9a4327d..5ad47866509 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp @@ -3,10 +3,10 @@ #include #include #include -#include +#include #ifdef CGAL_EIGEN3_ENABLED -#include +#include #endif #include @@ -38,9 +38,9 @@ void test_2D() quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); @@ -85,9 +85,9 @@ void test_2D_point_set(const unsigned int nb_points) quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); std::cout << "done (quality: " << quality << ")" << std::endl; diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp index f39794f2756..6a1399e6204 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp @@ -3,9 +3,9 @@ #include #include -#include +#include #ifdef CGAL_EIGEN3_ENABLED -#include +#include #endif #include @@ -50,9 +50,9 @@ void fit_point_set(std::list& points, quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),kernel, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); @@ -63,9 +63,9 @@ void fit_point_set(std::list& points, quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>(),kernel, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); std::cout << "done (quality: " << quality << ")" << std::endl; diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp index 3d774c7e782..54df04e3094 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp @@ -5,9 +5,9 @@ #include #include #include -#include +#include #ifdef CGAL_EIGEN3_ENABLED -#include +#include #endif #include @@ -40,9 +40,9 @@ FT fit_set(std::list& segments, quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>(),kernel, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); @@ -51,9 +51,9 @@ FT fit_set(std::list& segments, quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>(),kernel, #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits() + CGAL::Eigen_diagonalize_traits() #else - CGAL::Internal_vcm_traits() + CGAL::Internal_diagonalize_traits() #endif ); diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp index 2c6eb36230f..6cbdacb4740 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp @@ -35,9 +35,9 @@ int main(void) Point centroid; #ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_vcm_traits vcm_traits; + CGAL::Eigen_diagonalize_traits diagonalize_traits; #else - CGAL::Internal_vcm_traits vcm_traits; + CGAL::Internal_diagonalize_traits diagonalize_traits; #endif linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,CGAL::Dimension_tag<3>()); @@ -45,17 +45,17 @@ int main(void) linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>(),kernel, - vcm_traits); + diagonalize_traits); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>(),kernel, - vcm_traits); + diagonalize_traits); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>(),kernel, - vcm_traits); + diagonalize_traits); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>(),kernel, - vcm_traits); + diagonalize_traits); return 0; } diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h similarity index 78% rename from Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h rename to Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h index 9831893a6ec..aee2d3363b6 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vcm_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h @@ -3,10 +3,14 @@ namespace CGAL { /*! \ingroup PkgSolver -The class `Eigen_vcm_traits` provides an interface to the diagonalization of Variance-Covariance Matrices of \ref thirdpartyEigen "Eigen". -The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. +The class `Eigen_diagonalize_traits` provides an interface to the +diagonalization of covariance matrices of \ref thirdpartyEigen +"Eigen". -\cgalModels `VCMTraits` +The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be +available on the system. + +\cgalModels `DiagonalizeTraits` `FT`: floating type @@ -24,7 +28,7 @@ Example template -class Eigen_vcm_traits{ +class Eigen_diagonalize_traits{ public: static bool diff --git a/Solver_interface/doc/Solver_interface/CGAL/Internal_vcm_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h similarity index 78% rename from Solver_interface/doc/Solver_interface/CGAL/Internal_vcm_traits.h rename to Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h index 0af6d0bbcae..44699475782 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Internal_vcm_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h @@ -3,9 +3,11 @@ namespace CGAL { /*! \ingroup PkgSolver -The class `Internal_vcm_traits` provides an internal implementation for the diagonalization of Variance-Covariance Matrices. +The class `Internal_diagonalize_traits` provides an internal +implementation for the diagonalization of Variance-Covariance +Matrices. -\cgalModels `VCMTraits` +\cgalModels `DiagonalizeTraits` `FT`: floating type @@ -20,7 +22,7 @@ Example template -class Internal_vcm_traits{ +class Internal_diagonalize_traits{ public: static bool diff --git a/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h b/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h similarity index 84% rename from Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h rename to Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h index 4befedd5e5b..00341ec9266 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/VCMTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h @@ -3,8 +3,9 @@ \cgalConcept Concept providing functions to extract eigenvectors and eigenvalue -from covariance matrices represented by an array `a`. For example, a -matrix of dimension 3 is defined as follows: +from covariance matrices represented by an array `a`, using symmetric +diagonalization. For example, a matrix of dimension 3 is defined as +follows:
    \f$ \begin{bmatrix} a[0] & a[1] & a[2] \\ @@ -12,11 +13,11 @@ matrix of dimension 3 is defined as follows: a[2] & a[4] & a[5] \\ \end{bmatrix}\f$
    -\cgalHasModel `CGAL::Eigen_vcm_traits` -\cgalHasModel `CGAL::Internal_vcm_traits` +\cgalHasModel `CGAL::Eigen_diagonalize_traits` +\cgalHasModel `CGAL::Internal_diagonalize_traits` */ template -class VCMTraits +class DiagonalizeTraits { public: /// fill `eigenvalues` with the eigenvalues of the covariance matrix represented by `cov`. diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index 1713c6412e2..c076230edfb 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -28,17 +28,19 @@ - `SparseLinearAlgebraTraits_d` - `SparseLinearAlgebraTraitsWithFactor_d` - `SvdTraits` -- `VCMTraits` +- `DiagonalizeTraits` ## Classes ## - `CGAL::Eigen_solver_traits` - `CGAL::Eigen_svd` -- `CGAL::Eigen_vcm_traits` +- `CGAL::Eigen_diagonalize_traits` - `CGAL::Eigen_matrix` - `CGAL::Eigen_vector` - `CGAL::Eigen_sparse_matrix` - `CGAL::Eigen_sparse_symmetric_matrix` +- `CGAL::Internal_diagonalize_traits` +- `CGAL::Lapack_svd` */ diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index b2102ef6689..d2cc68e8cbb 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -16,20 +16,20 @@ equivalent models for other solvers, for example those found in the Intel Math Kernel Library (MKL). -\section SectionSolverVCM Matrix Diagonalization +\section SectionSolverDiagonalize Matrix Diagonalization -The concept `VCMTraits` defines an interface for the +The concept `DiagonalizeTraits` defines an interface for the diagonalization and computation of eigenvectors and eigenvalues of a symmetric matrix. `T` is the number type and `dim` is the dimension of the matrices and vector (set to 3 by default). We provide two models for this concept: -- `Eigen_vcm_traits` uses the \ref thirdpartyEigen library. -- `Internal_vcm_traits` is an internal implementation that does not +- `Eigen_diagonalize_traits` uses the \ref thirdpartyEigen library. +- `Internal_diagonalize_traits` is an internal implementation that does not depend on another library. Although both models achieve the same computation, -`Eigen_vcm_traits` is faster and should thus be used if the +`Eigen_diagonalize_traits` is faster and should thus be used if the \ref thirdpartyEigen library is available. The eigenvalues are stored in ascending order and eigenvectors are stored in accordance. diff --git a/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp b/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp index b092ff87fcf..ef96a3cd5c2 100644 --- a/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp +++ b/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp @@ -1,9 +1,9 @@ #include #ifdef CGAL_EIGEN3_ENABLED -#include +#include #else -#include +#include #endif @@ -12,9 +12,9 @@ typedef CGAL::cpp11::array Eigen_matrix; typedef CGAL::cpp11::array Eigen_vector; typedef CGAL::cpp11::array Eigen_three_vectors; #ifdef CGAL_EIGEN3_ENABLED -typedef CGAL::Eigen_vcm_traits Vcm_traits; +typedef CGAL::Eigen_diagonalize_traits Diagonalize_traits; #else -typedef CGAL::Internal_vcm_traits Vcm_traits; +typedef CGAL::Internal_diagonalize_traits Diagonalize_traits; #endif int main(void) @@ -27,9 +27,9 @@ int main(void) Eigen_vector eigenvalues; Eigen_three_vectors eigenvectors; - if (!(Vcm_traits::diagonalize_selfadjoint_covariance_matrix (covariance, - eigenvalues, - eigenvectors))) + if (!(Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, + eigenvalues, + eigenvectors))) { std::cerr << "Error: cannot diagonalize matrix" << std::endl; return -1; diff --git a/Solver_interface/include/CGAL/Eigen_vcm_traits.h b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h similarity index 93% rename from Solver_interface/include/CGAL/Eigen_vcm_traits.h rename to Solver_interface/include/CGAL/Eigen_diagonalize_traits.h index edc7de0d763..9be27f3c27a 100644 --- a/Solver_interface/include/CGAL/Eigen_vcm_traits.h +++ b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h @@ -18,8 +18,8 @@ // Author(s) : Jocelyn Meyron and Quentin Mérigot // -#ifndef CGAL_EIGEN_VCM_TRAITS_H -#define CGAL_EIGEN_VCM_TRAITS_H +#ifndef CGAL_EIGEN_DIAGONALIZE_TRAITS_H +#define CGAL_EIGEN_DIAGONALIZE_TRAITS_H #include #include @@ -28,11 +28,11 @@ namespace CGAL { -/// A model of the concept `VCMTraits` using \ref thirdpartyEigen. -/// \cgalModels `VCMTraits` +/// A model of the concept `DiagonalizeTraits` using \ref thirdpartyEigen. +/// \cgalModels `DiagonalizeTraits` template -class Eigen_vcm_traits{ +class Eigen_diagonalize_traits{ typedef Eigen::Matrix Matrix; typedef Eigen::Matrix Vector; @@ -146,4 +146,4 @@ public: } // namespace CGAL -#endif // CGAL_EIGEN_VCM_TRAITS_H +#endif // CGAL_EIGEN_DIAGONALIZE_TRAITS_H diff --git a/Solver_interface/include/CGAL/Internal_vcm_traits.h b/Solver_interface/include/CGAL/Internal_diagonalize_traits.h similarity index 95% rename from Solver_interface/include/CGAL/Internal_vcm_traits.h rename to Solver_interface/include/CGAL/Internal_diagonalize_traits.h index 57f3bc10735..8d6bbee1993 100644 --- a/Solver_interface/include/CGAL/Internal_vcm_traits.h +++ b/Solver_interface/include/CGAL/Internal_diagonalize_traits.h @@ -1,15 +1,15 @@ -#ifndef CGAL_INTERNAL_VCM_TRAITS_H -#define CGAL_INTERNAL_VCM_TRAITS_H +#ifndef CGAL_INTERNAL_DIAGONALIZE_TRAITS_H +#define CGAL_INTERNAL_DIAGONALIZE_TRAITS_H #include namespace CGAL { - /// A model of the concept `VCMTraits` - /// \cgalModels `VCMTraits` + /// A model of the concept `DiagonalizeTraits` + /// \cgalModels `DiagonalizeTraits` template -class Internal_vcm_traits{ +class Internal_diagonalize_traits{ public: static bool @@ -244,4 +244,4 @@ class Internal_vcm_traits{ } // namespace CGAL -#endif // CGAL_INTERNAL_VCM_TRAITS_H +#endif // CGAL_INTERNAL_DIAGONALIZE_TRAITS_H From bb0d1c7b32739750dd2d9202f976dea06029670e Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 31 Aug 2015 09:29:07 +0200 Subject: [PATCH 41/61] Removed unused eigen_symmetric API files --- .../linear_least_squares_fitting_points_2.h | 2 +- Solver_interface/include/CGAL/eigen.h | 229 ------------------ Solver_interface/include/CGAL/eigen_2.h | 121 --------- 3 files changed, 1 insertion(+), 351 deletions(-) delete mode 100644 Solver_interface/include/CGAL/eigen.h delete mode 100644 Solver_interface/include/CGAL/eigen_2.h diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h index 19a806d222f..4578d3afe99 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h @@ -22,7 +22,7 @@ #include #include -#include + #include #ifdef CGAL_EIGEN3_ENABLED diff --git a/Solver_interface/include/CGAL/eigen.h b/Solver_interface/include/CGAL/eigen.h deleted file mode 100644 index 92064d2a17f..00000000000 --- a/Solver_interface/include/CGAL/eigen.h +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) 2005 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); 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. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Bruno Levy, Pierre Alliez - -#ifndef CGAL_EIGEN_H -#define CGAL_EIGEN_H - -#include -#include - -namespace CGAL { - -namespace internal { - -template -void eigen_symmetric(const FT *mat, - const int n, - FT *eigen_vectors, - FT *eigen_values, - const int MAX_ITER = 100) -{ - static const FT EPSILON = (FT)0.00001; - - // number of entries in mat - int nn = (n*(n+1))/2; - - // copy matrix - FT *a = new FT[nn]; - int ij; - for(ij=0; ij a_normEPS && nb_iter < MAX_ITER) - { - nb_iter++; - FT thr_nn = thr / nn; - - for(int l=1; l< n; l++) - { - for(int m=l+1; m<=n; m++) - { - // compute sinx and cosx - int lq = (l*l-l)/2; - int mq = (m*m-m)/2; - - int lm = l + mq; - FT a_lm = a[lm]; - FT a_lm_2 = a_lm * a_lm; - - if(a_lm_2 < thr_nn) - continue; - - int ll = l + lq; - int mm = m + mq; - FT a_ll = a[ll]; - FT a_mm = a[mm]; - - FT delta = a_ll - a_mm; - - FT x; - if(delta == 0.0) - x = (FT) - CGAL_PI / 4; - else - x = (FT)(- std::atan( (a_lm+a_lm) / delta ) / 2.0); - - FT sinx = std::sin(x); - FT cosx = std::cos(x); - FT sinx_2 = sinx * sinx; - FT cosx_2 = cosx * cosx; - FT sincos = sinx * cosx; - - // rotate L and M columns - int ilv = n*(l-1); - int imv = n*(m-1); - - int i; - for( i=1; i<=n;i++ ) - { - if( (i!=l) && (i!=m) ) - { - int iq = (i*i-i)/2; - - int im; - if( i -#include -#include - -namespace CGAL { - -namespace internal { - - // extract eigenvalues and eigenvectors from a 2x2 symmetric - // positive definite matrix. - // Note: computations involve a square root. - // Matrix numbering: - // a b - // b c - // Eigen values and vectors are sorted in descendent order. - template - void eigen_symmetric_2(const typename K::FT *matrix, // a b c - std::pair& eigen_vectors, - std::pair& eigen_values) - { - // types - typedef typename K::FT FT; - typedef typename K::Vector_2 Vector; - - // for better reading - FT a = matrix[0]; - FT b = matrix[1]; - FT c = matrix[2]; - FT p = c*c - 2*a*c + 4*b*b + a*a; - CGAL_assertion(a >= 0.0 && c >= 0.0); - - // degenerate or isotropic case - if(p == 0.0) - { - // unit eigen values by default - eigen_values.first = eigen_values.second = (FT)1.0; - - // any vector is eigen vector - // the 2D canonical frame is output by default - eigen_vectors.first = Vector((FT)1.0,(FT)0.0); - eigen_vectors.second = Vector((FT)0.0,(FT)1.0); - } - else - { - if(b == 0.0) - { - if(a>=c) - { - eigen_values.first = a; - eigen_values.second = c; - eigen_vectors.first = Vector((FT)1.0, (FT)0.0); - eigen_vectors.second = Vector((FT)0.0, (FT)1.0); - } - else - { - eigen_values.first = c; - eigen_values.second = a; - eigen_vectors.first = Vector((FT)0.0, (FT)1.0); - eigen_vectors.second = Vector((FT)1.0, (FT)0.0); - } - } - else // generic case - { - FT l1 = (FT)(0.5 * ( -1*CGAL::sqrt(p) + c + a)); - FT l2 = (FT)(0.5 * ( CGAL::sqrt(p) + c + a)); - - // all eigen values of a symmetric positive - // definite matrix must be real and positive - // we saturate the values if this is not the - // case for floating point computations. - l1 = (l1 < (FT)0.0) ? (FT)0.0 : l1; - l2 = (l2 < (FT)0.0) ? (FT)0.0 : l2; - - // sort eigen values and vectors in descendent order. - if(l1 >= l2) - { - eigen_values.first = l1; - eigen_values.second = l2; - eigen_vectors.first = Vector((FT)1.0, (FT)(-(CGAL::sqrt(p)-c+a) / (2*b))); - eigen_vectors.second = Vector((FT)1.0, (FT)( (CGAL::sqrt(p)+c-a) / (2*b))); - } - else - { - eigen_values.first = l2; - eigen_values.second = l1; - eigen_vectors.first = Vector((FT)1.0, (FT)( (CGAL::sqrt(p)+c-a) / (2*b))); - eigen_vectors.second = Vector((FT)1.0, (FT)(-(CGAL::sqrt(p)-c+a) / (2*b))); - } - } // end generic case - } // end non-degenerate case - } // end eigen_symmetric_2 -} // end namespace internal - -} //namespace CGAL - -#endif // CGAL_EIGEN_2_H From ad02c45b1307e66a096f478d0636e77ae1fb5d16 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 31 Aug 2015 09:34:17 +0200 Subject: [PATCH 42/61] Wrapper to automatically use Eigen_diagonalize if Eigen is available or Internal_diagonalize otherwise --- .../Approximate_min_ellipsoid_d_impl.h | 21 ++----- .../include/CGAL/Monge_via_jet_fitting.h | 49 +++++++++------- ..._linear_least_squares_fitting_points_2.cpp | 21 ++----- ..._linear_least_squares_fitting_points_3.cpp | 20 ++----- ...inear_least_squares_fitting_segments_3.cpp | 23 ++------ ...linear_least_squares_fitting_spheres_3.cpp | 14 ++--- .../include/CGAL/Default_diagonalize_traits.h | 58 +++++++++++++++++++ 7 files changed, 106 insertions(+), 100 deletions(-) create mode 100644 Solver_interface/include/CGAL/Default_diagonalize_traits.h diff --git a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h index f740211bf95..6b90635b5e9 100644 --- a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h +++ b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h @@ -19,11 +19,7 @@ // Author(s) : Kaspar Fischer -#ifdef CGAL_EIGEN3_ENABLED -#include -#else -#include -#endif +#include #include @@ -161,13 +157,8 @@ namespace CGAL { CGAL::cpp11::array eigenvectors; // Note: not neces. normalized. CGAL::cpp11::array eigenvalues; // Note: sorted ascendent. -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix + CGAL::Default_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (matrix, eigenvalues, eigenvectors); -#else - CGAL::Internal_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (matrix, eigenvalues, eigenvectors); -#endif // normalize eigenvectors: double l1=1.0/std::sqrt(eigenvectors[2]*eigenvectors[2]+ @@ -208,13 +199,9 @@ namespace CGAL { CGAL::cpp11::array eigenvectors; // Note: not necessarily normalized. CGAL::cpp11::array eigenvalues; // Note: sorted ascendent. -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix + + CGAL::Default_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (matrix, eigenvalues, eigenvectors); -#else - CGAL::Internal_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (matrix, eigenvalues, eigenvectors); -#endif // normalize eigenvectors: double l1 = 1.0/std::sqrt(eigenvectors[0] * eigenvectors[0]+ // x^2 diff --git a/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h b/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h index da1502f5bc6..597acffea5c 100644 --- a/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h +++ b/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h @@ -22,8 +22,8 @@ #include #include #include -#include #include +#include #include #include #ifdef CGAL_EIGEN3_ENABLED @@ -362,27 +362,30 @@ compute_PCA(InputIterator begin, InputIterator end) // assemble covariance matrix as a // semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 - FT covariance[6] = {xx,xy,yy,xz,yz,zz}; - FT eigen_values[3]; - FT eigen_vectors[9]; + // 0 1 2 + // 3 4 + // 5 + CGAL::cpp11::array covariance = {{ xx,xy,xz,yy,yz,zz }}; + CGAL::cpp11::array eigen_values = {{ 0., 0., 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - CGAL::internal::eigen_symmetric(covariance,3,eigen_vectors,eigen_values); + CGAL::Default_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values, eigen_vectors); + //store in m_pca_basis for (int i=0; i<3; i++) { - m_pca_basis[i].first = eigen_values[i]; + m_pca_basis[i].first = eigen_values[2-i]; } - Vector_3 v1(eigen_vectors[0],eigen_vectors[1],eigen_vectors[2]); + + Vector_3 v1(eigen_vectors[6],eigen_vectors[7],eigen_vectors[8]); m_pca_basis[0].second = v1; Vector_3 v2(eigen_vectors[3],eigen_vectors[4],eigen_vectors[5]); m_pca_basis[1].second = v2; - Vector_3 v3(eigen_vectors[6],eigen_vectors[7],eigen_vectors[8]); + Vector_3 v3(eigen_vectors[0],eigen_vectors[1],eigen_vectors[2]); m_pca_basis[2].second = v3; switch_to_direct_orientation(m_pca_basis[0].second, m_pca_basis[1].second, @@ -523,15 +526,17 @@ compute_Monge_basis(const FT* A, Monge_form& monge_form) //in the new orthonormal basis (Y,Z) of the tangent plane : weingarten = inv *(1/det) * weingarten * change_XuXv2YZ; - //switch to eigen_symmetric algo for diagonalization of weingarten - FT W[3] = {weingarten(0,0), weingarten(1,0), weingarten(1,1)}; - FT eval[2]; - FT evec[4]; - //eval in decreasing order - CGAL::internal::eigen_symmetric(W,2,evec,eval); + // diagonalization of weingarten + CGAL::cpp11::array W = {{ weingarten(0,0), weingarten(1,0), weingarten(1,1) }}; + CGAL::cpp11::array eval = {{ 0., 0. }}; + CGAL::cpp11::array evec = {{ 0., 0., 0., 0. }}; - Vector_3 d_max = evec[0]*Y + evec[1]*Z, - d_min = evec[2]*Y + evec[3]*Z; + //eval in increasing order + CGAL::Default_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix + (W, eval, evec); + + Vector_3 d_max = evec[2]*Y + evec[3]*Z, + d_min = evec[0]*Y + evec[1]*Z; switch_to_direct_orientation(d_max, d_min, normal); Aff_transformation change_basis (d_max[0], d_max[1], d_max[2], @@ -547,8 +552,8 @@ compute_Monge_basis(const FT* A, Monge_form& monge_form) monge_form.maximal_principal_direction() = L2D_converter(this->change_world2fitting.inverse()(d_max)); monge_form.minimal_principal_direction() = L2D_converter(this->change_world2fitting.inverse()(d_min)); monge_form.normal_direction() = L2D_converter(this->change_world2fitting.inverse()(normal)); - monge_form.coefficients()[0] = L2D_NTconverter()(eval[0]); - monge_form.coefficients()[1] = L2D_NTconverter()(eval[1]); + monge_form.coefficients()[0] = L2D_NTconverter()(eval[1]); + monge_form.coefficients()[1] = L2D_NTconverter()(eval[0]); } //end else } diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp index 5ad47866509..b8aa1207cc3 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp @@ -3,11 +3,7 @@ #include #include #include -#include - -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif +#include #include #include @@ -37,12 +33,7 @@ void test_2D() quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); std::cout << "done (quality: " << quality << ")" << std::endl; @@ -84,12 +75,8 @@ void test_2D_point_set(const unsigned int nb_points) quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); + std::cout << "done (quality: " << quality << ")" << std::endl; if(!line.is_horizontal()) diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp index 6a1399e6204..bd94792cf91 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp @@ -3,10 +3,7 @@ #include #include -#include -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif +#include #include @@ -49,12 +46,7 @@ void fit_point_set(std::list& points, quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),kernel, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); std::cout << "done (quality: " << quality << ")" << std::endl; @@ -62,12 +54,8 @@ void fit_point_set(std::list& points, quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>(),kernel, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); + std::cout << "done (quality: " << quality << ")" << std::endl; } diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp index 54df04e3094..3804156aedd 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp @@ -5,10 +5,7 @@ #include #include #include -#include -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif +#include #include #include @@ -39,26 +36,14 @@ FT fit_set(std::list& segments, quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>(),kernel, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); - + CGAL::Default_diagonalize_traits()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>(),kernel, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); - - return quality; + return quality; } diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp index 6cbdacb4740..d064d2034c5 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp @@ -2,6 +2,7 @@ #include #include +#include #include @@ -34,28 +35,23 @@ int main(void) Kernel kernel; Point centroid; -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits diagonalize_traits; -#else - CGAL::Internal_diagonalize_traits diagonalize_traits; -#endif linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>(),kernel, - diagonalize_traits); + CGAL::Default_diagonalize_traits()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>(),kernel, - diagonalize_traits); + CGAL::Default_diagonalize_traits()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>(),kernel, - diagonalize_traits); + CGAL::Default_diagonalize_traits()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>(),kernel, - diagonalize_traits); + CGAL::Default_diagonalize_traits()); return 0; } diff --git a/Solver_interface/include/CGAL/Default_diagonalize_traits.h b/Solver_interface/include/CGAL/Default_diagonalize_traits.h new file mode 100644 index 00000000000..93ead75f01b --- /dev/null +++ b/Solver_interface/include/CGAL/Default_diagonalize_traits.h @@ -0,0 +1,58 @@ +#ifndef CGAL_DEFAULT_DIAGONALIZE_TRAITS_H +#define CGAL_DEFAULT_DIAGONALIZE_TRAITS_H + +#ifdef CGAL_EIGEN3_ENABLED +#include +#else +#include +#endif + + +namespace CGAL { + + + // Wrapper class designed to automatically use + // Eigen_diagonalize_traits if Eigen is available and otherwise use + // the fallback Internal_diagonalize_traits class. + +template +class Default_diagonalize_traits{ + +#ifdef CGAL_EIGEN3_ENABLED + typedef Eigen_diagonalize_traits Base; +#else + typedef Internal_diagonalize_traits Base; +#endif + +public: + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues) + { + return Base::diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues); + } + + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors) + { + return Base::diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); + } + + // Extract the eigenvector associated to the largest eigenvalue + static bool + extract_largest_eigenvector_of_covariance_matrix ( + const cpp11::array& cov, + cpp11::array &normal) + { + return Base::extract_largest_eigenvector_of_covariance_matrix (cov, normal); + } +}; + + +} // namespace CGAL + +#endif // CGAL_DEFAULT_DIAGONALIZE_TRAITS_H From 0875fa17ffaf43b229b9fde02a72e5ac4bfbc423 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 31 Aug 2015 09:34:17 +0200 Subject: [PATCH 43/61] Wrapper to automatically use Eigen_diagonalize if Eigen is available or Internal_diagonalize otherwise --- .../Approximate_min_ellipsoid_d_impl.h | 21 ++----- .../include/CGAL/Monge_via_jet_fitting.h | 49 +++++++++------- .../CGAL/linear_least_squares_fitting_2.h | 21 +------ .../CGAL/linear_least_squares_fitting_3.h | 19 +----- .../linear_least_squares_fitting_points_2.h | 7 --- ..._linear_least_squares_fitting_points_2.cpp | 21 ++----- ..._linear_least_squares_fitting_points_3.cpp | 20 ++----- ...inear_least_squares_fitting_segments_3.cpp | 23 ++------ ...linear_least_squares_fitting_spheres_3.cpp | 14 ++--- .../include/CGAL/Default_diagonalize_traits.h | 58 +++++++++++++++++++ 10 files changed, 112 insertions(+), 141 deletions(-) create mode 100644 Solver_interface/include/CGAL/Default_diagonalize_traits.h diff --git a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h index f740211bf95..6b90635b5e9 100644 --- a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h +++ b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h @@ -19,11 +19,7 @@ // Author(s) : Kaspar Fischer -#ifdef CGAL_EIGEN3_ENABLED -#include -#else -#include -#endif +#include #include @@ -161,13 +157,8 @@ namespace CGAL { CGAL::cpp11::array eigenvectors; // Note: not neces. normalized. CGAL::cpp11::array eigenvalues; // Note: sorted ascendent. -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix + CGAL::Default_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (matrix, eigenvalues, eigenvectors); -#else - CGAL::Internal_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (matrix, eigenvalues, eigenvectors); -#endif // normalize eigenvectors: double l1=1.0/std::sqrt(eigenvectors[2]*eigenvectors[2]+ @@ -208,13 +199,9 @@ namespace CGAL { CGAL::cpp11::array eigenvectors; // Note: not necessarily normalized. CGAL::cpp11::array eigenvalues; // Note: sorted ascendent. -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix + + CGAL::Default_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (matrix, eigenvalues, eigenvectors); -#else - CGAL::Internal_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (matrix, eigenvalues, eigenvectors); -#endif // normalize eigenvectors: double l1 = 1.0/std::sqrt(eigenvectors[0] * eigenvectors[0]+ // x^2 diff --git a/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h b/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h index da1502f5bc6..597acffea5c 100644 --- a/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h +++ b/Jet_fitting_3/include/CGAL/Monge_via_jet_fitting.h @@ -22,8 +22,8 @@ #include #include #include -#include #include +#include #include #include #ifdef CGAL_EIGEN3_ENABLED @@ -362,27 +362,30 @@ compute_PCA(InputIterator begin, InputIterator end) // assemble covariance matrix as a // semi-definite matrix. // Matrix numbering: - // 0 - // 1 2 - // 3 4 5 - FT covariance[6] = {xx,xy,yy,xz,yz,zz}; - FT eigen_values[3]; - FT eigen_vectors[9]; + // 0 1 2 + // 3 4 + // 5 + CGAL::cpp11::array covariance = {{ xx,xy,xz,yy,yz,zz }}; + CGAL::cpp11::array eigen_values = {{ 0., 0., 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; // solve for eigenvalues and eigenvectors. - // eigen values are sorted in descending order, + // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - CGAL::internal::eigen_symmetric(covariance,3,eigen_vectors,eigen_values); + CGAL::Default_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigen_values, eigen_vectors); + //store in m_pca_basis for (int i=0; i<3; i++) { - m_pca_basis[i].first = eigen_values[i]; + m_pca_basis[i].first = eigen_values[2-i]; } - Vector_3 v1(eigen_vectors[0],eigen_vectors[1],eigen_vectors[2]); + + Vector_3 v1(eigen_vectors[6],eigen_vectors[7],eigen_vectors[8]); m_pca_basis[0].second = v1; Vector_3 v2(eigen_vectors[3],eigen_vectors[4],eigen_vectors[5]); m_pca_basis[1].second = v2; - Vector_3 v3(eigen_vectors[6],eigen_vectors[7],eigen_vectors[8]); + Vector_3 v3(eigen_vectors[0],eigen_vectors[1],eigen_vectors[2]); m_pca_basis[2].second = v3; switch_to_direct_orientation(m_pca_basis[0].second, m_pca_basis[1].second, @@ -523,15 +526,17 @@ compute_Monge_basis(const FT* A, Monge_form& monge_form) //in the new orthonormal basis (Y,Z) of the tangent plane : weingarten = inv *(1/det) * weingarten * change_XuXv2YZ; - //switch to eigen_symmetric algo for diagonalization of weingarten - FT W[3] = {weingarten(0,0), weingarten(1,0), weingarten(1,1)}; - FT eval[2]; - FT evec[4]; - //eval in decreasing order - CGAL::internal::eigen_symmetric(W,2,evec,eval); + // diagonalization of weingarten + CGAL::cpp11::array W = {{ weingarten(0,0), weingarten(1,0), weingarten(1,1) }}; + CGAL::cpp11::array eval = {{ 0., 0. }}; + CGAL::cpp11::array evec = {{ 0., 0., 0., 0. }}; - Vector_3 d_max = evec[0]*Y + evec[1]*Z, - d_min = evec[2]*Y + evec[3]*Z; + //eval in increasing order + CGAL::Default_diagonalize_traits::diagonalize_selfadjoint_covariance_matrix + (W, eval, evec); + + Vector_3 d_max = evec[2]*Y + evec[3]*Z, + d_min = evec[0]*Y + evec[1]*Z; switch_to_direct_orientation(d_max, d_min, normal); Aff_transformation change_basis (d_max[0], d_max[1], d_max[2], @@ -547,8 +552,8 @@ compute_Monge_basis(const FT* A, Monge_form& monge_form) monge_form.maximal_principal_direction() = L2D_converter(this->change_world2fitting.inverse()(d_max)); monge_form.minimal_principal_direction() = L2D_converter(this->change_world2fitting.inverse()(d_min)); monge_form.normal_direction() = L2D_converter(this->change_world2fitting.inverse()(normal)); - monge_form.coefficients()[0] = L2D_NTconverter()(eval[0]); - monge_form.coefficients()[1] = L2D_NTconverter()(eval[1]); + monge_form.coefficients()[0] = L2D_NTconverter()(eval[1]); + monge_form.coefficients()[1] = L2D_NTconverter()(eval[0]); } //end else } diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h index 30b28a9e1eb..5d2bd42c6c8 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h @@ -29,12 +29,7 @@ #include #include #include -#include - -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif - +#include #include namespace CGAL { @@ -77,12 +72,7 @@ linear_least_squares_fitting_2(InputIterator first, typedef typename Kernel_traits::Kernel Kernel; return CGAL::linear_least_squares_fitting_2 (first,beyond,line,centroid,tag,Kernel(), -#ifdef CGAL_EIGEN3_ENABLED - Eigen_diagonalize_traits() -#else - Internal_diagonalize_traits() -#endif - ); + Default_diagonalize_traits()); } template < typename InputIterator, @@ -99,12 +89,7 @@ linear_least_squares_fitting_2(InputIterator first, typedef typename Kernel_traits::Kernel Kernel; typename Kernel::Point_2 centroid; // unused return CGAL::linear_least_squares_fitting_2(first,beyond,line,centroid,tag,Kernel(), -#ifdef CGAL_EIGEN3_ENABLED - Eigen_diagonalize_traits() -#else - Internal_diagonalize_traits() -#endif - ); + Default_diagonalize_traits()); } diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h index 37f33fa180c..448bc024725 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h @@ -29,10 +29,7 @@ #include #include -#include -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif +#include #include @@ -80,12 +77,7 @@ linear_least_squares_fitting_3(InputIterator first, typedef typename std::iterator_traits::value_type Value_type; typedef typename Kernel_traits::Kernel Kernel; return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag,Kernel(), -#ifdef CGAL_EIGEN3_ENABLED - Eigen_diagonalize_traits() -#else - Internal_diagonalize_traits() -#endif - ); + Default_diagonalize_traits()); } @@ -105,12 +97,7 @@ linear_least_squares_fitting_3(InputIterator first, typedef typename Kernel_traits::Kernel Kernel; typename Kernel::Point_3 centroid; // not used by caller return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag,Kernel(), -#ifdef CGAL_EIGEN3_ENABLED - Eigen_diagonalize_traits() -#else - Internal_diagonalize_traits() -#endif - ); + Default_diagonalize_traits()); } diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h index 4578d3afe99..e65a1321153 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_points_2.h @@ -22,13 +22,6 @@ #include #include - -#include - -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif - #include #include diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp index 5ad47866509..b8aa1207cc3 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_2.cpp @@ -3,11 +3,7 @@ #include #include #include -#include - -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif +#include #include #include @@ -37,12 +33,7 @@ void test_2D() quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); std::cout << "done (quality: " << quality << ")" << std::endl; @@ -84,12 +75,8 @@ void test_2D_point_set(const unsigned int nb_points) quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_2(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),k, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); + std::cout << "done (quality: " << quality << ")" << std::endl; if(!line.is_horizontal()) diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp index 6a1399e6204..bd94792cf91 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_points_3.cpp @@ -3,10 +3,7 @@ #include #include -#include -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif +#include #include @@ -49,12 +46,7 @@ void fit_point_set(std::list& points, quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),line,centroid,CGAL::Dimension_tag<0>(),kernel, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); std::cout << "done (quality: " << quality << ")" << std::endl; @@ -62,12 +54,8 @@ void fit_point_set(std::list& points, quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>()); quality = linear_least_squares_fitting_3(points.begin(),points.end(),plane,centroid,CGAL::Dimension_tag<0>(),kernel, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); + std::cout << "done (quality: " << quality << ")" << std::endl; } diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp index 54df04e3094..3804156aedd 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_segments_3.cpp @@ -5,10 +5,7 @@ #include #include #include -#include -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif +#include #include #include @@ -39,26 +36,14 @@ FT fit_set(std::list& segments, quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),line,centroid,CGAL::Dimension_tag<1>(),kernel, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); - + CGAL::Default_diagonalize_traits()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>()); quality = linear_least_squares_fitting_3(segments.begin(),segments.end(),plane,centroid,CGAL::Dimension_tag<1>(),kernel, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); - - return quality; + return quality; } diff --git a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp index 6cbdacb4740..d064d2034c5 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp +++ b/Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_spheres_3.cpp @@ -2,6 +2,7 @@ #include #include +#include #include @@ -34,28 +35,23 @@ int main(void) Kernel kernel; Point centroid; -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits diagonalize_traits; -#else - CGAL::Internal_diagonalize_traits diagonalize_traits; -#endif linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<3>(),kernel, - diagonalize_traits); + CGAL::Default_diagonalize_traits()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),line,centroid,CGAL::Dimension_tag<2>(),kernel, - diagonalize_traits); + CGAL::Default_diagonalize_traits()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<3>(),kernel, - diagonalize_traits); + CGAL::Default_diagonalize_traits()); linear_least_squares_fitting_3(spheres.begin(),spheres.end(),plane,centroid,CGAL::Dimension_tag<2>(),kernel, - diagonalize_traits); + CGAL::Default_diagonalize_traits()); return 0; } diff --git a/Solver_interface/include/CGAL/Default_diagonalize_traits.h b/Solver_interface/include/CGAL/Default_diagonalize_traits.h new file mode 100644 index 00000000000..93ead75f01b --- /dev/null +++ b/Solver_interface/include/CGAL/Default_diagonalize_traits.h @@ -0,0 +1,58 @@ +#ifndef CGAL_DEFAULT_DIAGONALIZE_TRAITS_H +#define CGAL_DEFAULT_DIAGONALIZE_TRAITS_H + +#ifdef CGAL_EIGEN3_ENABLED +#include +#else +#include +#endif + + +namespace CGAL { + + + // Wrapper class designed to automatically use + // Eigen_diagonalize_traits if Eigen is available and otherwise use + // the fallback Internal_diagonalize_traits class. + +template +class Default_diagonalize_traits{ + +#ifdef CGAL_EIGEN3_ENABLED + typedef Eigen_diagonalize_traits Base; +#else + typedef Internal_diagonalize_traits Base; +#endif + +public: + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues) + { + return Base::diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues); + } + + static bool + diagonalize_selfadjoint_covariance_matrix( + const cpp11::array& cov, + cpp11::array& eigenvalues, + cpp11::array& eigenvectors) + { + return Base::diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); + } + + // Extract the eigenvector associated to the largest eigenvalue + static bool + extract_largest_eigenvector_of_covariance_matrix ( + const cpp11::array& cov, + cpp11::array &normal) + { + return Base::extract_largest_eigenvector_of_covariance_matrix (cov, normal); + } +}; + + +} // namespace CGAL + +#endif // CGAL_DEFAULT_DIAGONALIZE_TRAITS_H From 7bac51993fa5eb4188f1a46705b6112deb1fc32c Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 1 Sep 2015 10:52:35 +0200 Subject: [PATCH 44/61] Moved NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h into Solver package --- .../doc/Solver_interface/CGAL/Eigen_solver_traits.h | 2 +- .../NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {Surface_mesh_skeletonization/doc/Surface_mesh_skeletonization => Solver_interface/doc/Solver_interface}/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h (100%) diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h index a22a9812b50..c758ed4ca92 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h @@ -7,7 +7,7 @@ namespace CGAL { The class `Eigen_solver_traits` provides an interface to the sparse solvers of \ref thirdpartyEigen "Eigen". The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. -\cgalModels `SparseLinearAlgebraTraitsWithFactor_d` and `#NormalEquationSparseLinearAlgebraTraits_d` +\cgalModels `SparseLinearAlgebraTraitsWithFactor_d` and `NormalEquationSparseLinearAlgebraTraits_d` `T`: a sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver diff --git a/Surface_mesh_skeletonization/doc/Surface_mesh_skeletonization/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h b/Solver_interface/doc/Solver_interface/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h similarity index 100% rename from Surface_mesh_skeletonization/doc/Surface_mesh_skeletonization/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h rename to Solver_interface/doc/Solver_interface/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h From b8f9d59dc9311ac35623ba267ba8396487fdf4cf Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 1 Sep 2015 11:10:27 +0200 Subject: [PATCH 45/61] Correcting/improving doc --- ...ionSparseLinearAlgebraTraitsWithFactor_d.h | 3 ++- .../doc/Solver_interface/Solver_interface.txt | 27 +++++++++++-------- .../examples/Solver_interface/CMakeLists.txt | 19 +++++++++---- .../Solver_interface/diagonalize_matrix.cpp | 5 ++-- .../singular_value_decomposition.cpp | 4 +-- 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Solver_interface/doc/Solver_interface/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h b/Solver_interface/doc/Solver_interface/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h index 9767d45aa7d..81520f973b7 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h +++ b/Solver_interface/doc/Solver_interface/Concepts/NormalEquationSparseLinearAlgebraTraitsWithFactor_d.h @@ -1,6 +1,7 @@ /*! -\ingroup PkgMeanCurvatureSkeleton3Concepts +\ingroup PkgSolverConcepts + \cgalConcept diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index d2cc68e8cbb..3df20d90a0c 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -7,13 +7,18 @@ namespace CGAL { \cgalAutoToc \authors %CGAL Editorial Board +Several \cgal packages have to solve linear systems with dense or +sparse matrices. This package provides concepts and models for that +purpose. +We generally provide models using the \ref thirdpartyEigen +library. Wrappers for the Eigen classes `Eigen_matrix` and +`Eigen_vector` are also provided when needed. -Several \cgal packages have to solve linear systems with dense or sparse matrices. -This package provides concepts and models for that purpose. Most of the models we provide - use the \ref thirdpartyEigen library. It is straightforward to develop -equivalent models for other solvers, for example those found in the -Intel Math Kernel Library (MKL). +It is straightforward to develop equivalent models for +other solvers, for example those found in the Intel Math Kernel +Library (MKL). \section SectionSolverDiagonalize Matrix Diagonalization @@ -36,6 +41,7 @@ in ascending order and eigenvectors are stored in accordance. This is an example of an eigendecomposition of a matrix using this class: + \cgalExample{Solver_interface/diagonalize_matrix.cpp} @@ -58,12 +64,11 @@ and this solver: \section SectionSolverSparse Sparse Solvers -An interface to all sparse solvers from the \ref thirdpartyEigen -library is provided through the class -`Eigen_solver_traits`. This solver traits class can be used for an -iterative or a direct, symmetric or general sparse solvers. The -specific solver to be used must be given as template -parameter. +An interface to the sparse solvers from the \ref thirdpartyEigen +library is provided through the class `Eigen_solver_traits`. This +solver traits class can be used for an iterative or a direct, +symmetric or general sparse solvers. The specific solver to be used +must be given as template parameter. Each \cgal package using a sparse solver specifies which type of matrix and solver is required: diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index a379afcb686..eead05a759f 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -14,19 +14,28 @@ if ( CGAL_FOUND ) include( CGAL_CreateSingleSourceCGALProgram ) + include_directories (BEFORE "../include") + + # Use Eigen or BLAS and LAPACK (optional) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) if (NOT EIGEN3_FOUND) - message(STATUS "This program requires the Eigen library, and will not be compiled.") + find_package(LAPACK) + if(LAPACK_FOUND) + include( ${LAPACK_USE_FILE} ) + endif(LAPACK_FOUND) else() include( ${EIGEN3_USE_FILE} ) endif() - - include_directories (BEFORE "../include") + if(EIGEN3_FOUND OR LAPACK_FOUND) + create_single_source_cgal_program( "singular_value_decomposition.cpp" ) + endif() + + if(EIGEN3_FOUND) + create_single_source_cgal_program( "sparse_solvers.cpp" ) + endif() - create_single_source_cgal_program( "singular_value_decomposition.cpp" ) create_single_source_cgal_program( "diagonalize_matrix.cpp" ) - create_single_source_cgal_program( "sparse_solvers.cpp" ) else() diff --git a/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp b/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp index ef96a3cd5c2..43d5a7acdc9 100644 --- a/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp +++ b/Solver_interface/examples/Solver_interface/diagonalize_matrix.cpp @@ -6,11 +6,12 @@ #include #endif - typedef double FT; typedef CGAL::cpp11::array Eigen_matrix; typedef CGAL::cpp11::array Eigen_vector; typedef CGAL::cpp11::array Eigen_three_vectors; + +// If Eigen is enabled, use it, otherwise fallback to the internal model #ifdef CGAL_EIGEN3_ENABLED typedef CGAL::Eigen_diagonalize_traits Diagonalize_traits; #else @@ -20,6 +21,7 @@ typedef CGAL::Internal_diagonalize_traits Diagonalize_traits; int main(void) { Eigen_matrix covariance = {{ 0., 0., 0., 0., 0., 0. }}; + // Fill matrix with random numbers for (std::size_t i = 0; i < 6; ++ i) covariance[i] = rand (); @@ -34,7 +36,6 @@ int main(void) std::cerr << "Error: cannot diagonalize matrix" << std::endl; return -1; } - // Print result for (std::size_t i = 0; i < 3; ++ i) diff --git a/Solver_interface/examples/Solver_interface/singular_value_decomposition.cpp b/Solver_interface/examples/Solver_interface/singular_value_decomposition.cpp index 22d829f6f2b..11a14619ad0 100644 --- a/Solver_interface/examples/Solver_interface/singular_value_decomposition.cpp +++ b/Solver_interface/examples/Solver_interface/singular_value_decomposition.cpp @@ -1,10 +1,10 @@ -#include - +// If Eigen is available, use it, otherwise switch to Lapack #ifdef CGAL_EIGEN3_ENABLED #include #include #include typedef CGAL::Eigen_svd Svd; + #else #ifdef CGAL_LAPACK_ENABLED #include From e3ce17eb0a52817b2f1de492e9a2e7f39f82b907 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 1 Sep 2015 12:40:10 +0200 Subject: [PATCH 46/61] Update doc of PCA in accordance with Solver interface --- .../CGAL/linear_least_squares_fitting_2.h | 5 ++++- .../CGAL/linear_least_squares_fitting_3.h | 20 +++++++++++++++++-- .../Principal_component_analysis/dependencies | 1 + .../CGAL/linear_least_squares_fitting_2.h | 2 +- .../CGAL/linear_least_squares_fitting_3.h | 2 +- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_2.h b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_2.h index a7d779586db..ca5f7c65f02 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_2.h +++ b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_2.h @@ -13,6 +13,8 @@ The tag `tag` identifies the dimension to be considered from the objects. For po The class `K` is the kernel in which the value type of the `InputIterator` is defined. It can be omitted and deduced automatically from the value type. +The class `Diagonalize_traits` is a model of `DiagonalizeTraits`. It can be omitted: if Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined then an overload using `Eigen_diagonalize_traits` is provided. Otherwise, the internal implementation `Internal_diagonalize_traits` is used. + \cgalHeading{Requirements}
      @@ -35,7 +37,8 @@ InputIterator beyond, typename K::Line_2 & line, typename K::Point_2 & centroid, const Tag & tag, -const K & k); +const K & k, +const Diagonalize_traits& diagonalize_traits); } /* namespace CGAL */ diff --git a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h index f3bb5e1313a..414aeb67cf1 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h @@ -64,6 +64,14 @@ The class `K` is the kernel in which the value type of `InputIterator` is defined. It can be omitted and deduced automatically from the value type. +The class `Diagonalize_traits` is a model of `DiagonalizeTraits`. It +can be omitted: if Eigen 3 (or greater) is available and +`CGAL_EIGEN3_ENABLED` is defined then an overload using +`Eigen_diagonalize_traits` is provided. Otherwise, the internal +implementation `Internal_diagonalize_traits` is used. + + + \cgalHeading{Requirements}
        @@ -84,7 +92,8 @@ InputIterator beyond, typename K::Line_3& line, typename K::Point_3& centroid, const Tag& tag, -const K& k); +const K& k, +const Diagonalize_traits& diagonalize_traits); /*! \brief computes the best fitting 3D plane of a 3D object set in the @@ -100,6 +109,12 @@ of `InputIterator` is defined. It can be omitted and deduced automatically from the value type. The tag `tag` identifies the dimension to be considered from the objects (see above). +The class `Diagonalize_traits` is a model of `DiagonalizeTraits`. It +can be omitted: if Eigen 3 (or greater) is available and +`CGAL_EIGEN3_ENABLED` is defined then an overload using +`Eigen_diagonalize_traits` is provided. Otherwise, the internal +implementation `Internal_diagonalize_traits` is used. + \cgalHeading{Requirements}
          @@ -119,7 +134,8 @@ InputIterator beyond, typename K::Plane_3& plane, typename K::Point_3& centroid, const Tag& tag, -const K& k); +const K& k, +const Diagonalize_traits& diagonalize_traits); /// @} diff --git a/Principal_component_analysis/doc/Principal_component_analysis/dependencies b/Principal_component_analysis/doc/Principal_component_analysis/dependencies index a4d5f76715e..5b5101754b5 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/dependencies +++ b/Principal_component_analysis/doc/Principal_component_analysis/dependencies @@ -4,3 +4,4 @@ STL_Extension Algebraic_foundations Circulator Stream_support +Solver_interface diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h index 5d2bd42c6c8..a385da3e392 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h @@ -46,7 +46,7 @@ linear_least_squares_fitting_2(InputIterator first, typename Kernel::Point_2& centroid, const Tag& tag, const Kernel& kernel, - const Diagonalize_traits diagonalize_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename std::iterator_traits::value_type Value_type; return internal::linear_least_squares_fitting_2(first, beyond, line, diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h index 448bc024725..d0e6189965b 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h @@ -52,7 +52,7 @@ linear_least_squares_fitting_3(InputIterator first, typename Kernel::Point_3& centroid, const Tag& tag, // dimension tag, ranges from 0 to 3 const Kernel& kernel, - const Diagonalize_traits diagonalize_traits) + const Diagonalize_traits& diagonalize_traits) { typedef typename std::iterator_traits::value_type Value_type; return internal::linear_least_squares_fitting_3(first, beyond, object, From 91a58591e923da882b9ec8a8dec00134e5e17d3f Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 2 Sep 2015 15:29:21 +0200 Subject: [PATCH 47/61] Improving doc --- Documentation/doc/Documentation/Installation.txt | 2 +- .../CGAL/linear_least_squares_fitting_3.h | 1 - .../PackageDescription.txt | 1 + .../Solver_interface/CGAL/Eigen_diagonalize_traits.h | 5 ++--- .../doc/Solver_interface/CGAL/Eigen_solver_traits.h | 3 +-- .../CGAL/Internal_diagonalize_traits.h | 6 ++---- .../doc/Solver_interface/PackageDescription.txt | 3 ++- Solver_interface/doc/Solver_interface/dependencies | 1 - .../Surface_mesh_parameterization.txt | 5 ----- .../doc/Surface_mesh_parameterization/examples.txt | 11 ++++++----- 10 files changed, 15 insertions(+), 23 deletions(-) diff --git a/Documentation/doc/Documentation/Installation.txt b/Documentation/doc/Documentation/Installation.txt index 5f1f1cee0d1..68cc4adc3e5 100644 --- a/Documentation/doc/Documentation/Installation.txt +++ b/Documentation/doc/Documentation/Installation.txt @@ -513,7 +513,7 @@ The \sc{Eigen} web site is `http://eigen.tu \sc{Lapack} is a `Fortran` library for linear algebra. In \cgal, \sc{Lapack} is an alternative to \sc{Eigen} for singular value decomposition for the \ref -kgJet_fitting_3 and the \ref PkgRidges_3 packages. +PkgJet_fitting_3 and the \ref PkgRidges_3 packages. The \sc{Lapack} web site is `http://www.netlib.org/lapack/`. diff --git a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h index 414aeb67cf1..c115a235d47 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h @@ -71,7 +71,6 @@ can be omitted: if Eigen 3 (or greater) is available and implementation `Internal_diagonalize_traits` is used. - \cgalHeading{Requirements}
            diff --git a/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt b/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt index aec05605884..db46aee96ae 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt +++ b/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt @@ -27,6 +27,7 @@ \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{3.2} +\cgalPkgDependsOn{\ref PkgSolverSummary} \cgalPkgBib{cgal:ap-pcad} \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{Principal Component Analysis,pca.zip,Operations on Polygons,polygon.zip,Operations on Polyhedra,polyhedron_3.zip} diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h index aee2d3363b6..78630853eac 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h @@ -13,9 +13,8 @@ available on the system. \cgalModels `DiagonalizeTraits` -`FT`: floating type - -`dim`: dimension of the matrices and vectors +\tparam FT Number type +\tparam dim Dimension of the matrices and vectors \sa http://eigen.tuxfamily.org diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h index c758ed4ca92..b6ace272000 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h @@ -10,8 +10,7 @@ The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available o \cgalModels `SparseLinearAlgebraTraitsWithFactor_d` and `NormalEquationSparseLinearAlgebraTraits_d` -`T`: a sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver -`Eigen::BiCGSTAB` for `double`. +\tparam T A sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver `Eigen::BiCGSTAB` for `double`. \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` diff --git a/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h index 44699475782..9c0cee1cff1 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h @@ -9,10 +9,8 @@ Matrices. \cgalModels `DiagonalizeTraits` - -`FT`: floating type - -`dim`: dimension of the matrices and vectors +\tparam FT Number type +\tparam dim Dimension of the matrices and vectors Example -------------- diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index c076230edfb..1fc89d13a10 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -25,10 +25,11 @@ ## Concepts ## +- `DiagonalizeTraits` - `SparseLinearAlgebraTraits_d` - `SparseLinearAlgebraTraitsWithFactor_d` - `SvdTraits` -- `DiagonalizeTraits` + ## Classes ## diff --git a/Solver_interface/doc/Solver_interface/dependencies b/Solver_interface/doc/Solver_interface/dependencies index 8dc4d44a8cc..5d9a51f054b 100644 --- a/Solver_interface/doc/Solver_interface/dependencies +++ b/Solver_interface/doc/Solver_interface/dependencies @@ -3,4 +3,3 @@ Kernel_23 STL_Extension Algebraic_foundations Miscellany -Jet_fitting_3 diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt index 4a0e711b544..b0db3a7d7d6 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt @@ -760,11 +760,6 @@ Square, circular and two-points border parameterizations are good starting point Obviously, this package would benefit of having robust algorithms which transform arbitrary meshes into topological disks. -\example Surface_mesh_parameterization/Simple_parameterization.cpp -\example Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp -\example Surface_mesh_parameterization/Complete_parameterization_example.cpp -\example Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp - */ } /* namespace CGAL */ diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt index ad452ebbd2c..0049c0118bb 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt @@ -1,5 +1,6 @@ -/// \example Surface_mesh_parameterization/Simple_parameterization.cpp -/// \example Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp -/// \example Surface_mesh_parameterization/Complete_parameterization_example.cpp -/// \example Surface_mesh_parameterization/Eigen_parameterization.cpp -/// \example Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp +/*! + \example Surface_mesh_parameterization/Simple_parameterization.cpp + \example Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp + \example Surface_mesh_parameterization/Complete_parameterization_example.cpp + \example Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp +*/ From 09f3659353aa9b6168b66ebbc5c7526c1449df3f Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 2 Sep 2015 15:29:21 +0200 Subject: [PATCH 48/61] Improving doc --- Documentation/doc/Documentation/Installation.txt | 2 +- .../CGAL/linear_least_squares_fitting_3.h | 1 - .../PackageDescription.txt | 1 + .../Solver_interface/CGAL/Eigen_diagonalize_traits.h | 5 ++--- .../doc/Solver_interface/CGAL/Eigen_solver_traits.h | 3 +-- .../CGAL/Internal_diagonalize_traits.h | 6 ++---- .../doc/Solver_interface/PackageDescription.txt | 3 ++- Solver_interface/doc/Solver_interface/dependencies | 1 - .../examples/Solver_interface/sparse_solvers.cpp | 8 ++++---- .../Surface_mesh_parameterization.txt | 5 ----- .../doc/Surface_mesh_parameterization/examples.txt | 11 ++++++----- 11 files changed, 19 insertions(+), 27 deletions(-) diff --git a/Documentation/doc/Documentation/Installation.txt b/Documentation/doc/Documentation/Installation.txt index 5f1f1cee0d1..68cc4adc3e5 100644 --- a/Documentation/doc/Documentation/Installation.txt +++ b/Documentation/doc/Documentation/Installation.txt @@ -513,7 +513,7 @@ The \sc{Eigen} web site is `http://eigen.tu \sc{Lapack} is a `Fortran` library for linear algebra. In \cgal, \sc{Lapack} is an alternative to \sc{Eigen} for singular value decomposition for the \ref -kgJet_fitting_3 and the \ref PkgRidges_3 packages. +PkgJet_fitting_3 and the \ref PkgRidges_3 packages. The \sc{Lapack} web site is `http://www.netlib.org/lapack/`. diff --git a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h index 414aeb67cf1..c115a235d47 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h @@ -71,7 +71,6 @@ can be omitted: if Eigen 3 (or greater) is available and implementation `Internal_diagonalize_traits` is used. - \cgalHeading{Requirements}
              diff --git a/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt b/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt index aec05605884..db46aee96ae 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt +++ b/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt @@ -27,6 +27,7 @@ \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{3.2} +\cgalPkgDependsOn{\ref PkgSolverSummary} \cgalPkgBib{cgal:ap-pcad} \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{Principal Component Analysis,pca.zip,Operations on Polygons,polygon.zip,Operations on Polyhedra,polyhedron_3.zip} diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h index aee2d3363b6..78630853eac 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h @@ -13,9 +13,8 @@ available on the system. \cgalModels `DiagonalizeTraits` -`FT`: floating type - -`dim`: dimension of the matrices and vectors +\tparam FT Number type +\tparam dim Dimension of the matrices and vectors \sa http://eigen.tuxfamily.org diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h index c758ed4ca92..b6ace272000 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_solver_traits.h @@ -10,8 +10,7 @@ The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available o \cgalModels `SparseLinearAlgebraTraitsWithFactor_d` and `NormalEquationSparseLinearAlgebraTraits_d` -`T`: a sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver -`Eigen::BiCGSTAB` for `double`. +\tparam T A sparse solver of \ref thirdpartyEigen "Eigen". The default solver is the iterative bi-congugate gradient stabilized solver `Eigen::BiCGSTAB` for `double`. \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` diff --git a/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h index 44699475782..9c0cee1cff1 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h @@ -9,10 +9,8 @@ Matrices. \cgalModels `DiagonalizeTraits` - -`FT`: floating type - -`dim`: dimension of the matrices and vectors +\tparam FT Number type +\tparam dim Dimension of the matrices and vectors Example -------------- diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index c076230edfb..1fc89d13a10 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -25,10 +25,11 @@ ## Concepts ## +- `DiagonalizeTraits` - `SparseLinearAlgebraTraits_d` - `SparseLinearAlgebraTraitsWithFactor_d` - `SvdTraits` -- `DiagonalizeTraits` + ## Classes ## diff --git a/Solver_interface/doc/Solver_interface/dependencies b/Solver_interface/doc/Solver_interface/dependencies index 8dc4d44a8cc..5d9a51f054b 100644 --- a/Solver_interface/doc/Solver_interface/dependencies +++ b/Solver_interface/doc/Solver_interface/dependencies @@ -3,4 +3,3 @@ Kernel_23 STL_Extension Algebraic_foundations Miscellany -Jet_fitting_3 diff --git a/Solver_interface/examples/Solver_interface/sparse_solvers.cpp b/Solver_interface/examples/Solver_interface/sparse_solvers.cpp index f549a055456..a9e0ba4824b 100644 --- a/Solver_interface/examples/Solver_interface/sparse_solvers.cpp +++ b/Solver_interface/examples/Solver_interface/sparse_solvers.cpp @@ -1,6 +1,3 @@ -#include - -#include #include #include @@ -21,6 +18,8 @@ int main(void) Eigen_matrix A (degree); Eigen_vector diag (degree); + + // Randomly make some coefficients of the matrix non-zero for (std::size_t i = 0; i < nb_nonzero_coef; ++ i) { std::size_t x = rand () % degree; @@ -38,7 +37,8 @@ int main(void) for (std::size_t i = 0; i < degree; ++ i) A.add_coef (i, i, diag.vector()[i]); - + + // Create sparse matrix A.assemble_matrix(); Eigen_vector X (degree); diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt index 4a0e711b544..b0db3a7d7d6 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/Surface_mesh_parameterization.txt @@ -760,11 +760,6 @@ Square, circular and two-points border parameterizations are good starting point Obviously, this package would benefit of having robust algorithms which transform arbitrary meshes into topological disks. -\example Surface_mesh_parameterization/Simple_parameterization.cpp -\example Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp -\example Surface_mesh_parameterization/Complete_parameterization_example.cpp -\example Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp - */ } /* namespace CGAL */ diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt index ad452ebbd2c..0049c0118bb 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt @@ -1,5 +1,6 @@ -/// \example Surface_mesh_parameterization/Simple_parameterization.cpp -/// \example Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp -/// \example Surface_mesh_parameterization/Complete_parameterization_example.cpp -/// \example Surface_mesh_parameterization/Eigen_parameterization.cpp -/// \example Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp +/*! + \example Surface_mesh_parameterization/Simple_parameterization.cpp + \example Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp + \example Surface_mesh_parameterization/Complete_parameterization_example.cpp + \example Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp +*/ From 26aab5fc5c95a14b2e90d19c045b70e0e736eec8 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 3 Sep 2015 14:36:47 +0200 Subject: [PATCH 49/61] Use default diagonalization interface for VCM functions --- .../include/CGAL/vcm_estimate_edges.h | 14 ++++---- .../include/CGAL/vcm_estimate_normals.h | 35 +++++++------------ 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h b/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h index 09207f859da..370bcf3cc01 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_edges.h @@ -39,8 +39,11 @@ namespace CGAL { /// which however would result in selecting more points on sharper regions. /// More details are provided in \cgalCite{cgal:mog-vbcfe-11}. /// -/// \tparam VCM_traits is a model of `DiagonalizeTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined -/// then an overload using `Eigen_diagonalize_traits` is provided and this template parameter can be omitted. +/// \tparam VCM_traits is a model of `DiagonalizeTraits`. It can be +/// omitted: if Eigen 3 (or greater) is available and +/// `CGAL_EIGEN3_ENABLED` is defined then an overload using +/// `Eigen_diagonalize_traits` is provided. Otherwise, the internal +/// implementation `Internal_diagonalize_traits` is used. /// \sa CGAL::compute_vcm()` /// template @@ -72,12 +75,7 @@ vcm_is_on_feature_edge (cpp11::array &cov, double threshold) { return vcm_is_on_feature_edge(cov, threshold, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); } diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 7d41976f540..b86a15b6346 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -32,11 +32,7 @@ #include #include -#ifdef CGAL_EIGEN3_ENABLED -#include -#else -#include -#endif +#include #include #include @@ -370,9 +366,11 @@ vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input /// @tparam ForwardIterator iterator over input points. /// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = `Kernel::Point_3`. /// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = `Kernel::Vector_3`. -/// \tparam VCM_traits is a model of `DiagonalizeTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined -/// then an overload using `Eigen_diagonalize_traits` is provided and this template parameter can be omitted. - +/// \tparam VCM_traits is a model of `DiagonalizeTraits`. It can be +/// omitted: if Eigen 3 (or greater) is available and +/// `CGAL_EIGEN3_ENABLED` is defined then an overload using +/// `Eigen_diagonalize_traits` is provided. Otherwise, the internal +/// implementation `Internal_diagonalize_traits` is used. // This variant deduces the kernel from the point property map // and uses a radius for the convolution. template < typename ForwardIterator, @@ -411,8 +409,11 @@ vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input /// @tparam ForwardIterator iterator over input points. /// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = `Kernel::Point_3`. /// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = `Kernel::Vector_3`. -/// \tparam VCM_traits is a model of `DiagonalizeTraits`. If Eigen 3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined -/// then an overload using `Eigen_diagonalize_traits` is provided and this template parameter can be omitted. +/// \tparam VCM_traits is a model of `DiagonalizeTraits`. It can be +/// omitted: if Eigen 3 (or greater) is available and +/// `CGAL_EIGEN3_ENABLED` is defined then an overload using +/// `Eigen_diagonalize_traits` is provided. Otherwise, the internal +/// implementation `Internal_diagonalize_traits` is used. // This variant deduces the kernel from the point property map // and uses a number of neighbors for the convolution. @@ -455,12 +456,7 @@ vcm_estimate_normals (ForwardIterator first, double convolution_radius) { vcm_estimate_normals(first, beyond, point_pmap, normal_pmap, offset_radius, convolution_radius, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); } template < typename ForwardIterator, @@ -476,12 +472,7 @@ vcm_estimate_normals (ForwardIterator first, unsigned int nb_neighbors_convolve) { vcm_estimate_normals(first, beyond, point_pmap, normal_pmap, offset_radius, nb_neighbors_convolve, -#ifdef CGAL_EIGEN3_ENABLED - CGAL::Eigen_diagonalize_traits() -#else - CGAL::Internal_diagonalize_traits() -#endif - ); + CGAL::Default_diagonalize_traits()); } From a002127c0a0bffd26f9f13a7b298b2211dffe0d0 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 3 Sep 2015 14:37:31 +0200 Subject: [PATCH 50/61] Correction in doc of PCA (missing template) --- .../CGAL/linear_least_squares_fitting_2.h | 2 +- .../CGAL/linear_least_squares_fitting_3.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_2.h b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_2.h index ca5f7c65f02..304ca8581a9 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_2.h +++ b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_2.h @@ -30,7 +30,7 @@ omitted. \pre first != beyond. */ -template < typename InputIterator, typename K, typename Tag > +template < typename InputIterator, typename K, typename Tag, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, diff --git a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h index c115a235d47..8b47c02334b 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/doc/Principal_component_analysis/CGAL/linear_least_squares_fitting_3.h @@ -84,7 +84,7 @@ implementation `Internal_diagonalize_traits` is used. */ -template < typename InputIterator, typename K, typename Tag > +template < typename InputIterator, typename K, typename Tag, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, @@ -126,7 +126,7 @@ implementation `Internal_diagonalize_traits` is used.
            */ -template < typename InputIterator, typename K, typename Tag > +template < typename InputIterator, typename K, typename Tag, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_3(InputIterator first, InputIterator beyond, From f11e173a209d3a7969109cf482b6ecdb5f3ef7f6 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 3 Sep 2015 14:38:22 +0200 Subject: [PATCH 51/61] In scale space: replace internal PCA implementation by DiagonalizeTraits --- ...cale_space_surface_reconstruction_3_impl.h | 52 ++++++++++++++++--- .../Scale_space_surface_reconstruction_3.h | 1 + 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h index 934120ef536..dbeae87ca29 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h @@ -18,6 +18,8 @@ #ifndef CGAL_SCALE_SPACE_RECONSTRUCTION_3_SCALE_SPACE_SURFACE_RECONSTRUCTION_3_IMPL_H #define CGAL_SCALE_SPACE_RECONSTRUCTION_3_SCALE_SPACE_SURFACE_RECONSTRUCTION_3_IMPL_H +#include + //#include #ifdef CGAL_LINKED_WITH_TBB #include "tbb/blocked_range.h" @@ -162,21 +164,55 @@ public: return; Static_search search(_tree, _pts[i], _nn[i]); - Approximation pca( _nn[i] ); + + Point barycenter (0., 0., 0.); + FT weight_sum = 0.; unsigned int column = 0; + // Compute total weight for( typename Static_search::iterator nit = search.begin(); nit != search.end() && column < _nn[i]; - ++nit, ++column ) { - pca.set_point( column, boost::get<0>(nit->first), 1.0 / _nn[boost::get<1>(nit->first)] ); - } - + ++nit, ++column ) + weight_sum += (1.0 / _nn[boost::get<1>(nit->first)]); + + column = 0; + // Compute barycenter + for( typename Static_search::iterator nit = search.begin(); + nit != search.end() && column < _nn[i]; + ++nit, ++column ) + { + Vector v (CGAL::ORIGIN, boost::get<0>(nit->first)); + barycenter = barycenter + ((1.0 / _nn[boost::get<1>(nit->first)]) / weight_sum) * v; + } + + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; + column = 0; + // Compute covariance matrix of Weighted PCA + for( typename Static_search::iterator nit = search.begin(); + nit != search.end() && column < _nn[i]; + ++nit, ++column ) + { + Vector v (barycenter, boost::get<0>(nit->first)); + double w = (1.0 / _nn[boost::get<1>(nit->first)]); + v = w*v; + covariance[0] += w * v.x () * v.x (); + covariance[1] += w * v.x () * v.y (); + covariance[2] += w * v.x () * v.z (); + covariance[3] += w * v.y () * v.y (); + covariance[4] += w * v.y () * v.z (); + covariance[5] += w * v.z () * v.z (); + } + // Compute the weighted least-squares planar approximation of the point set. - if( !pca.compute() ) - return; + CGAL::cpp11::array vnorm = {{ 0., 0., 0. }}; + CGAL::Default_diagonalize_traits::extract_largest_eigenvector_of_covariance_matrix + (covariance, vnorm); // The vertex is moved by projecting it onto the plane // through the barycenter and orthogonal to the Eigen vector with smallest Eigen value. - _pts[i] = pca.fit( _pts[i] ); + Vector norm (vnorm[0], vnorm[1], vnorm[2]); + Vector b2p (barycenter, _pts[i]); + + _pts[i] = barycenter + b2p - ((norm * b2p) * norm); } }; // class AdvanceSS diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h index d230e7a9c5b..dae57b68e83 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h @@ -118,6 +118,7 @@ class Scale_space_surface_reconstruction_3 { public: typedef typename Gt::Point_3 Point; ///< defines the point type. + typedef typename Gt::Vector_3 Vector; ///< defines the vector type. typedef boost::tuple Point_and_int; private: From a107ae4fff338bb11e561343f86cd4102a672c86 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 3 Sep 2015 18:11:57 +0200 Subject: [PATCH 52/61] Update scale space (code + doc) using the DiagonalizeTraits concept --- .../Concepts/WeightedApproximation_3.h | 136 -------------- .../PackageDescription.txt | 5 - .../Scale_space_reconstruction_3.txt | 2 +- .../Scale_space_reconstruction_3/dependencies | 1 + ...cale_space_surface_reconstruction_3_impl.h | 4 +- .../Weighted_PCA_approximation_3.h | 177 ------------------ .../Scale_space_surface_reconstruction_3.h | 25 +-- 7 files changed, 12 insertions(+), 338 deletions(-) delete mode 100644 Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/Concepts/WeightedApproximation_3.h delete mode 100644 Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_approximation_3.h diff --git a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/Concepts/WeightedApproximation_3.h b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/Concepts/WeightedApproximation_3.h deleted file mode 100644 index 58c303a5add..00000000000 --- a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/Concepts/WeightedApproximation_3.h +++ /dev/null @@ -1,136 +0,0 @@ -//Orthogonal projection of a point onto a weighted PCA plane. -//Copyright (C) 2014 INRIA - Sophia Antipolis -// -//This program is free software: you can redistribute it and/or modify -//it under the terms of the GNU 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 . -// -// Author(s): Thijs van Lankveld - - -/// A concept for computing an approximation of a weighted point set. -/** \ingroup PkgScaleSpaceReconstruction3Concepts - * \cgalConcept - * This approximation can be used to fit other points to the point set. - * - * \cgalHasModel `CGAL::Weighted_PCA_approximation_3` - */ -class WeightedApproximation_3 { -public: -/// \name Types -/// \{ - typedef unspecified_type FT; ///< defines the field number type. - typedef unspecified_type Point; ///< defines the point type. - -/// \} - -public: -/// \name Constructors -/// \{ - /// constructs an approximation of a undefined point set. - /** The point set holds a fixed number of points with undefined coordinates. - * - * \param size is the size of the points set. - * - * \note this does not compute the approximation. - */ - WeightedApproximation_3( unsigned int size ); - -/// \} - - // computes the approximation of a point set. - /* Similar to constructing a approximation and calling - * [set_points(points_begin, points_end, weights_begin)](\ref WeightedApproximation_3::set_points ) - * - * \tparam PointIterator is an input iterator over the point collection. - * The value type of the iterator must be a `Point`. - * \tparam WeightIterator is an input iterator over the collection of - * weights. The value type of the iterator must be an `FT`. - * - * \param points_begin is an iterator to the first point. - * \param points_end is a past-the-end oterator for the points. - * \param weights_begin is an iterator to the weight of the first point. - * - * \pre The number of weights must be at least equal to the number of - * points. - */ - template < typename PointIterator, typename WeightIterator > - WeightedApproximation_3( PointIterator points_begin, PointIterator points_end, WeightIterator weights_begin ); - -public: -/// \name Point Set. -/// \{ - /// changes a weighted point in the set. - /** This invalidates the approximation. `compute()` should be called - * after all points have been set. - * \pre i must be smaller than the total size of the point set. - */ - void set_point( unsigned int i, const Point& p, const FT& w ); - - /// gives the size of the weighted point set. - std::size_t size() const; - -/// \} - - // changes the weighted point set. - /* After these points are set, the approximation is immediately computed. - * - * \tparam PointIterator is an input iterator over the point collection. - * The value type of the iterator must be a `Point`. - * \tparam WeightIterator is an input iterator over the collection of - * weights. The value type of the iterator must be an `FT`. - * - * \param points_begin is an iterator to the first point. - * \param points_end is a past-the-end iterator for the points. - * \param weights_begin is an iterator to the weight of the first point. - * - * \return whether the approximation converges. If the approximation does - * not converge this may indicate that the point set is too small, or the - * affine hull of the points cannot contain the approximation. - * - * \pre The points must fit in the approximation. - * \pre The number of weights must be at least equal to the number of - * points. - */ - template < typename PointIterator, typename WeightIterator > - bool set_points( PointIterator points_begin, PointIterator points_end, - WeightIterator weights_begin ); - -public: -/// \name Approximation -/// \{ - - /// computes the approximation. - /** \return whether the approximation converges. If the approximation does - * not converge this may indicate that the point set is too small, or the - * affine hull of the points cannot contain the approximation. - */ - bool compute(); - - /// checks whether the approximation has been computed successfully. - bool is_computed() const; -/// \} - -public: -/// \name Fitting -/// \{ - - /// fits a point to the approximation. - /** \param p is the point to fit. - * - * \return the point on the approximation closest to `p`. - * - * \pre The approximation must have been computed. - */ - Point fit( const Point& p ); -/// \} -}; // class WeightedApproximation_3 diff --git a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/PackageDescription.txt b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/PackageDescription.txt index 1ae18cbf86a..8351a47f4f8 100644 --- a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/PackageDescription.txt +++ b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/PackageDescription.txt @@ -26,14 +26,9 @@ \cgalClassifedRefPages -## Concepts ## - -- `WeightedApproximation_3` - ## Classes ## - `CGAL::Scale_space_surface_reconstruction_3` -- `CGAL::Weighted_PCA_approximation_3` */ diff --git a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/Scale_space_reconstruction_3.txt b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/Scale_space_reconstruction_3.txt index c16422509a8..beb6acb9d4a 100644 --- a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/Scale_space_reconstruction_3.txt +++ b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/Scale_space_reconstruction_3.txt @@ -90,7 +90,7 @@ The main class `Scale_space_surface_reconstruction_3` contains all the functiona The neighborhood size is estimated using `Orthogonal_k_neighbor_search`. The point set is generally stored in a `Orthogonal_k_neighbor_search::Tree`. When the neighborhood size is estimated, this tree is searched for nearest neighbors. -The scale-space is constructed at the original scale of the points. An iteration of increasing the scale is computed using a weighted PCA procedure. As described by Digne et al. \cgalCite{cgal:dmsl-ssmrp-11}, unlike similar methods this procedure does not lead to an undesirable clustering effect. By default the efficient \ref thirdpartyEigen library is used for this procedure. It is also possible to provide your own model for the `WeightedApproximation_3` concept. The weighted PCA procedure is performed locally per point, so it can be performed with parallel computing (linking with Intel TBB and passing the `Parallel_tag` to the reconstruction class is required). +The scale-space is constructed at the original scale of the points. An iteration of increasing the scale is computed using a weighted PCA procedure. As described by Digne et al. \cgalCite{cgal:dmsl-ssmrp-11}, unlike similar methods this procedure does not lead to an undesirable clustering effect. By default the efficient \ref thirdpartyEigen library is used for this procedure if available. Otherwise, the internal fallback `Internal_diagonalize_traits` is used. It is also possible to provide your own model for the `DiagonalizeTraits` concept. The weighted PCA procedure is performed locally per point, so it can be performed with parallel computing (linking with Intel TBB and passing the `Parallel_tag` to the reconstruction class is required). The mesh reconstruction is performed by filtering a \ref Chapter_3D_Alpha_Shapes "3D alpha shape" of the point set at a fixed scale. This filtering constructs a triangle for each regular facet; each singular facet results in two triangles facing opposite directions. diff --git a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/dependencies b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/dependencies index 73d4d9f43cf..9d74ca1bbde 100644 --- a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/dependencies +++ b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/dependencies @@ -4,3 +4,4 @@ STL_Extension Triangulation_3 Alpha_shapes_3 Spatial_searching +Solver_interface diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h index dbeae87ca29..cfb763a5a85 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h @@ -18,8 +18,6 @@ #ifndef CGAL_SCALE_SPACE_RECONSTRUCTION_3_SCALE_SPACE_SURFACE_RECONSTRUCTION_3_IMPL_H #define CGAL_SCALE_SPACE_RECONSTRUCTION_3_SCALE_SPACE_SURFACE_RECONSTRUCTION_3_IMPL_H -#include - //#include #ifdef CGAL_LINKED_WITH_TBB #include "tbb/blocked_range.h" @@ -204,7 +202,7 @@ public: // Compute the weighted least-squares planar approximation of the point set. CGAL::cpp11::array vnorm = {{ 0., 0., 0. }}; - CGAL::Default_diagonalize_traits::extract_largest_eigenvector_of_covariance_matrix + wA::extract_smallest_eigenvector_of_covariance_matrix (covariance, vnorm); // The vertex is moved by projecting it onto the plane diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_approximation_3.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_approximation_3.h deleted file mode 100644 index afeef08ed56..00000000000 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_approximation_3.h +++ /dev/null @@ -1,177 +0,0 @@ -//Copyright (C) 2014 INRIA - Sophia Antipolis -// -//This program is free software: you can redistribute it and/or modify -//it under the terms of the GNU 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 . -// -// Author(s): Thijs van Lankveld - - -#ifndef CGAL_SCALE_SPACE_RECONSTRUCTION_3_WEIGHTED_PCA_PROJECTION_3_H -#define CGAL_SCALE_SPACE_RECONSTRUCTION_3_WEIGHTED_PCA_PROJECTION_3_H - -#include - - -namespace CGAL { - -/// approximates a point set using a weighted least-squares plane. -/** \ingroup PkgScaleSpaceReconstruction3Classes - * The weighted least-squares planar approximation contains the barycenter - * of the points and is orthogonal to the eigenvector corresponding to the - * smallest eigenvalue. - * - * Point are fitted to this approximation by projecting them orthogonally onto - * the weighted least-squares plane. - * - * This class requires the eigenvector solvers of \ref thirdpartyEigen version - * 3.1.2 (or greater). - * - * \tparam Kernel the geometric traits class of the input and output. It - * must have a `RealEmbeddable` field number type. - * - * \note Irrespective of the geometric traits class, the approximation is - * always estimated up to double precision. - * - * \cgalModels `WeightedApproximation_3` - */ -template < class Kernel > -class Weighted_PCA_approximation_3 { -public: - typedef typename Kernel::FT FT; - typedef typename Kernel::Point_3 Point; - -private: - typedef Eigen::Matrix Matrix3D; // 3-by-dynamic double-value matrix. - typedef Eigen::Array Array1D; // 1-by-dynamic double-value array. - typedef Eigen::Matrix3d Matrix3; // 3-by-3 double-value matrix. - typedef Eigen::Vector3d Vector3; // 3-by-1 double-value matrix. - typedef Eigen::SelfAdjointEigenSolver< Matrix3 > EigenSolver; // Eigen value decomposition solver. - -private: - bool _comp; // Whether the eigenvalues are computed. - - Matrix3D _pts; // points. - Array1D _wts; // weights. - - Vector3 _bary; // barycenter. - Vector3 _norm; // normal. - -public: - // constructs an default approximation to hold the points. - /* \param size is the number of points that will be added. - */ - Weighted_PCA_approximation_3( unsigned int size ): _comp(false), _pts(3,size), _wts(1,size) {} - - // computes the weighted least-squares planar approximation of a point set. - /* Similar to constructing an empty projection and calling - * [set_points(points_begin, points_end, weights_begin)](\ref WeightedApproximation_3::set_points ) - * - * \tparam PointIterator is an input iterator over the point collection. - * The value type of the iterator must be a `Point`. - * \tparam WeightIterator is an input iterator over the collection of - * weights. The value type of the iterator must be an `FT`. - * - * \param points_begin is an iterator to the first point. - * \param points_end is a past-the-end oterator for the points. - * \param weights_begin is an iterator to the weight of the first point. - */ - template < typename PointIterator, typename WeightIterator > - Weighted_PCA_approximation_3( PointIterator points_begin, PointIterator points_end, WeightIterator weights_begin ) - : _comp(false) { - std::size_t size = std::distance( points_begin, points_end ); - _pts = Matrix3D(3,size); - _wts = Array1D(1,size); - set_points( points_begin, points_end, weights_begin ); - } - -public: - // sets a weighted point in the collection. - void set_point( unsigned int i, const Point& p, const FT& w ) { - _pts( 0, i ) = CGAL::to_double( p[0] ); - _pts( 1, i ) = CGAL::to_double( p[1] ); - _pts( 2, i ) = CGAL::to_double( p[2] ); - _wts( i ) = CGAL::to_double( w ); - _comp = false; - } - - // sets the weighted points and compute PCA. - template < typename PointIterator, typename WeightIterator > - bool set_points( PointIterator points_begin, PointIterator points_end, WeightIterator weights_begin ) { - for( unsigned int column = 0; points_begin != points_end; ++column, ++points_begin, ++weights_begin ) { - _pts( 0, column ) = CGAL::to_double( (*points_begin)[0] ); - _pts( 1, column ) = CGAL::to_double( (*points_begin)[1] ); - _pts( 2, column ) = CGAL::to_double( (*points_begin)[2] ); - _wts( column ) = CGAL::to_double( *weights_begin ); - } - return compute(); - } - - // gives the size of the weighted point set. - std::size_t size() const { return _pts.cols(); } - - // compute weighted PCA. - bool compute() { - // Construct the barycenter. - _bary = ( _pts.array().rowwise() * _wts ).rowwise().sum() / _wts.sum(); - - // Replace the points by their difference with the barycenter. - _pts = ( _pts.colwise() - _bary ).array().rowwise() * _wts; - - // Construct the weighted covariance matrix. - Matrix3 covar = Matrix3::Zero(); - for( int column = 0; column < _pts.cols(); ++column ) - covar += _wts.matrix()(column) * _pts.col(column) * _pts.col(column).transpose(); - - // Construct the Eigen system. - EigenSolver solver( covar ); - - // If the Eigen system does not converge, the vertex is not moved. - if( solver.info() != Eigen::Success ) - return false; - - // Find the Eigen vector with the smallest Eigen value. - std::ptrdiff_t index; - solver.eigenvalues().minCoeff( &index ); - if( solver.eigenvectors().col( index ).imag() != Vector3::Zero() ) { - // This should actually never happen, - // because the covariance matrix is symmetric! - CGAL_assertion( false ); - return false; - } - - // The normal is the Eigen vector with smallest Eigen value. - _norm = solver.eigenvectors().col( index ).real(); - _comp = true; - return true; - } - - // checks whether the weighted least-squares approximating plane has been computed. - bool is_computed() const { return _comp; } - -public: - // projects a point onto the weighted PCA plane. - Point fit( const Point& p ) { - CGAL_assertion( _comp ); - // The point is moved by projecting it onto the plane through the - // barycenter and orthogonal to the normal. - Vector3 to_p = Vector3( to_double( p[0] ), - to_double( p[1] ), - to_double( p[2] ) ) - _bary; - Vector3 proj = _bary + to_p - ( _norm.dot(to_p) * _norm ); - return Point( proj(0), proj(1), proj(2) ); - } -}; // class Weighted_PCA_approximation_3 - -} // namespace CGAL - -#endif // CGAL_SCALE_SPACE_RECONSTRUCTION_3_WEIGHTED_PCA_PROJECTION_3_H diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h index dae57b68e83..3462a7c92fb 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h @@ -36,13 +36,10 @@ #include #include #include +#include #include -#ifdef CGAL_EIGEN3_ENABLED -#include -#endif // CGAL_EIGEN3_ENABLED - #include namespace CGAL { @@ -99,22 +96,18 @@ namespace CGAL { * only has an impact on the run-time. * \tparam Sh determines whether to collect the surface per shell. It * must be a `Boolean_tag` type. The default value is `Tag_true`. - * \tparam wA must be a model of `WeightedPCAProjection_3` and determines how - * to approximate a weighted point set. If \ref thirdpartyEigen 3.1.2 (or - * greater) is available and CGAL_EIGEN3_ENABLED is defined, then - * `Weighted_PCA_approximation_3` is used by default. + * \tparam wA must be a model of `DiagonalizeTraits` and determines + * how to diagonalize a weighted covariance matrix to approximate a + * weighted point set. It can be omitted: if Eigen 3 (or greater) is + * available and `CGAL_EIGEN3_ENABLED` is defined then an overload + * using `Eigen_diagonalize_traits` is provided. Otherwise, the + * internal implementation `Internal_diagonalize_traits` is used. * \tparam Ct indicates whether to use concurrent processing. It must be * either `Sequential_tag` or `Parallel_tag` (the default value). */ -template < class Gt, class FS = Tag_true, class Sh = Tag_true, class wA = Default, class Ct = Parallel_tag > +template < class Gt, class FS = Tag_true, class Sh = Tag_true, + class wA = Default_diagonalize_traits, class Ct = Parallel_tag > class Scale_space_surface_reconstruction_3 { - typedef typename Default::Get< wA, -#ifdef CGAL_EIGEN3_ENABLED - Weighted_PCA_approximation_3 -#else // CGAL_EIGEN3_ENABLED - void -#endif // CGAL_EIGEN3_ENABLED - >::type Approximation; public: typedef typename Gt::Point_3 Point; ///< defines the point type. From 8410aab93cd4effb60b95317168dae93f81b0628 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 3 Sep 2015 18:55:19 +0200 Subject: [PATCH 53/61] Bugfix: function extract_largest_(...) is now called extract_smallest_(...) to be consistent with what is actually extracted. --- Point_set_processing_3/include/CGAL/vcm_estimate_normals.h | 2 +- .../doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h | 2 +- .../doc/Solver_interface/CGAL/Internal_diagonalize_traits.h | 2 +- .../doc/Solver_interface/Concepts/DiagonalizeTraits.h | 4 ++-- Solver_interface/include/CGAL/Default_diagonalize_traits.h | 6 +++--- Solver_interface/include/CGAL/Eigen_diagonalize_traits.h | 4 ++-- Solver_interface/include/CGAL/Internal_diagonalize_traits.h | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index b86a15b6346..7b6870f1a9e 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -343,7 +343,7 @@ vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input int i = 0; for (ForwardIterator it = first; it != beyond; ++it) { cpp11::array enormal = {{ 0,0,0 }}; - VCM_traits::extract_largest_eigenvector_of_covariance_matrix + VCM_traits::extract_smallest_eigenvector_of_covariance_matrix (cov[i], enormal); typename Kernel::Vector_3 normal(enormal[0], diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h index 78630853eac..7ffb72da7b9 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h @@ -42,7 +42,7 @@ public: cpp11::array& eigenvectors); static bool - extract_largest_eigenvector_of_covariance_matrix ( + extract_smallest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal); diff --git a/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h index 9c0cee1cff1..ad92d01143d 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h @@ -35,7 +35,7 @@ public: cpp11::array& eigenvectors); static bool - extract_largest_eigenvector_of_covariance_matrix ( + extract_smallest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal); diff --git a/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h b/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h index 00341ec9266..25fd7c7da3f 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h @@ -40,11 +40,11 @@ public: cpp11::array& eigenvectors); - /// Extract the eigenvector associated to the largest eigenvalue + /// Extract the eigenvector associated to the smallest eigenvalue /// of the covariance matrix represented by `cov`. /// \return `true` if the operation was successful and `false` otherwise. static bool - extract_largest_eigenvector_of_covariance_matrix ( + extract_smallest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal); }; diff --git a/Solver_interface/include/CGAL/Default_diagonalize_traits.h b/Solver_interface/include/CGAL/Default_diagonalize_traits.h index 93ead75f01b..a5211d99c39 100644 --- a/Solver_interface/include/CGAL/Default_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Default_diagonalize_traits.h @@ -42,13 +42,13 @@ public: return Base::diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); } - // Extract the eigenvector associated to the largest eigenvalue + // Extract the eigenvector associated to the smallest eigenvalue static bool - extract_largest_eigenvector_of_covariance_matrix ( + extract_smallest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal) { - return Base::extract_largest_eigenvector_of_covariance_matrix (cov, normal); + return Base::extract_smallest_eigenvector_of_covariance_matrix (cov, normal); } }; diff --git a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h index 9be27f3c27a..1f4e9ad4e4d 100644 --- a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h @@ -120,9 +120,9 @@ public: return res; } - // Extract the eigenvector associated to the largest eigenvalue + // Extract the eigenvector associated to the smallest eigenvalue static bool - extract_largest_eigenvector_of_covariance_matrix ( + extract_smallest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal) { diff --git a/Solver_interface/include/CGAL/Internal_diagonalize_traits.h b/Solver_interface/include/CGAL/Internal_diagonalize_traits.h index 8d6bbee1993..78daef64002 100644 --- a/Solver_interface/include/CGAL/Internal_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Internal_diagonalize_traits.h @@ -21,9 +21,9 @@ class Internal_diagonalize_traits{ return diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); } - // Extract the eigenvector associated to the largest eigenvalue + // Extract the eigenvector associated to the smallest eigenvalue static bool - extract_largest_eigenvector_of_covariance_matrix + extract_smallest_eigenvector_of_covariance_matrix (const cpp11::array& cov, cpp11::array &normal) { From 90b3528faceeb27f604e45aef69532851cf2630b Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 4 Sep 2015 11:04:02 +0200 Subject: [PATCH 54/61] Update doc with SparseLinear concepts --- .../doc/Solver_interface/Solver_interface.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 3df20d90a0c..cc021566810 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -64,11 +64,17 @@ and this solver: \section SectionSolverSparse Sparse Solvers +We define 3 concepts for sparse linear algebra: + +- `SparseLinearAlgebraTraits_d` +- `SparseLinearAlgebraTraitsWithFactor_d` +- `NormalEquationSparseLinearAlgebraTraits_d` + An interface to the sparse solvers from the \ref thirdpartyEigen -library is provided through the class `Eigen_solver_traits`. This -solver traits class can be used for an iterative or a direct, -symmetric or general sparse solvers. The specific solver to be used -must be given as template parameter. +library is provided as a model for these 3 concepts through the class +`Eigen_solver_traits`. This solver traits class can be used for an +iterative or a direct, symmetric or general sparse solvers. The +specific solver to be used must be given as template parameter. Each \cgal package using a sparse solver specifies which type of matrix and solver is required: From dd271ecca5039bee405b5d449836ec70f44f31a7 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 4 Sep 2015 15:13:57 +0200 Subject: [PATCH 55/61] Revert "Bugfix: function extract_largest_(...) is now called extract_smallest_(...) to be consistent with what is actually extracted." This reverts commit 8410aab93cd4effb60b95317168dae93f81b0628. --- Point_set_processing_3/include/CGAL/vcm_estimate_normals.h | 2 +- .../doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h | 2 +- .../doc/Solver_interface/CGAL/Internal_diagonalize_traits.h | 2 +- .../doc/Solver_interface/Concepts/DiagonalizeTraits.h | 4 ++-- Solver_interface/include/CGAL/Default_diagonalize_traits.h | 6 +++--- Solver_interface/include/CGAL/Eigen_diagonalize_traits.h | 4 ++-- Solver_interface/include/CGAL/Internal_diagonalize_traits.h | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 7b6870f1a9e..b86a15b6346 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -343,7 +343,7 @@ vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input int i = 0; for (ForwardIterator it = first; it != beyond; ++it) { cpp11::array enormal = {{ 0,0,0 }}; - VCM_traits::extract_smallest_eigenvector_of_covariance_matrix + VCM_traits::extract_largest_eigenvector_of_covariance_matrix (cov[i], enormal); typename Kernel::Vector_3 normal(enormal[0], diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h index 7ffb72da7b9..78630853eac 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_diagonalize_traits.h @@ -42,7 +42,7 @@ public: cpp11::array& eigenvectors); static bool - extract_smallest_eigenvector_of_covariance_matrix ( + extract_largest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal); diff --git a/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h index ad92d01143d..9c0cee1cff1 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Internal_diagonalize_traits.h @@ -35,7 +35,7 @@ public: cpp11::array& eigenvectors); static bool - extract_smallest_eigenvector_of_covariance_matrix ( + extract_largest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal); diff --git a/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h b/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h index 25fd7c7da3f..00341ec9266 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/DiagonalizeTraits.h @@ -40,11 +40,11 @@ public: cpp11::array& eigenvectors); - /// Extract the eigenvector associated to the smallest eigenvalue + /// Extract the eigenvector associated to the largest eigenvalue /// of the covariance matrix represented by `cov`. /// \return `true` if the operation was successful and `false` otherwise. static bool - extract_smallest_eigenvector_of_covariance_matrix ( + extract_largest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal); }; diff --git a/Solver_interface/include/CGAL/Default_diagonalize_traits.h b/Solver_interface/include/CGAL/Default_diagonalize_traits.h index a5211d99c39..93ead75f01b 100644 --- a/Solver_interface/include/CGAL/Default_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Default_diagonalize_traits.h @@ -42,13 +42,13 @@ public: return Base::diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); } - // Extract the eigenvector associated to the smallest eigenvalue + // Extract the eigenvector associated to the largest eigenvalue static bool - extract_smallest_eigenvector_of_covariance_matrix ( + extract_largest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal) { - return Base::extract_smallest_eigenvector_of_covariance_matrix (cov, normal); + return Base::extract_largest_eigenvector_of_covariance_matrix (cov, normal); } }; diff --git a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h index 1f4e9ad4e4d..9be27f3c27a 100644 --- a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h @@ -120,9 +120,9 @@ public: return res; } - // Extract the eigenvector associated to the smallest eigenvalue + // Extract the eigenvector associated to the largest eigenvalue static bool - extract_smallest_eigenvector_of_covariance_matrix ( + extract_largest_eigenvector_of_covariance_matrix ( const cpp11::array& cov, cpp11::array &normal) { diff --git a/Solver_interface/include/CGAL/Internal_diagonalize_traits.h b/Solver_interface/include/CGAL/Internal_diagonalize_traits.h index 78daef64002..8d6bbee1993 100644 --- a/Solver_interface/include/CGAL/Internal_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Internal_diagonalize_traits.h @@ -21,9 +21,9 @@ class Internal_diagonalize_traits{ return diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); } - // Extract the eigenvector associated to the smallest eigenvalue + // Extract the eigenvector associated to the largest eigenvalue static bool - extract_smallest_eigenvector_of_covariance_matrix + extract_largest_eigenvector_of_covariance_matrix (const cpp11::array& cov, cpp11::array &normal) { From 136de97318d024473d3c15c3d12b74ec0245a3b9 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 4 Sep 2015 16:01:46 +0200 Subject: [PATCH 56/61] Bugfix: DiagonalizeTraits now really returns largest eigenvalue + inversion of parameters in voronoi_covariance is corrected. --- .../Voronoi_covariance_3/voronoi_covariance_3.h | 12 +++++------- .../test/Point_set_processing_3/vcm_plane_test.cpp | 4 ++-- .../include/CGAL/Eigen_diagonalize_traits.h | 4 ++-- .../include/CGAL/Internal_diagonalize_traits.h | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h b/Point_set_processing_3/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h index f302e3c7e09..cf140b23841 100644 --- a/Point_set_processing_3/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h +++ b/Point_set_processing_3/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h @@ -79,8 +79,8 @@ namespace CGAL { template inline void operator () (const Point &a, - const Point &c, - const Point &b) + const Point &b, + const Point &c) { internal::covariance_matrix_tetrahedron (a[0], a[1], a[2], b[0], b[1], b[2], @@ -109,8 +109,8 @@ namespace CGAL { template inline void operator () (const Point &a, - const Point &c, - const Point &b) + const Point &b, + const Point &c) { const double vol = CGAL::volume(a, b, c, Point(CGAL::ORIGIN)); //std::cerr << "vol = " << vol << "\n"; @@ -168,12 +168,10 @@ namespace CGAL { typename Polyhedron::Halfedge_around_facet_circulator h0 = it->facet_begin(), hf = h0--, hs = cpp11::next(hf); - while(1) + while(hs != h0) { f (h0->vertex()->point(), hf->vertex()->point(), hs->vertex()->point()); - if (hs == h0) - break; ++hs; ++hf; } } diff --git a/Point_set_processing_3/test/Point_set_processing_3/vcm_plane_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/vcm_plane_test.cpp index 8e22d105b37..a62a31b7979 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/vcm_plane_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/vcm_plane_test.cpp @@ -30,11 +30,11 @@ int main (void) { std::cout << "Normal is " << points[0].second << std::endl; - // The normal at the origin should be (0, 0, -1) + // The normal at the origin should be (0, 0, 1) double epsilon=2e-5; assert(points[0].second.x() < epsilon && points[0].second.x() > -epsilon); assert(points[0].second.y() < epsilon && points[0].second.y() > -epsilon); - assert(points[0].second.z() < -1+epsilon && points[0].second.z() > -1-epsilon); + assert(points[0].second.z() < 1+epsilon && points[0].second.z() > 1-epsilon); return 0; } diff --git a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h index 9be27f3c27a..1c65e154e76 100644 --- a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h @@ -136,9 +136,9 @@ public: return false; } - // Eigenvalues are already sorted by increasing order + // Eigenvalues are sorted by increasing order for (unsigned int i = 0; i < dim; ++ i) - normal[i] = static_cast (eigenvectors(i,0)); + normal[i] = static_cast (eigenvectors(i,dim-1)); return true; } diff --git a/Solver_interface/include/CGAL/Internal_diagonalize_traits.h b/Solver_interface/include/CGAL/Internal_diagonalize_traits.h index 8d6bbee1993..99bac71ff8f 100644 --- a/Solver_interface/include/CGAL/Internal_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Internal_diagonalize_traits.h @@ -33,7 +33,7 @@ class Internal_diagonalize_traits{ diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors); for (std::size_t i = 0; i < dim; ++ i) - normal[i] = static_cast (eigenvectors(i)); + normal[i] = static_cast (eigenvectors[(dim*(dim-1))+i]); return true; } From e5c01e4e64d184b92d207c29b8dd4dd8979ab4be Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 4 Sep 2015 16:04:58 +0200 Subject: [PATCH 57/61] Update scale space with bugfix (DiagonalizeTraits returns largest eigenvector, not smallest, so it cannot be used here) --- .../Scale_space_surface_reconstruction_3_impl.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h index cfb763a5a85..e2d1ba0b337 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h @@ -182,7 +182,7 @@ public: barycenter = barycenter + ((1.0 / _nn[boost::get<1>(nit->first)]) / weight_sum) * v; } - CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; + CGAL::cpp11::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; column = 0; // Compute covariance matrix of Weighted PCA for( typename Static_search::iterator nit = search.begin(); @@ -190,7 +190,7 @@ public: ++nit, ++column ) { Vector v (barycenter, boost::get<0>(nit->first)); - double w = (1.0 / _nn[boost::get<1>(nit->first)]); + FT w = (1.0 / _nn[boost::get<1>(nit->first)]); v = w*v; covariance[0] += w * v.x () * v.x (); covariance[1] += w * v.x () * v.y (); @@ -201,13 +201,16 @@ public: } // Compute the weighted least-squares planar approximation of the point set. - CGAL::cpp11::array vnorm = {{ 0., 0., 0. }}; - wA::extract_smallest_eigenvector_of_covariance_matrix - (covariance, vnorm); + CGAL::cpp11::array eigenvectors = {{ 0., 0., 0., + 0., 0., 0., + 0., 0., 0. }}; + CGAL::cpp11::array eigenvalues = {{ 0., 0., 0. }}; + wA::diagonalize_selfadjoint_covariance_matrix + (covariance, eigenvalues, eigenvectors); // The vertex is moved by projecting it onto the plane // through the barycenter and orthogonal to the Eigen vector with smallest Eigen value. - Vector norm (vnorm[0], vnorm[1], vnorm[2]); + Vector norm (eigenvectors[0], eigenvectors[1], eigenvectors[2]); Vector b2p (barycenter, _pts[i]); _pts[i] = barycenter + b2p - ((norm * b2p) * norm); From 4e74f7e1da7a26a6da4e437cf1a2ea5eb5f13bdf Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 7 Sep 2015 08:09:15 +0200 Subject: [PATCH 58/61] Remove duplicate file (left in Kernel_d) --- .../Concepts/LinearAlgebraTraits_d.h | 183 ------------------ 1 file changed, 183 deletions(-) delete mode 100644 Solver_interface/doc/Solver_interface/Concepts/LinearAlgebraTraits_d.h diff --git a/Solver_interface/doc/Solver_interface/Concepts/LinearAlgebraTraits_d.h b/Solver_interface/doc/Solver_interface/Concepts/LinearAlgebraTraits_d.h deleted file mode 100644 index c52619321be..00000000000 --- a/Solver_interface/doc/Solver_interface/Concepts/LinearAlgebraTraits_d.h +++ /dev/null @@ -1,183 +0,0 @@ - -/*! -\ingroup PkgKernelDLinAlgConcepts -\cgalConcept - -The data type `LinearAlgebraTraits_d` encapsulates two classes -`Matrix`, `Vector` and many functions of basic linear algebra. -An instance of data type `Matrix` is a matrix of variables of type -`NT`. Accordingly, `Vector` implements vectors of variables of -type `NT`. Most functions of linear algebra are checkable, -i.e., the programs can be asked for a proof that their output is -correct. For example, if the linear system solver declares a linear -system \f$ A x = b\f$ unsolvable it also returns a vector \f$ c\f$ such that -\f$ c^T A = 0\f$ and \f$ c^T b \neq 0\f$. - -\cgalHasModel `CGAL::Linear_algebraHd` -\cgalHasModel `CGAL::Linear_algebraCd` - -*/ - -class LinearAlgebraTraits_d { -public: - -/// \name Types -/// @{ - -/*! -the number type of the components. -*/ -typedef unspecified_type NT; - -/*! -the vector type. -*/ -typedef unspecified_type Vector; - -/*! -the matrix type. -*/ -typedef unspecified_type Matrix; - -/// @} - -/// \name Operations -/// @{ - -/*! -returns \f$ M^T\f$ -(a `M.column_dimension()` \f$ \times\f$ `M.column_dimension()` - -matrix). -*/ -static Matrix transpose(const Matrix& M); - -/*! -determines whether `M` has an inverse. It also -computes either the inverse as \f$ (1/D) \cdot I\f$ or when no -inverse exists, a vector \f$ c\f$ such that \f$ c^T \cdot M = 0 \f$. -\pre \f$ M\f$ is square. -*/ -static bool inverse(const Matrix& M, Matrix& I, NT& D, -Vector& c); - -/*! -returns the -inverse matrix of `M`. More precisely, \f$ 1/D\f$ times the matrix -returned is the inverse of `M`. -\pre `determinant(M) != 0`. - -\pre \f$ M\f$ is square. -*/ -static Matrix inverse(const Matrix& M, NT& D) ; - -/*! -returns the determinant \f$ D\f$ of -`M` and sufficient information to verify that the value of the -determinant is correct. If the determinant is zero then \f$ c\f$ is a -vector such that \f$ c^T \cdot M = 0\f$. If the determinant is non-zero -then \f$ L\f$ and \f$ U\f$ are lower and upper diagonal matrices respectively -and \f$ q\f$ encodes a permutation matrix \f$ Q\f$ with \f$ Q(i,j) = 1\f$ iff \f$ i = -q(j)\f$ such that \f$ L \cdot M \cdot Q = U\f$, \f$ L(0,0) = 1\f$, \f$ L(i,i) = U(i -- 1,i - 1)\f$ for all \f$ i\f$, \f$ 1 \le i < n\f$, and \f$ D = s \cdot U(n - 1,n - -1)\f$ where \f$ s\f$ is the determinant of \f$ Q\f$. - -\pre `M` is square. -*/ -static NT determinant (const Matrix& M, Matrix& L, Matrix& -U, std::vector& q, Vector& c); - -/*! -verifies the conditions stated above. -*/ -static bool verify_determinant (const Matrix& M, NT D, -Matrix& L, Matrix& U, const std::vector& q, Vector& -c); - -/*! -returns the -determinant of `M`. - -\pre `M` is square. -*/ -static NT determinant (const Matrix& M); - -/*! -returns -the sign of the determinant of `M`. - -\pre `M` is square. -*/ -static int sign_of_determinant (const Matrix& M); - -/*! -determines -the complete solution space of the linear system \f$ M\cdot x = b\f$. If -the system is unsolvable then \f$ c^T \cdot M = 0\f$ and \f$ c^T \cdot b -\not= 0\f$. If the system is solvable then \f$ (1/D) x\f$ is a solution, -and the columns of `spanning_vectors` are a maximal set of -linearly independent solutions to the corresponding homogeneous -system. - -\pre `M.row_dimension() = b.dimension()`. -*/ -static bool linear_solver(const Matrix& M, const Vector& b, -Vector& x, NT& D, Matrix& spanning_vectors, Vector& c); - -/*! -determines whether the linear -system \f$ M\cdot x = b\f$ is solvable. If yes, then \f$ (1/D) x\f$ is a -solution, if not then \f$ c^T \cdot M = 0\f$ and \f$ c^T \cdot b \not= 0\f$. -\pre `M.row_dimension() = b.dimension()`. -*/ -static bool linear_solver(const Matrix& M, const Vector& b, -Vector& x, NT& D, Vector& c) ; - -/*! -as above, but without the witness \f$ c\f$ -\pre `M.row_dimension() = b.dimension()`. -*/ -static bool linear_solver(const Matrix& M, const Vector& b, -Vector& x, NT& D) ; - -/*! -determines whether the system \f$ M \cdot x = b\f$ is solvable - -\pre `M.row_dimension() = b.dimension()`. -*/ -static bool is_solvable(const Matrix& M, const Vector& b) -; - -/*! -determines whether the homogeneous linear system -\f$ M\cdot x = 0\f$ has a non - trivial solution. If yes, then \f$ x\f$ is -such a solution. -*/ -static bool homogeneous_linear_solver (const Matrix& M, -Vector& x); - -/*! -determines the solution space of the -homogeneous linear system \f$ M\cdot x = 0\f$. It returns the dimension -of the solution space. Moreover the columns of `spanning_vecs` -span the solution space. -*/ -static int homogeneous_linear_solver (const Matrix& M, -Matrix& spanning_vecs); - -/*! -returns the indices of a maximal subset -of independent columns of `M`. -*/ -static int independent_columns (const Matrix& M, -std::vector& columns); - -/*! -returns the rank of -matrix `M` -*/ -static int rank (const Matrix & M); - -/// @} - -}; /* end LinearAlgebraTraits_d */ - From e5fb24e3c46b1ad9205c142f2bfb390d11d107df Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 7 Sep 2015 08:09:39 +0200 Subject: [PATCH 59/61] Use default parameterizer in extensive test of surface mesh parameterizer --- .../extensive_parameterization_test.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/extensive_parameterization_test.cpp b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/extensive_parameterization_test.cpp index 5c61ef8b5cb..7f1ab5ae4f5 100644 --- a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/extensive_parameterization_test.cpp +++ b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/extensive_parameterization_test.cpp @@ -407,10 +407,9 @@ int main(int argc, char * argv[]) err = CGAL::parameterize( mesh_patch, CGAL::Discrete_authalic_parameterizer_3< - Mesh_patch_polyhedron, - CGAL::Square_border_arc_length_parameterizer_3, - CGAL::Eigen_solver_traits<> - >()); + Mesh_patch_polyhedron, + CGAL::Square_border_arc_length_parameterizer_3 >() + ); switch(err) { case Parameterizer::OK: // Success break; From 0d600f549046dd3e4d4ec8caedf3fe6bb5686ac5 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 7 Sep 2015 08:18:43 +0200 Subject: [PATCH 60/61] Replace VCM by Diagonalize for consistency --- Principal_component_analysis/include/CGAL/PCA_util.h | 12 ++++++------ .../CGAL/linear_least_squares_fitting_circles_2.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Principal_component_analysis/include/CGAL/PCA_util.h b/Principal_component_analysis/include/CGAL/PCA_util.h index a872bdfff43..bec34de0686 100644 --- a/Principal_component_analysis/include/CGAL/PCA_util.h +++ b/Principal_component_analysis/include/CGAL/PCA_util.h @@ -670,13 +670,13 @@ assemble_covariance_matrix_3(InputIterator first, // compute the eigen values and vectors of the covariance // matrix and deduces the best linear fitting plane. // returns fitting quality -template < typename K, typename Vcm_traits > +template < typename K, typename Diagonalize_traits > typename K::FT fitting_plane_3(CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid typename K::Plane_3& plane, // best fit plane const K&, // kernel - const Vcm_traits& ) // Vcm traits + const Diagonalize_traits& ) // Diagonalize traits { typedef typename K::FT FT; typedef typename K::Plane_3 Plane; @@ -689,7 +689,7 @@ fitting_plane_3(CGAL::cpp11::array& covariance, // covariance CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0., 0., 0., 0., 0., 0., 0. }}; - Vcm_traits::diagonalize_selfadjoint_covariance_matrix + Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, eigen_values, eigen_vectors); // degenerate case @@ -715,13 +715,13 @@ fitting_plane_3(CGAL::cpp11::array& covariance, // covariance // matrix and deduces the best linear fitting line // (this is an internal function) // returns fitting quality -template < typename K, typename Vcm_traits > +template < typename K, typename Diagonalize_traits > typename K::FT fitting_line_3(CGAL::cpp11::array& covariance, // covariance matrix const typename K::Point_3& c, // centroid typename K::Line_3& line, // best fit line const K&, // kernel - const Vcm_traits& ) // Vcm traits + const Diagonalize_traits& ) // Diagonalize traits { typedef typename K::FT FT; typedef typename K::Line_3 Line; @@ -734,7 +734,7 @@ fitting_line_3(CGAL::cpp11::array& covariance, // covariance CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0., 0., 0., 0., 0., 0., 0. }}; - Vcm_traits::diagonalize_selfadjoint_covariance_matrix + Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, eigen_values, eigen_vectors); // isotropic case (infinite number of directions) diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h index 147c6af98b8..8379444f9b9 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h @@ -38,7 +38,7 @@ namespace internal { // 0 is worst (isotropic case, returns a line with horizontal // direction by default) -template < typename InputIterator, typename K, typename Vcm_traits > +template < typename InputIterator, typename K, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -47,7 +47,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename K::Circle_2*,// used for indirection const K&, // kernel const CGAL::Dimension_tag<2>& tag, - const Vcm_traits&) + const Diagonalize_traits&) { // types typedef typename K::FT FT; @@ -125,7 +125,7 @@ linear_least_squares_fitting_2(InputIterator first, std::pair eigen_vectors; CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; - Vcm_traits::diagonalize_selfadjoint_covariance_matrix + Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, eigen_values1, eigen_vectors1); eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); @@ -148,7 +148,7 @@ linear_least_squares_fitting_2(InputIterator first, } // end linear_least_squares_fitting_2 for circle set with 2D tag -template < typename InputIterator, typename K, typename Vcm_traits > +template < typename InputIterator, typename K, typename Diagonalize_traits > typename K::FT linear_least_squares_fitting_2(InputIterator first, InputIterator beyond, @@ -157,7 +157,7 @@ linear_least_squares_fitting_2(InputIterator first, const typename K::Circle_2*,// used for indirection const K&, // kernel const CGAL::Dimension_tag<1>& tag, - const Vcm_traits& ) + const Diagonalize_traits& ) { // types typedef typename K::FT FT; @@ -233,7 +233,7 @@ linear_least_squares_fitting_2(InputIterator first, std::pair eigen_vectors; CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; - Vcm_traits::diagonalize_selfadjoint_covariance_matrix + Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix (covariance, eigen_values1, eigen_vectors1); eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); From 03b186c6dfecc5d3b486b733e503573b6169007e Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 7 Sep 2015 08:29:00 +0200 Subject: [PATCH 61/61] Simplify code (avoid useless data copy) --- .../linear_least_squares_fitting_circles_2.h | 32 +++++++------------ ...inear_least_squares_fitting_rectangles_2.h | 17 ++++------ .../linear_least_squares_fitting_segments_2.h | 16 ++++------ ...linear_least_squares_fitting_triangles_2.h | 16 ++++------ 4 files changed, 30 insertions(+), 51 deletions(-) diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h index 8379444f9b9..1762d8139d9 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h @@ -121,21 +121,17 @@ linear_least_squares_fitting_2(InputIterator first, // solve for eigenvalues and eigenvectors. // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - std::pair eigen_values; - std::pair eigen_vectors; - CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; - CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + CGAL::cpp11::array eigen_values = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (covariance, eigen_values1, eigen_vectors1); + (covariance, eigen_values, eigen_vectors); - eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly - if(eigen_values.first != eigen_values.second) + if(eigen_values[0] != eigen_values[1]) { // regular case - line = Line(c, eigen_vectors.first); - return (FT)1.0 - eigen_values.second / eigen_values.first; + line = Line(c, Vector (eigen_vectors[2],eigen_vectors[3])); + return (FT)1.0 - eigen_values[0] / eigen_values[1]; } else { @@ -229,21 +225,17 @@ linear_least_squares_fitting_2(InputIterator first, // solve for eigenvalues and eigenvectors. // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - std::pair eigen_values; - std::pair eigen_vectors; - CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; - CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + CGAL::cpp11::array eigen_values = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (covariance, eigen_values1, eigen_vectors1); + (covariance, eigen_values, eigen_vectors); - eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly - if(eigen_values.first != eigen_values.second) + if(eigen_values[1] != eigen_values[0]) { // regular case - line = Line(c, eigen_vectors.first); - return (FT)1.0 - eigen_values.second / eigen_values.first; + line = Line(c, Vector(eigen_vectors[2],eigen_vectors[3])); + return (FT)1.0 - eigen_values[0] / eigen_values[1]; } else { diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h index b7201b35d13..9683c9f90d7 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h @@ -124,22 +124,17 @@ linear_least_squares_fitting_2(InputIterator first, // solve for eigenvalues and eigenvectors. // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - std::pair eigen_values; - std::pair eigen_vectors; - CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; - CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + CGAL::cpp11::array eigen_values = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (covariance, eigen_values1, eigen_vectors1); - - eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); + (covariance, eigen_values, eigen_vectors); // check unicity and build fitting line accordingly - if(eigen_values.first != eigen_values.second) + if(eigen_values[0] != eigen_values[1]) { // regular case - line = Line(c, eigen_vectors.first); - return (FT)1.0 - eigen_values.second / eigen_values.first; + line = Line(c, Vector(eigen_vectors[2],eigen_vectors[3])); + return (FT)1.0 - eigen_values[0] / eigen_values[1]; } else { diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h index 2fbf05a5e5c..5703ee35d10 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_2.h @@ -112,21 +112,17 @@ linear_least_squares_fitting_2(InputIterator first, // solve for eigenvalues and eigenvectors. // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - std::pair eigen_values; - std::pair eigen_vectors; - CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; - CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + CGAL::cpp11::array eigen_values = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (covariance, eigen_values1, eigen_vectors1); + (covariance, eigen_values, eigen_vectors); - eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly - if(eigen_values.first != eigen_values.second) + if(eigen_values[0] != eigen_values[1]) { // regular case - line = Line(c, eigen_vectors.first); - return (FT)1.0 - eigen_values.second / eigen_values.first; + line = Line(c, Vector(eigen_vectors[2],eigen_vectors[3])); + return (FT)1.0 - eigen_values[0] / eigen_values[1]; } else { diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h index ee85e40c9c6..2754fc65265 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h @@ -124,21 +124,17 @@ linear_least_squares_fitting_2(InputIterator first, // solve for eigenvalues and eigenvectors. // eigen values are sorted in ascending order, // eigen vectors are sorted in accordance. - std::pair eigen_values; - std::pair eigen_vectors; - CGAL::cpp11::array eigen_values1 = {{ 0. , 0. }}; - CGAL::cpp11::array eigen_vectors1 = {{ 0., 0., 0. }}; + CGAL::cpp11::array eigen_values = {{ 0. , 0. }}; + CGAL::cpp11::array eigen_vectors = {{ 0., 0., 0. }}; Diagonalize_traits::diagonalize_selfadjoint_covariance_matrix - (covariance, eigen_values1, eigen_vectors1); + (covariance, eigen_values, eigen_vectors); - eigen_values = std::make_pair(eigen_values1[1],eigen_values1[0]); - eigen_vectors = std::make_pair(Vector(eigen_vectors1[2],eigen_vectors1[3]),Vector(eigen_vectors1[0],eigen_vectors1[1])); // check unicity and build fitting line accordingly - if(eigen_values.first != eigen_values.second) + if(eigen_values[0] != eigen_values[1]) { // regular case - line = Line(c, eigen_vectors.first); - return (FT)1.0 - eigen_values.second / eigen_values.first; + line = Line(c, Vector(eigen_vectors[2],eigen_vectors[3])); + return (FT)1.0 - eigen_values[0] / eigen_values[1]; } else {