diff --git a/CMakeLists.txt b/CMakeLists.txt index fbada006..de737bc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,11 @@ endif () #----------------------------------------------------------- #-- find CGAL --------------------------------------------- +if( CGAL_USE_GMPXX ) + add_definitions( "-DCGAL_USE_GMPXX" ) +endif() option( CGAL_USE_AUTOLINK "disable CGAL autolink" OFF ) + if( ${CGAL_USE_AUTOLINK} ) add_definitions( "-DCGAL_NO_AUTOLINK" ) endif() @@ -67,12 +71,13 @@ endif() find_package( CGAL 5.3 COMPONENTS Core REQUIRED ) message( STATUS "CGAL ${CGAL_VERSION} found" ) -# For CGAL >= 5 -add_definitions( "-DCGAL_USE_GMPXX=1" ) - include_directories( ${CMAKE_BINARY_DIR}/include ) #-- BOOST -------------------------------------------------- +if( NOT CGAL_USE_GMPXX ) + add_definitions( "-DCGAL_DO_NOT_USE_BOOST_MP" ) +endif() + option( Boost_USE_AUTO_LINK "boost use autolink" OFF ) if( NOT ${Boost_USE_AUTO_LINK} ) add_definitions( "-DBOOST_ALL_NO_LIB" ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b8df34a..bd1fb386 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,7 +46,7 @@ set_target_properties( SFCGAL PROPERTIES VERSION ${SFCGAL_VERSION} target_link_libraries( SFCGAL CGAL::CGAL CGAL::CGAL_Core) -if( "${CGAL_VERSION}" VERSION_GREATER_EQUAL "5.0.0") +if( CGAL_USE_GMPXX ) target_link_libraries( SFCGAL gmpxx ) endif() diff --git a/src/algorithm/translate.cpp b/src/algorithm/translate.cpp index 87f3d0f3..b441bba9 100644 --- a/src/algorithm/translate.cpp +++ b/src/algorithm/translate.cpp @@ -55,5 +55,18 @@ translate(Geometry &g, const Kernel::FT dx, const Kernel::FT dy, translate(g, Kernel::Vector_3(dx, dy, dz)); } +/// +/// +/// +void +translate(Geometry &g, const double &dx, const double &dy, const double &dz) +{ + if (!std::isfinite(dx) || !std::isfinite(dy) || !std::isfinite(dz)) { + BOOST_THROW_EXCEPTION(NonFiniteValueException( + "trying to translate with non finite value in direction")); + } + + return translate(g, Kernel::FT(dx), Kernel::FT(dy), Kernel::FT(dz)); +} } // namespace algorithm } // namespace SFCGAL diff --git a/src/algorithm/translate.h b/src/algorithm/translate.h index b2707b35..46bf6dc7 100644 --- a/src/algorithm/translate.h +++ b/src/algorithm/translate.h @@ -36,6 +36,13 @@ SFCGAL_API void translate(Geometry &g, const Kernel::FT dx, const Kernel::FT dy, const Kernel::FT dz); +/** + * @brief translate a geometry from double-coordinates + * @todo unittest + */ +SFCGAL_API void +translate(Geometry &g, const double &dx, const double &dy, const double &dz); + } // namespace algorithm } // namespace SFCGAL diff --git a/test/unit/SFCGAL/KernelTest.cpp b/test/unit/SFCGAL/KernelTest.cpp index ddd0cf0b..01deeaa2 100644 --- a/test/unit/SFCGAL/KernelTest.cpp +++ b/test/unit/SFCGAL/KernelTest.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include