Merge remote-tracking branch 'laurent/Installation-remove_FindBLAS_LAPACK_TAUCS-GF' into Installation-remove_FindBLAS_LAPACK_TAUCS-GF

This commit is contained in:
Simon Giraudot 2019-04-09 15:22:45 +02:00
commit d8b51a9672
62 changed files with 43 additions and 5602 deletions

View File

@ -570,8 +570,8 @@ message("== Detect external libraries ==")
# Remarks:
# External libs configured when Qt5 lib of cgal are required
# Coin is used in KDS, but no FindCoin or FindCOIN exists
# There exists FindF2C, FindIPE, FindMKL, but they are only used to support supporting libs
list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 0 GMP MPFR ZLIB OpenGL LEDA MPFI RS RS3 OpenNL Eigen3 BLAS LAPACK ESBTL Coin3D NTL IPE)
# There exists FindIPE, FindMKL, but they are only used to support supporting libs
list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 0 GMP MPFR ZLIB OpenGL LEDA MPFI RS RS3 OpenNL Eigen3 ESBTL Coin3D NTL IPE)
if (NOT WIN32)
# GMPXX is not supported on WIN32 machines
list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 1 GMPXX)

View File

@ -76,14 +76,6 @@ CGAL packages, some are only needed for demos.
* Surface Reconstruction from Point Sets
http://eigen.tuxfamily.org
- BLAS, LAPACK, ATLAS
Required by the packages (if EIGEN is not available):
* Estimation of Local Differential Properties of Point-Sampled Surfaces
* Approximation of Ridges and Umbilics on Triangulated Surface Meshes
* Planar Parameterization of Triangulated Surface Meshes
http://www.netlib.org/blas/, http://www.netlib.org/lapack/
or precompiled version that can be downloaded with CGAL-x.y-Setup.exe
- MPFI
Required by the package:
* Algebraic Kernel

View File

@ -1,121 +0,0 @@
# Find TAUCS library shipped with CGAL
#
# This module searches for TAUCS in CGAL "auxiliary" folder
# and in in $CGAL_TAUCS_DIR environment variable.
#
# This module sets the following variables:
# CGAL_TAUCS_FOUND - set to true if TAUCS library shipped with CGAL
# is found
# CGAL_TAUCS_PLATFORM - name of TAUCS subfolder corresponding to the current compiler
# CGAL_TAUCS_INCLUDE_DIR - list of folders (using full path name) containing
# TAUCS (and optionaly BLAS and LAPACK) headers
# CGAL_TAUCS_LIBRARIES_DIR -list of folders (using full path name) containing
# TAUCS (and optionaly BLAS and LAPACK) libraries
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake)
if ( NOT CGAL_TAUCS_FOUND )
#
# Find out TAUCS name for the current platform.
# This code is a translation of TAUCS "configure" script.
#
# The first task is to figure out CMAKE_SYSTEM_NAME
# (on unix this is uname -s, for windows it is Windows).
#message("DEBUG: CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
#message("DEBUG: CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
set( CGAL_TAUCS_PLATFORM "${CMAKE_SYSTEM_NAME}" )
# Convert to lower case
STRING(TOLOWER "${CGAL_TAUCS_PLATFORM}" CGAL_TAUCS_PLATFORM)
# Sometimes uname returns a value that is
# inconsistent with the way CGAL_TAUCS_PLATFORM is set. For example, on
# Solaris, CGAL_TAUCS_PLATFORM=solaris but uname returns SunOS.
if ( ${CGAL_TAUCS_PLATFORM} STREQUAL "sunos" )
set( CGAL_TAUCS_PLATFORM "solaris" )
endif()
if ( ${CGAL_TAUCS_PLATFORM} STREQUAL "windows" )
set( CGAL_TAUCS_PLATFORM "win32" )
endif()
# LS 2007: added "darwin_intel" for Intel Macs.
# "darwin" = original Darwin platform = PowerPC architecture.
if ( ${CGAL_TAUCS_PLATFORM} STREQUAL "darwin" )
# CMAKE_SYSTEM_PROCESSOR=uname -p
if ( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" )
set( CGAL_TAUCS_PLATFORM "darwin_intel" )
endif()
endif()
# LS 2007: append "64" if 64 bits processor (tested on Linux only)
if ( ${CGAL_TAUCS_PLATFORM} STREQUAL "linux" )
# CMAKE_SYSTEM_PROCESSOR=uname -p
if ( ${CMAKE_SYSTEM_PROCESSOR} MATCHES ".*64.*" )
set( CGAL_TAUCS_PLATFORM "${CGAL_TAUCS_PLATFORM}64" )
endif()
endif()
#message("DEBUG: CGAL_TAUCS_PLATFORM = ${CGAL_TAUCS_PLATFORM}")
#
# Search for TAUCS folder.
#
#message("DEBUG: CGAL_INSTALLATION_PACKAGE_DIR = ${CGAL_INSTALLATION_PACKAGE_DIR}")
# VC++ uses auto-link, thus we search for a folder containing the output of
# build_taucs_win32_for_CGAL.bat/build_taucs_win64_for_CGAL.bat,
# ie TAUCS libraries compiled for all Windows runtimes.
if ( MSVC )
# Check $CGAL_TAUCS_DIR environment variable
fetch_env_var(CGAL_TAUCS_DIR)
#message("DEBUG: CGAL_TAUCS_DIR = ${CGAL_TAUCS_DIR}")
if (NOT "${CGAL_TAUCS_DIR}" STREQUAL "" AND EXISTS ${CGAL_TAUCS_DIR})
set( CGAL_TAUCS_INCLUDE_DIR "${CGAL_TAUCS_DIR}/include")
set( CGAL_TAUCS_LIBRARIES_DIR "${CGAL_TAUCS_DIR}/lib" )
set( CGAL_TAUCS_FOUND TRUE )
# Else, search for TAUCS in CGAL "auxiliary" folder
elseif ( EXISTS "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/taucs/include/taucs.h" AND
EXISTS "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/taucs/lib" )
set( CGAL_TAUCS_INCLUDE_DIR "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/taucs/include")
set( CGAL_TAUCS_LIBRARIES_DIR "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/taucs/lib" )
set( CGAL_TAUCS_FOUND TRUE )
endif()
# On Unix, search for TAUCS "taucs_full" folder
else ( MSVC )
# Check $CGAL_TAUCS_DIR environment variable
fetch_env_var(CGAL_TAUCS_DIR)
#message("DEBUG: CGAL_TAUCS_DIR = ${CGAL_TAUCS_DIR}")
if (NOT "${CGAL_TAUCS_DIR}" STREQUAL "" AND EXISTS ${CGAL_TAUCS_DIR})
set( CGAL_TAUCS_INCLUDE_DIR "${CGAL_TAUCS_DIR}/build/${CGAL_TAUCS_PLATFORM}"
"${CGAL_TAUCS_DIR}/src" )
set( CGAL_TAUCS_LIBRARIES_DIR "${CGAL_TAUCS_DIR}/external/lib/${CGAL_TAUCS_PLATFORM}"
"${CGAL_TAUCS_DIR}/lib/${CGAL_TAUCS_PLATFORM}" )
set( CGAL_TAUCS_FOUND TRUE )
endif()
endif ( MSVC )
# Add variables to cache
set( CGAL_TAUCS_DIR "${CGAL_TAUCS_DIR}"
CACHE PATH "Directory containing BLAS, LAPACK and TAUCS" )
#message("DEBUG: CGAL_TAUCS_INCLUDE_DIR = ${CGAL_TAUCS_INCLUDE_DIR}")
#message("DEBUG: CGAL_TAUCS_LIBRARIES_DIR = ${CGAL_TAUCS_LIBRARIES_DIR}")
#message("DEBUG: CGAL_TAUCS_FOUND = ${CGAL_TAUCS_FOUND}")
endif ( NOT CGAL_TAUCS_FOUND )

View File

@ -1,36 +0,0 @@
# This module setups the compiler for the BLAS libraries.
# It assumes that find_package(BLAS) was already called.
if ( BLAS_FOUND AND NOT BLAS_SETUP )
message( STATUS "UseBLAS" )
message( STATUS "BLAS include: ${BLAS_INCLUDE_DIR}" )
include_directories ( SYSTEM ${BLAS_INCLUDE_DIR} )
message( STATUS "BLAS definitions: ${BLAS_DEFINITIONS}" )
add_definitions( ${BLAS_DEFINITIONS} )
if ( "${BLAS_DEFINITIONS}" MATCHES ".*BLAS_USE_F2C.*" )
add_definitions( "-DCGAL_USE_F2C" )
endif()
if (BLAS_LIBRARIES_DIR)
message( STATUS "BLAS library directories: ${BLAS_LIBRARIES_DIR}" )
link_directories( ${BLAS_LIBRARIES_DIR} )
endif()
if (BLAS_LIBRARIES)
message( STATUS "BLAS libraries: ${BLAS_LIBRARIES}" )
link_libraries( ${BLAS_LIBRARIES} )
endif()
message( STATUS "BLAS link flags: ${BLAS_LINKER_FLAGS}" )
if ( BUILD_SHARED_LIBS )
uniquely_add_flags( CMAKE_SHARED_LINKER_FLAGS ${BLAS_LINKER_FLAGS} )
else()
uniquely_add_flags( CMAKE_MODULE_LINKER_FLAGS ${BLAS_LINKER_FLAGS} )
endif()
# Setup is done
set ( BLAS_SETUP TRUE )
endif()

View File

@ -1,41 +0,0 @@
# This module setups the compiler for the LAPACK libraries.
# It assumes that find_package(LAPACK) was already called.
if ( LAPACK_FOUND AND NOT LAPACK_SETUP )
message( STATUS "UseLAPACK" )
message( STATUS "LAPACK include: ${LAPACK_INCLUDE_DIR}" )
include_directories ( SYSTEM ${LAPACK_INCLUDE_DIR} )
message( STATUS "LAPACK definitions: ${LAPACK_DEFINITIONS}" )
add_definitions( ${LAPACK_DEFINITIONS} )
if ( "${LAPACK_DEFINITIONS}" MATCHES ".*LAPACK_USE_F2C.*" )
add_definitions( "-DCGAL_USE_F2C" )
endif()
if (LAPACK_LIBRARIES_DIR)
message( STATUS "LAPACK library directories: ${LAPACK_LIBRARIES_DIR}" )
link_directories( ${LAPACK_LIBRARIES_DIR} )
endif()
if (LAPACK_LIBRARIES)
message( STATUS "LAPACK libraries: ${LAPACK_LIBRARIES}" )
link_libraries( ${LAPACK_LIBRARIES} )
endif()
message( STATUS "LAPACK link flags: ${LAPACK_LINKER_FLAGS}" )
if ( BUILD_SHARED_LIBS )
uniquely_add_flags( CMAKE_SHARED_LINKER_FLAGS ${LAPACK_LINKER_FLAGS} )
else()
uniquely_add_flags( CMAKE_MODULE_LINKER_FLAGS ${LAPACK_LINKER_FLAGS} )
endif()
# LAPACK requires BLAS
include( ${BLAS_USE_FILE} )
# Setup is done
set ( LAPACK_SETUP TRUE )
add_definitions(-DCGAL_LAPACK_ENABLED)
endif()

View File

@ -1,31 +0,0 @@
# This module setups the compiler for the TAUCS libraries.
# It assumes that find_package(TAUCS) was already called.
if ( TAUCS_FOUND AND NOT TAUCS_SETUP )
message( STATUS "UseTAUCS" )
message( STATUS "TAUCS include: ${TAUCS_INCLUDE_DIR}" )
include_directories ( SYSTEM ${TAUCS_INCLUDE_DIR} )
message( STATUS "TAUCS definitions: ${TAUCS_DEFINITIONS}" )
add_definitions( ${TAUCS_DEFINITIONS} "-DCGAL_USE_TAUCS" )
if (TAUCS_LIBRARIES_DIR)
message( STATUS "TAUCS library directories: ${TAUCS_LIBRARIES_DIR}" )
link_directories( ${TAUCS_LIBRARIES_DIR} )
endif()
if (TAUCS_LIBRARIES)
message( STATUS "TAUCS libraries: ${TAUCS_LIBRARIES}" )
link_libraries( ${TAUCS_LIBRARIES} )
endif()
# TAUCS requires BLAS and LAPACK
include( ${LAPACK_USE_FILE} )
# Setup is done
set ( TAUCS_SETUP TRUE )
add_definitions(-DCGAL_TAUCS_ENABLED)
endif()

View File

@ -1,498 +0,0 @@
# Find BLAS library
#
# This module finds an installed library that implements the BLAS
# linear-algebra interface (see http://www.netlib.org/blas/).
# The list of libraries searched for is mainly taken
# from the autoconf macro file, acx_blas.m4 (distributed at
# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
#
# This module sets the following variables:
# BLAS_FOUND - set to true if a library implementing the BLAS interface
# is found
# BLAS_INCLUDE_DIR - Directories containing the BLAS header files
# BLAS_DEFINITIONS - Compilation options to use BLAS
# BLAS_LINKER_FLAGS - Linker flags to use BLAS (excluding -l
# and -L).
# BLAS_LIBRARIES_DIR - Directories containing the BLAS libraries.
# May be null if BLAS_LIBRARIES contains libraries name using full path.
# BLAS_LIBRARIES - List of libraries to link against BLAS interface.
# May be null if the compiler supports auto-link (e.g. VC++).
# BLAS_USE_FILE - The name of the cmake module to include to compile
# applications or libraries using BLAS.
#
# This module was modified by CGAL team:
# - find BLAS library shipped with TAUCS
# - find libraries for a C++ compiler, instead of Fortran
# - added BLAS_INCLUDE_DIR, BLAS_DEFINITIONS and BLAS_LIBRARIES_DIR
# - removed BLAS95_LIBRARIES
#
# TODO (CGAL):
# - find CBLAS (http://www.netlib.org/cblas) on Unix?
include(CheckFunctionExists)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake)
# This macro checks for the existence of the combination of fortran libraries
# given by _list. If the combination is found, this macro checks (using the
# check_function_exists macro) whether can link against that library
# combination using the name of a routine given by _name using the linker
# flags given by _flags. If the combination of libraries is found and passes
# the link test, LIBRARIES is set to the list of complete library paths that
# have been found and DEFINITIONS to the required definitions.
# Otherwise, LIBRARIES is set to FALSE.
# N.B. _prefix is the prefix applied to the names of all cached variables that
# are generated internally and marked advanced by this macro.
macro(check_fortran_libraries DEFINITIONS LIBRARIES _prefix _name _flags _list _path)
#message("DEBUG: check_fortran_libraries(${_list} in ${_path})")
# Check for the existence of the libraries given by _list
set(_libraries_found TRUE)
set(_libraries_work FALSE)
set(${DEFINITIONS} "")
set(${LIBRARIES} "")
set(_combined_name)
foreach(_library ${_list})
set(_combined_name ${_combined_name}_${_library})
if(_libraries_found)
# search first in ${_path}
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS ${_path} NO_DEFAULT_PATH
)
# if not found, search in environment variables and system
if ( WIN32 )
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS ENV LIB
)
elseif ( APPLE )
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
)
else ()
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
)
endif()
#message("DEBUG: find_library(${_library}) = ${${_prefix}_${_library}_LIBRARY}")
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_found ${${_prefix}_${_library}_LIBRARY})
endif(_libraries_found)
endforeach(_library ${_list})
if(_libraries_found)
set(_libraries_found ${${LIBRARIES}})
endif()
# Test this combination of libraries with the Fortran/f2c interface.
# We test the Fortran interface first as it is well standardized.
if(_libraries_found AND NOT _libraries_work)
set(${DEFINITIONS} "-D${_prefix}_USE_F2C")
set(${LIBRARIES} ${_libraries_found})
# Some C++ linkers require the f2c library to link with Fortran libraries.
# I do not know which ones, thus I just add the f2c library if it is available.
find_package( F2C QUIET )
if ( F2C_FOUND )
set(${DEFINITIONS} ${${DEFINITIONS}} ${F2C_DEFINITIONS})
set(${LIBRARIES} ${${LIBRARIES}} ${F2C_LIBRARIES})
endif()
set(CMAKE_REQUIRED_DEFINITIONS ${${DEFINITIONS}})
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}})
#message("DEBUG: CMAKE_REQUIRED_DEFINITIONS = ${CMAKE_REQUIRED_DEFINITIONS}")
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
# Check if function exists with f2c calling convention (ie a trailing underscore)
check_function_exists(${_name}_ ${_prefix}_${_name}_${_combined_name}_f2c_WORKS)
#message("DEBUG: check_function_exists(${_name}_) = ${${_prefix}_${_name}_${_combined_name}_f2c_WORKS}")
set(CMAKE_REQUIRED_DEFINITIONS} "")
set(CMAKE_REQUIRED_LIBRARIES "")
mark_as_advanced(${_prefix}_${_name}_${_combined_name}_f2c_WORKS)
set(_libraries_work ${${_prefix}_${_name}_${_combined_name}_f2c_WORKS})
endif(_libraries_found AND NOT _libraries_work)
# If not found, test this combination of libraries with a C interface.
# A few implementations (ie ACML) provide a C interface. Unfortunately, there is no standard.
if(_libraries_found AND NOT _libraries_work)
set(${DEFINITIONS} "")
set(${LIBRARIES} ${_libraries_found})
set(CMAKE_REQUIRED_DEFINITIONS "")
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}})
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
check_function_exists(${_name} ${_prefix}_${_name}${_combined_name}_WORKS)
#message("DEBUG: check_function_exists(${_name}) = ${${_prefix}_${_name}${_combined_name}_WORKS}")
set(CMAKE_REQUIRED_LIBRARIES "")
mark_as_advanced(${_prefix}_${_name}${_combined_name}_WORKS)
set(_libraries_work ${${_prefix}_${_name}${_combined_name}_WORKS})
endif(_libraries_found AND NOT _libraries_work)
# on failure
if(NOT _libraries_work)
set(${DEFINITIONS} "")
set(${LIBRARIES} FALSE)
endif()
#message("DEBUG: ${DEFINITIONS} = ${${DEFINITIONS}}")
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endmacro(check_fortran_libraries)
#
# main
#
# Is it already configured?
if (BLAS_LIBRARIES_DIR OR BLAS_LIBRARIES)
set(BLAS_FOUND TRUE)
else()
# reset variables
set( BLAS_INCLUDE_DIR "" )
set( BLAS_DEFINITIONS "" )
set( BLAS_LINKER_FLAGS "" )
set( BLAS_LIBRARIES "" )
set( BLAS_LIBRARIES_DIR "" )
# Look first for the TAUCS library distributed with CGAL in auxiliary/taucs.
# Set CGAL_TAUCS_FOUND, CGAL_TAUCS_INCLUDE_DIR and CGAL_TAUCS_LIBRARIES_DIR.
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Locate_CGAL_TAUCS.cmake)
# Search for BLAS in CGAL_TAUCS_INCLUDE_DIR/CGAL_TAUCS_LIBRARIES_DIR (TAUCS shipped with CGAL)...
if(CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED)
# if VC++: done
set( BLAS_INCLUDE_DIR "${CGAL_TAUCS_INCLUDE_DIR}" )
set( BLAS_LIBRARIES_DIR "${CGAL_TAUCS_LIBRARIES_DIR}" )
# ...else search for BLAS in $BLAS_LIB_DIR environment variable
else(CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED)
#
# Search for BLAS in possible libraries
# in $BLAS_LIB_DIR environment variable and in usual places.
#
# Read environment variables
fetch_env_var(BLAS_LIB_DIR)
fetch_env_var(MKL_LIB_DIR)
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"cblas;f77blas;atlas"
"${BLAS_LIB_DIR}"
)
endif()
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"sgemm;dgemm;blas"
"${BLAS_LIB_DIR}"
)
endif()
# BLAS in Alpha CXML library?
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"cxml"
"${BLAS_LIB_DIR}"
)
endif()
# BLAS in Alpha DXML library? (now called CXML, see above)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"dxml"
"${BLAS_LIB_DIR}"
)
endif()
# BLAS in Sun Performance library?
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
"-xlic_lib=sunperf"
"sunperf;sunmath"
"${BLAS_LIB_DIR}"
)
if(BLAS_LIBRARIES)
# Extra linker flag
set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
endif()
endif()
# BLAS in SCSL library? (SGI/Cray Scientific Library)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"scsl"
"${BLAS_LIB_DIR}"
)
endif()
# BLAS in SGIMATH library?
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"complib.sgimath"
"${BLAS_LIB_DIR}"
)
endif()
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"essl;blas"
"${BLAS_LIB_DIR}"
)
endif()
# intel mkl 10 library?
# TODO: add shared variants
if (WIN32)
# intel mkl library? (static, 32bit)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
SGEMM
""
"mkl_intel_c;mkl_intel_thread;mkl_core;libiomp5md"
"${MKL_LIB_DIR} ${BLAS_LIB_DIR}"
)
endif()
# intel mkl library? (static, ia64 and em64t 64 bit)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
SGEMM
""
"mkl_intel_lp64;mkl_intel_thread_lp64;mkl_core;libiomp5md"
"${MKL_LIB_DIR} ${BLAS_LIB_DIR}"
)
endif()
else(WIN32)
# intel mkl library? (static, 32bit)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"mkl_intel;mkl_intel_thread;mkl_core;iomp5;pthread"
"${MKL_LIB_DIR} ${BLAS_LIB_DIR}"
)
endif()
# intel mkl library? (static, ia64 and em64t 64 bit)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"mkl_intel_lp64;mkl_intel_thread_lp64;mkl_core;iomp5;pthread"
"${MKL_LIB_DIR} ${BLAS_LIB_DIR}"
)
endif()
endif (WIN32)
# older versions of intel mkl libs
# intel mkl library? (shared)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"mkl;guide;pthread"
"${MKL_LIB_DIR} ${BLAS_LIB_DIR}"
)
endif()
# intel mkl library? (static, 32bit)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"mkl_ia32;guide;pthread"
"${MKL_LIB_DIR} ${BLAS_LIB_DIR}"
)
endif()
# intel mkl library? (static, ia64 64bit)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"mkl_ipf;guide;pthread"
"${MKL_LIB_DIR} ${BLAS_LIB_DIR}"
)
endif()
# intel mkl library? (static, em64t 64bit)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"mkl_em64t;guide;pthread"
"${MKL_LIB_DIR} ${BLAS_LIB_DIR}"
)
endif()
#BLAS in acml library?
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"acml"
"${BLAS_LIB_DIR}"
)
endif()
# Apple BLAS library?
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"Accelerate"
"${BLAS_LIB_DIR}"
)
endif()
if ( NOT BLAS_LIBRARIES )
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"vecLib"
"${BLAS_LIB_DIR}"
)
endif ( NOT BLAS_LIBRARIES )
# Generic BLAS library?
# This configuration *must* be the last try as this library is notably slow.
if ( NOT BLAS_LIBRARIES )
check_fortran_libraries(
BLAS_DEFINITIONS
BLAS_LIBRARIES
BLAS
sgemm
""
"blas"
"${BLAS_LIB_DIR}"
)
endif()
endif(CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED)
if(BLAS_LIBRARIES_DIR OR BLAS_LIBRARIES)
set(BLAS_FOUND TRUE)
else()
set(BLAS_FOUND FALSE)
endif()
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_FOUND)
message(STATUS "A library with BLAS API found.")
else(BLAS_FOUND)
if(BLAS_FIND_REQUIRED)
message(FATAL_ERROR "A required library with BLAS API not found. Please specify library location.")
else()
message(STATUS "A library with BLAS API not found. Please specify library location.")
endif()
endif(BLAS_FOUND)
endif(NOT BLAS_FIND_QUIETLY)
# Add variables to cache
set( BLAS_INCLUDE_DIR "${BLAS_INCLUDE_DIR}"
CACHE PATH "Directories containing the BLAS header files" FORCE )
set( BLAS_DEFINITIONS "${BLAS_DEFINITIONS}"
CACHE STRING "Compilation options to use BLAS" FORCE )
set( BLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}"
CACHE STRING "Linker flags to use BLAS" FORCE )
set( BLAS_LIBRARIES "${BLAS_LIBRARIES}"
CACHE FILEPATH "BLAS libraries name" FORCE )
set( BLAS_LIBRARIES_DIR "${BLAS_LIBRARIES_DIR}"
CACHE PATH "Directories containing the BLAS libraries" FORCE )
#message("DEBUG: BLAS_INCLUDE_DIR = ${BLAS_INCLUDE_DIR}")
#message("DEBUG: BLAS_DEFINITIONS = ${BLAS_DEFINITIONS}")
#message("DEBUG: BLAS_LINKER_FLAGS = ${BLAS_LINKER_FLAGS}")
#message("DEBUG: BLAS_LIBRARIES = ${BLAS_LIBRARIES}")
#message("DEBUG: BLAS_LIBRARIES_DIR = ${BLAS_LIBRARIES_DIR}")
#message("DEBUG: BLAS_FOUND = ${BLAS_FOUND}")
endif(BLAS_LIBRARIES_DIR OR BLAS_LIBRARIES)
if(BLAS_FOUND)
set(BLAS_USE_FILE "CGAL_UseBLAS")
endif(BLAS_FOUND)

View File

@ -13,12 +13,7 @@ else(F2C_LIBRARIES)
set(F2C_DEFINITIONS)
# F2C shipped with CGAL (as part of TAUCS)?
# If found, we will search for f2c library in ${CGAL_TAUCS_LIBRARIES_DIR}.
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Locate_CGAL_TAUCS.cmake)
find_library(F2C_LIBRARIES NAMES f2c g2c vcf2c
PATHS ${CGAL_TAUCS_LIBRARIES_DIR}
DOC "F2C library"
)

View File

@ -1,324 +0,0 @@
# Find LAPACK library
#
# This module finds an installed library that implements the LAPACK
# linear-algebra interface (see http://www.netlib.org/lapack/).
# The approach follows mostly that taken for the autoconf macro file, acx_lapack.m4
# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
#
# This module sets the following variables:
# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
# is found
# LAPACK_INCLUDE_DIR - Directories containing the LAPACK header files
# LAPACK_DEFINITIONS - Compilation options to use LAPACK
# LAPACK_LINKER_FLAGS - Linker flags to use LAPACK (excluding -l
# and -L).
# LAPACK_LIBRARIES_DIR - Directories containing the LAPACK libraries.
# May be null if LAPACK_LIBRARIES contains libraries name using full path.
# LAPACK_LIBRARIES - List of libraries to link against LAPACK interface.
# May be null if the compiler supports auto-link (e.g. VC++).
# LAPACK_USE_FILE - The name of the cmake module to include to compile
# applications or libraries using LAPACK.
#
# This module was modified by CGAL team:
# - find LAPACK library shipped with TAUCS
# - find libraries for a C++ compiler, instead of Fortran
# - added LAPACK_INCLUDE_DIR, LAPACK_DEFINITIONS and LAPACK_LIBRARIES_DIR
# - removed LAPACK95_LIBRARIES
#
# TODO (CGAL):
# - find CLAPACK (http://www.netlib.org/clapack) on Unix?
include(CheckFunctionExists)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Macros.cmake)
# This macro checks for the existence of the combination of fortran libraries
# given by _list. If the combination is found, this macro checks (using the
# check_function_exists macro) whether can link against that library
# combination using the name of a routine given by _name using the linker
# flags given by _flags. If the combination of libraries is found and passes
# the link test, LIBRARIES is set to the list of complete library paths that
# have been found and DEFINITIONS to the required definitions.
# Otherwise, LIBRARIES is set to FALSE.
# N.B. _prefix is the prefix applied to the names of all cached variables that
# are generated internally and marked advanced by this macro.
macro(check_lapack_libraries DEFINITIONS LIBRARIES _prefix _name _flags _list _blas _path)
#message("DEBUG: check_lapack_libraries(${_list} in ${_path} with ${_blas})")
# Check for the existence of the libraries given by _list
set(_libraries_found TRUE)
set(_libraries_work FALSE)
set(${DEFINITIONS} "")
set(${LIBRARIES} "")
set(_combined_name)
foreach(_library ${_list})
set(_combined_name ${_combined_name}_${_library})
if(_libraries_found)
# search first in ${_path}
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS ${_path} NO_DEFAULT_PATH
)
# if not found, search in environment variables and system
if ( WIN32 )
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS ENV LIB
)
elseif ( APPLE )
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
)
else ()
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
)
endif()
#message("DEBUG: find_library(${_library}) = ${${_prefix}_${_library}_LIBRARY}")
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_found ${${_prefix}_${_library}_LIBRARY})
endif(_libraries_found)
endforeach(_library ${_list})
if(_libraries_found)
set(_libraries_found ${${LIBRARIES}})
endif()
# Test this combination of libraries with the Fortran/f2c interface.
# We test the Fortran interface first as it is well standardized.
if(_libraries_found AND NOT _libraries_work)
set(${DEFINITIONS} "-D${_prefix}_USE_F2C")
set(${LIBRARIES} ${_libraries_found})
# Some C++ linkers require the f2c library to link with Fortran libraries.
# I do not know which ones, thus I just add the f2c library if it is available.
find_package( F2C QUIET )
if ( F2C_FOUND )
set(${DEFINITIONS} ${${DEFINITIONS}} ${F2C_DEFINITIONS})
set(${LIBRARIES} ${${LIBRARIES}} ${F2C_LIBRARIES})
endif()
set(CMAKE_REQUIRED_DEFINITIONS ${${DEFINITIONS}})
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas})
#message("DEBUG: CMAKE_REQUIRED_DEFINITIONS = ${CMAKE_REQUIRED_DEFINITIONS}")
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
# Check if function exists with f2c calling convention (ie a trailing underscore)
check_function_exists(${_name}_ ${_prefix}_${_name}_${_combined_name}_f2c_WORKS)
#message("DEBUG: check_function_exists(${_name}_) = ${${_prefix}_${_name}_${_combined_name}_f2c_WORKS}")
set(CMAKE_REQUIRED_DEFINITIONS} "")
set(CMAKE_REQUIRED_LIBRARIES "")
mark_as_advanced(${_prefix}_${_name}_${_combined_name}_f2c_WORKS)
set(_libraries_work ${${_prefix}_${_name}_${_combined_name}_f2c_WORKS})
endif(_libraries_found AND NOT _libraries_work)
# If not found, test this combination of libraries with a C interface.
# A few implementations (ie ACML) provide a C interface. Unfortunately, there is no standard.
if(_libraries_found AND NOT _libraries_work)
set(${DEFINITIONS} "")
set(${LIBRARIES} ${_libraries_found})
set(CMAKE_REQUIRED_DEFINITIONS "")
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas})
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
check_function_exists(${_name} ${_prefix}_${_name}${_combined_name}_WORKS)
#message("DEBUG: check_function_exists(${_name}) = ${${_prefix}_${_name}${_combined_name}_WORKS}")
set(CMAKE_REQUIRED_LIBRARIES "")
mark_as_advanced(${_prefix}_${_name}${_combined_name}_WORKS)
set(_libraries_work ${${_prefix}_${_name}${_combined_name}_WORKS})
endif(_libraries_found AND NOT _libraries_work)
# on failure
if(NOT _libraries_work)
set(${DEFINITIONS} "")
set(${LIBRARIES} FALSE)
endif()
#message("DEBUG: ${DEFINITIONS} = ${${DEFINITIONS}}")
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endmacro(check_lapack_libraries)
#
# main
#
# LAPACK requires BLAS
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
find_package(BLAS)
else()
find_package(BLAS REQUIRED)
endif()
if (NOT BLAS_FOUND)
message(STATUS "LAPACK requires BLAS.")
set(LAPACK_FOUND FALSE)
# Is it already configured?
elseif (LAPACK_LIBRARIES_DIR OR LAPACK_LIBRARIES)
set(LAPACK_FOUND TRUE)
else()
# reset variables
set( LAPACK_INCLUDE_DIR "" )
set( LAPACK_DEFINITIONS "" )
set( LAPACK_LINKER_FLAGS "" ) # unused (yet)
set( LAPACK_LIBRARIES "" )
set( LAPACK_LIBRARIES_DIR "" )
# Look first for the TAUCS library distributed with CGAL in auxiliary/taucs.
# Set CGAL_TAUCS_FOUND, CGAL_TAUCS_INCLUDE_DIR and CGAL_TAUCS_LIBRARIES_DIR.
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Locate_CGAL_TAUCS.cmake)
# Search for LAPACK in CGAL_TAUCS_INCLUDE_DIR/CGAL_TAUCS_LIBRARIES_DIR (TAUCS shipped with CGAL)...
if(CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED)
# if VC++: done
set( LAPACK_INCLUDE_DIR "${CGAL_TAUCS_INCLUDE_DIR}" )
set( LAPACK_LIBRARIES_DIR "${CGAL_TAUCS_LIBRARIES_DIR}" )
# ...else in $LAPACK_LIB_DIR environment variable
else(CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED)
#
# Search for LAPACK in possible libraries
# in $LAPACK_LIB_DIR environment variable and in usual places.
#
# Read environment variables
fetch_env_var(LAPACK_LIB_DIR)
fetch_env_var(MKL_LIB_DIR)
#intel mkl 10 lapack?
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"mkl_core"
"${BLAS_LIBRARIES}"
"${MKL_LIB_DIR} ${LAPACK_LIB_DIR}"
)
endif()
# older versions of intel mkl lapack?
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"mkl_lapack"
"${BLAS_LIBRARIES}"
"${MKL_LIB_DIR} ${LAPACK_LIB_DIR}"
)
endif()
#acml lapack?
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"acml"
"${BLAS_LIBRARIES}"
"${LAPACK_LIB_DIR}"
)
endif()
# Apple LAPACK library?
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"Accelerate"
"${BLAS_LIBRARIES}"
"${LAPACK_LIB_DIR}"
)
endif()
if ( NOT LAPACK_LIBRARIES )
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"vecLib"
"${BLAS_LIBRARIES}"
"${LAPACK_LIB_DIR}"
)
endif ( NOT LAPACK_LIBRARIES )
# Generic LAPACK library?
# This configuration *must* be the last try as this library is notably slow.
if ( NOT LAPACK_LIBRARIES )
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"lapack"
"${BLAS_LIBRARIES}"
"${LAPACK_LIB_DIR}"
)
endif()
endif(CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED)
if(LAPACK_LIBRARIES_DIR OR LAPACK_LIBRARIES)
set(LAPACK_FOUND TRUE)
else()
set(LAPACK_FOUND FALSE)
endif()
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_FOUND)
message(STATUS "A library with LAPACK API found.")
else(LAPACK_FOUND)
if(LAPACK_FIND_REQUIRED)
message(FATAL_ERROR "A required library with LAPACK API not found. Please specify library location.")
else()
message(STATUS "A library with LAPACK API not found. Please specify library location.")
endif()
endif(LAPACK_FOUND)
endif(NOT LAPACK_FIND_QUIETLY)
# Add variables to cache
set( LAPACK_INCLUDE_DIR "${LAPACK_INCLUDE_DIR}"
CACHE PATH "Directories containing the LAPACK header files" FORCE )
set( LAPACK_DEFINITIONS "${LAPACK_DEFINITIONS}"
CACHE STRING "Compilation options to use LAPACK" FORCE )
set( LAPACK_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}"
CACHE STRING "Linker flags to use LAPACK" FORCE )
set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}"
CACHE FILEPATH "LAPACK libraries name" FORCE )
set( LAPACK_LIBRARIES_DIR "${LAPACK_LIBRARIES_DIR}"
CACHE PATH "Directories containing the LAPACK libraries" FORCE )
#message("DEBUG: LAPACK_INCLUDE_DIR = ${LAPACK_INCLUDE_DIR}")
#message("DEBUG: LAPACK_DEFINITIONS = ${LAPACK_DEFINITIONS}")
#message("DEBUG: LAPACK_LINKER_FLAGS = ${LAPACK_LINKER_FLAGS}")
#message("DEBUG: LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}")
#message("DEBUG: LAPACK_LIBRARIES_DIR = ${LAPACK_LIBRARIES_DIR}")
#message("DEBUG: LAPACK_FOUND = ${LAPACK_FOUND}")
endif(NOT BLAS_FOUND)
if(LAPACK_FOUND)
set(LAPACK_USE_FILE "CGAL_UseLAPACK")
endif(LAPACK_FOUND)

View File

@ -1,129 +0,0 @@
# This module finds the TAUCS libraries.
#
# This module sets the following variables:
# TAUCS_FOUND - Set to true if headers and libraries are found
# TAUCS_INCLUDE_DIR - Directories containing the TAUCS header files
# TAUCS_DEFINITIONS - Compilation options to use TAUCS
# TAUCS_LIBRARIES_DIR - Directories containing the TAUCS libraries.
# May be null if TAUCS_LIBRARIES contains libraries name using full path.
# TAUCS_LIBRARIES - TAUCS libraries name.
# May be null if the compiler supports auto-link (e.g. VC++).
# TAUCS_USE_FILE - The name of the cmake module to include to compile
# applications or libraries using TAUCS.
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake)
# TAUCS requires LAPACK
if(TAUCS_FIND_QUIETLY OR NOT TAUCS_FIND_REQUIRED)
find_package(LAPACK)
else()
find_package(LAPACK REQUIRED)
endif()
if (NOT LAPACK_FOUND)
message(STATUS "TAUCS requires LAPACK and BLAS.")
set(TAUCS_FOUND FALSE)
# Is it already configured?
elseif (TAUCS_INCLUDE_DIR AND TAUCS_LIBRARIES_DIR)
set(TAUCS_FOUND TRUE)
elseif (TAUCS_INCLUDE_DIR AND TAUCS_LIBRARIES)
set(TAUCS_FOUND TRUE)
else()
# reset variables
set( TAUCS_DEFINITIONS "" ) # unused (yet)
set( TAUCS_LIBRARIES "" )
set( TAUCS_LIBRARIES_DIR "" )
# Look first for the TAUCS library distributed with CGAL in auxiliary/taucs.
# Set CGAL_TAUCS_FOUND, CGAL_TAUCS_INCLUDE_DIR and CGAL_TAUCS_LIBRARIES_DIR.
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Locate_CGAL_TAUCS.cmake)
# Search for TAUCS headers in ${CGAL_TAUCS_INCLUDE_DIR} (TAUCS shipped with CGAL),
# else in $TAUCS_INC_DIR environment variable.
if( CGAL_TAUCS_FOUND )
set( TAUCS_INCLUDE_DIR "${CGAL_TAUCS_INCLUDE_DIR}" )
else()
find_path(TAUCS_INCLUDE_DIR
NAMES taucs.h
HINTS ${CGAL_TAUCS_INCLUDE_DIR}
ENV TAUCS_DIR
ENV TAUCS_INC_DIR
PATH_SUFFIXES taucs include
)
endif()
# Search for TAUCS libraries in ${CGAL_TAUCS_LIBRARIES_DIR} (TAUCS shipped with CGAL),
# else in $TAUCS_LIB_DIR environment variable.
if( CGAL_TAUCS_FOUND AND CGAL_AUTO_LINK_ENABLED )
# if VC++: done
set( TAUCS_LIBRARIES_DIR "${CGAL_TAUCS_LIBRARIES_DIR}" )
else()
find_library(TAUCS_LIBRARY
NAMES "taucs"
PATHS ${CGAL_TAUCS_LIBRARIES_DIR}
ENV TAUCS_DIR
ENV TAUCS_LIB_DIR
PATH_SUFFIXES taucs lib
DOC "TAUCS library"
)
find_library(METIS_LIBRARY
NAMES "metis"
PATHS ${CGAL_TAUCS_LIBRARIES_DIR}
ENV TAUCS
ENV TAUCS_LIB_DIR
PATH_SUFFIXES taucs lib
DOC "Metis library"
)
if(TAUCS_LIBRARY AND METIS_LIBRARY)
set( TAUCS_LIBRARIES "${TAUCS_LIBRARY};${METIS_LIBRARY}" )
endif()
endif()
if (TAUCS_INCLUDE_DIR AND TAUCS_LIBRARIES_DIR)
set(TAUCS_FOUND TRUE)
elseif (TAUCS_INCLUDE_DIR AND TAUCS_LIBRARIES)
set(TAUCS_FOUND TRUE)
else()
set(TAUCS_FOUND FALSE)
endif()
if(NOT TAUCS_FIND_QUIETLY)
if(TAUCS_FOUND)
message(STATUS "TAUCS libraries found.")
else(TAUCS_FOUND)
if(TAUCS_FIND_REQUIRED)
message(FATAL_ERROR "TAUCS libraries not found. Please specify libraries location.")
else()
message(STATUS "TAUCS libraries not found. Please specify libraries location.")
endif()
endif(TAUCS_FOUND)
endif(NOT TAUCS_FIND_QUIETLY)
# Add variables to cache
set( TAUCS_INCLUDE_DIR "${TAUCS_INCLUDE_DIR}"
CACHE PATH "Directories containing the TAUCS header files" FORCE )
set( TAUCS_DEFINITIONS "${TAUCS_DEFINITIONS}"
CACHE STRING "Compilation options to use TAUCS" FORCE )
set( TAUCS_LIBRARIES "${TAUCS_LIBRARIES}"
CACHE FILEPATH "TAUCS libraries name" FORCE )
set( TAUCS_LIBRARIES_DIR "${TAUCS_LIBRARIES_DIR}"
CACHE PATH "Directories containing the TAUCS libraries" FORCE )
#message("DEBUG: TAUCS_INCLUDE_DIR = ${TAUCS_INCLUDE_DIR}")
#message("DEBUG: TAUCS_DEFINITIONS = ${TAUCS_DEFINITIONS}")
#message("DEBUG: TAUCS_LIBRARIES = ${TAUCS_LIBRARIES}")
#message("DEBUG: TAUCS_LIBRARIES_DIR = ${TAUCS_LIBRARIES_DIR}")
#message("DEBUG: TAUCS_FOUND = ${TAUCS_FOUND}")
endif(NOT LAPACK_FOUND)
if(TAUCS_FOUND)
set(TAUCS_USE_FILE "CGAL_UseTAUCS")
endif(TAUCS_FOUND)

View File

@ -1,47 +0,0 @@
// Copyright (c) 2007 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$
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Laurent Saboret
// Test if the LAPACK subset in ATLAS is available
#include <iostream>
extern "C" {
// Fortran interface taken from ATLAS/interfaces/lapack/F77/src/dpotrf.f
extern void dpotrf_(char *uplo, int *n, double *a, int *lda, int *info);
}
int main()
{
// Call dpotrf_() Lapack routine (Cholesky factorization)
int sn_size = 0;
int lda = 1;
int info;
dpotrf_((char*)"LOWER",
&sn_size,
NULL,
&lda,
&info);
std::cout << "ok for ATLAS" << std::endl;
return 0;
}

View File

@ -1,88 +0,0 @@
// Copyright (c) 2007 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$
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Laurent Saboret
// Test if BLAS is available
// blaswrap.h maps CBLAS function names to BLAS standard Fortran interface.
#ifdef CGAL_USE_CBLASWRAP
#ifndef CGAL_USE_F2C
#define CGAL_USE_F2C
#endif
#include <blaswrap.h>
#endif
#include <iostream>
extern "C" {
// Fortran interface (taken from www.netlib.org/clapack)...
void dgemm_(char* transa, char* transb, int* m,
int* n, int* k,
double* alpha,
double* a, int* lda, double* b, int* ldb,
double* beta,
double* c, int* ldc);
// ... or C interface (taken from AMD Core Math Library)
void dgemm (char transa, char transb, int m,
int n, int k,
double alpha,
double* a, int lda, double* b, int ldb,
double beta,
double* c, int ldc);
}
namespace CGAL { namespace BLAS {
inline
void dgemm (char* transa, char* transb, int* m,
int* n, int* k,
double* alpha,
double* a, int* lda, double* b, int* ldb,
double* beta,
double* c, int* ldc)
{
#ifdef CGAL_USE_F2C
::dgemm_(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc);
#else
::dgemm (*transa, *transb, *m, *n, *k, *alpha, a, *lda, b, *ldb, *beta, c, *ldc);
#endif
}
} }
int main()
{
char S[2] = "N";
double A = 2.0;
double B = 3.0;
double C = 5.0;
double alpha = 7.0;
double beta = 11.0;
int n = 1;
int ld = 1;
CGAL::BLAS::dgemm(S,S, &n,&n,&n, &alpha, &A,&ld, &B,&ld, &beta, &C,&ld);
if(C == 97.0) {
std::cout << "ok for BLAS" << std::endl;
return 0;
}
else {
return 1;
}
}

View File

@ -1,83 +0,0 @@
// Copyright (c) 2007 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$
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Marc Pouget
// Test if LAPACK is available
#include <iostream>
#include <cassert>
extern "C" {
// taken from acml.h
void dgelss(int m, int n, int nrhs,
double *a, int lda, double *b, int ldb, double *sing,
double rcond, int *irank, int *info);
void dgelss_(int *m, int *n, int *nrhs,
double *a, int *lda, double *b, int *ldb, double *
s, double *rcond, int *rank, double *work, int *lwork,
int *info);
}
namespace CGAL { namespace LAPACK {
inline
void dgelss(int *m, int *n, int *nrhs,
double *a, int *lda, double *b, int *ldb, double *
s, double *rcond, int *rank, double *work, int *lwork,
int *info)
{
#ifdef CGAL_USE_F2C
::dgelss_(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, info);
#else
::dgelss(*m, *n, *nrhs, a, *lda, b, *ldb, s, *rcond, rank, info);
#endif
}
} }
int main()
{
double M=1, B=1;
int m = 1,
n = 1,
nrhs = 1,
lda = m,
ldb = m,
rank,
lwork = 5*m,
info;
//c style
double * sing_values = new double[n]; // * sing_values = (double*) malloc(n*sizeof(double));
double* work = new double[lwork]; // (double*) malloc(lwork*sizeof(double));
double rcond = -1;
CGAL::LAPACK::dgelss(&m, &n, &nrhs, &M, &lda, &B, &ldb, sing_values,
&rcond, &rank, work, &lwork, &info);
assert(info==0);
assert(B==1.);
//clean up
delete sing_values;
delete work;
std::cout << "ok for lapack" << std::endl;
return 0;
}

View File

@ -1,106 +0,0 @@
// Copyright (c) 1997-2004
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). 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$
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Laurent Saboret
#ifndef CGAL_AUTO_LINK_LAPACK_H
#define CGAL_AUTO_LINK_LAPACK_H
#include <CGAL/config.h>
// Skip the whole file if auto-link is off
#if !defined(CGAL_NO_AUTOLINK_LAPACK) && !defined(CGAL_NO_AUTOLINK)
#if defined(_WIN32) && !defined(_WIN64) // if Windows 32 bits
// CGAL ships with ATLAS for Windows 32 bits, i.e this set of libraries (e.g. for VC++ 8 /MD):
// liblapack.lib libf77blas.lib libcblas.lib libatlas.lib vcf2c-vc80-mt.lib
//
// Notes: - Order matters.
// - Libraries with no "vc" toolset are compiled by gcc/g77. They are
// compatible with VC++ 7.1, 8.0 and 9.0, and with all VC++ runtimes.
// - Tested with 7.1, 8.0 and 9.0.
#define CGAL_LIB_NAME liblapack
#define CGAL_AUTO_LINK_NOMANGLE
#include <CGAL/auto_link/auto_link.h>
#define CGAL_LIB_NAME libf77blas
#define CGAL_AUTO_LINK_NOMANGLE
#include <CGAL/auto_link/auto_link.h>
#define CGAL_LIB_NAME libcblas
#define CGAL_AUTO_LINK_NOMANGLE
#include <CGAL/auto_link/auto_link.h>
#define CGAL_LIB_NAME libatlas
#define CGAL_AUTO_LINK_NOMANGLE
#include <CGAL/auto_link/auto_link.h>
#define CGAL_LIB_NAME vcf2c
#define CGAL_AUTO_LINK_NOMANGLE
#include <CGAL/auto_link/auto_link.h>
// ATLAS provides BLAS and LAPACK standard Fortran interface
#ifndef CGAL_USE_F2C
#define CGAL_USE_F2C
#endif
#endif // Win32
#ifdef _WIN64 // if Windows 64 bits
// ATLAS is not compatible with Win64, thus CGAL ships with CLAPACK and CBLAS.
// VC++ >= 8.0 is compatible with Windows 64 bits.
// The set set of libraries is (e.g. for VC++ 8 /MD):
// clapack-vc80-mt.lib blas-vc80-mt.lib vcf2c-vc80-mt.lib
//
// Notes: - Order matters.
// - Tested with VC++ 8.0 and 9.0.
#define CGAL_LIB_NAME clapack
#define CGAL_AUTO_LINK_NOMANGLE
#include <CGAL/auto_link/auto_link.h>
#define CGAL_LIB_NAME blas
#define CGAL_AUTO_LINK_NOMANGLE
#include <CGAL/auto_link/auto_link.h>
#define CGAL_LIB_NAME vcf2c
#define CGAL_AUTO_LINK_NOMANGLE
#include <CGAL/auto_link/auto_link.h>
// CLAPACK provides LAPACK standard Fortran interface.
// blaswrap.h maps CBLAS function names to BLAS standard Fortran interface.
#ifndef CGAL_USE_F2C
#define CGAL_USE_F2C
#endif
#include <blaswrap.h>
#endif // _WIN64
#endif // CGAL_NO_AUTOLINK_LAPACK && CGAL_NO_AUTOLINK
#endif // CGAL_AUTO_LINK_LAPACK_H

View File

@ -1,50 +0,0 @@
// Copyright (c) 1997-2004
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). 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$
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Laurent Saboret
#ifndef CGAL_AUTO_LINK_TAUCS_H
#define CGAL_AUTO_LINK_TAUCS_H
#include <CGAL/config.h>
// Skip the whole file if auto-link is off
#if !defined(CGAL_NO_AUTOLINK_TAUCS) && !defined(CGAL_NO_AUTOLINK)
# if defined(_WIN32) || defined(_WIN64)
# define CGAL_LIB_NAME libtaucs
# define CGAL_AUTO_LINK_NOMANGLE
# include <CGAL/auto_link/auto_link.h>
# define CGAL_LIB_NAME libmetis
# define CGAL_AUTO_LINK_NOMANGLE
# include <CGAL/auto_link/auto_link.h>
// Link with LAPACK, BLAS and F2C
# include <CGAL/auto_link/LAPACK.h>
# endif // Win32|Win64
#endif // CGAL_NO_AUTOLINK_TAUCS && CGAL_NO_AUTOLINK
#endif // CGAL_AUTO_LINK_TAUCS_H

View File

@ -11,18 +11,10 @@ find_package(CGAL QUIET)
if ( CGAL_FOUND )
# use either Eigen or BLAS/LAPACK
# use Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (NOT EIGEN3_FOUND)
find_package(LAPACK)
if(LAPACK_FOUND)
include( ${LAPACK_USE_FILE} )
endif(LAPACK_FOUND)
else()
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
if(EIGEN3_FOUND OR LAPACK_FOUND)
# Link with Boost.ProgramOptions (optional)
find_package(Boost QUIET COMPONENTS program_options)
if(Boost_PROGRAM_OPTIONS_FOUND)
@ -33,20 +25,18 @@ if ( CGAL_FOUND )
endif()
add_definitions( "-DCGAL_USE_BOOST_PROGRAM_OPTIONS" )
list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_LIBRARIES})
endif()
endif()
create_single_source_cgal_program( "Mesh_estimation.cpp" )
create_single_source_cgal_program( "Single_estimation.cpp" )
else(EIGEN3_FOUND OR LAPACK_FOUND)
message(STATUS "NOTICE: This program requires either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
endif(EIGEN3_FOUND OR LAPACK_FOUND)
else()
message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.")
endif()
else()
message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
endif()

View File

@ -1,4 +1,4 @@
To compile, you need support for lapack
To compile, you need support for Eigen
Program Single_estimation
---------------------

View File

@ -32,10 +32,6 @@
#include <utility>
#ifdef CGAL_EIGEN3_ENABLED
#include <CGAL/Eigen_svd.h>
#else
#ifdef CGAL_LAPACK_ENABLED
#include <CGAL/Lapack_svd.h>
#endif
#endif
namespace CGAL {
@ -51,11 +47,7 @@ unsigned int fact(unsigned int n){
#ifdef CGAL_EIGEN3_ENABLED
template < class DataKernel, class LocalKernel = Simple_cartesian<double>, class SvdTraits = Eigen_svd >
#else
#ifdef CGAL_LAPACK_ENABLED
template < class DataKernel, class LocalKernel = Simple_cartesian<double>, class SvdTraits = Lapack_svd>
#else
template < class DataKernel, class LocalKernel, class SvdTraits >
#endif
#endif
class Monge_via_jet_fitting {
public:

View File

@ -11,27 +11,14 @@ find_package(CGAL QUIET)
if ( CGAL_FOUND )
# use either Eigen or BLAS/LAPACK
# use Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (NOT EIGEN3_FOUND)
find_package(LAPACK)
if(LAPACK_FOUND)
include( ${LAPACK_USE_FILE} )
endif(LAPACK_FOUND)
else()
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
if(EIGEN3_FOUND OR LAPACK_FOUND)
create_single_source_cgal_program( "blind_1pt.cpp" )
else(EIGEN3_FOUND OR LAPACK_FOUND)
message(STATUS "NOTICE: This program requires either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
endif(EIGEN3_FOUND OR LAPACK_FOUND)
else()
message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.")
endif()
else()

View File

@ -37,7 +37,7 @@ if ( CGAL_FOUND )
find_package( TBB REQUIRED )
endif()
# Executables that do *not* require EIGEN or LAPACK
# Executables that do *not* require EIGEN
create_single_source_cgal_program( "average_spacing_example.cpp" )
create_single_source_cgal_program( "bilateral_smooth_point_set_example.cpp" )
create_single_source_cgal_program( "grid_simplification_example.cpp" )
@ -70,27 +70,18 @@ if ( CGAL_FOUND )
message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.")
endif()
# Use Eigen or BLAS and LAPACK (optional)
# Use Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (NOT EIGEN3_FOUND)
find_package(LAPACK)
if(LAPACK_FOUND)
include( ${LAPACK_USE_FILE} )
endif(LAPACK_FOUND)
else()
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
if(EIGEN3_FOUND OR LAPACK_FOUND)
# Executables that require Eigen or BLAS and LAPACK
# Executables that require Eigen
create_single_source_cgal_program( "jet_smoothing_example.cpp" )
create_single_source_cgal_program( "normal_estimation.cpp" )
create_single_source_cgal_program( "edges_example.cpp" )
else(EIGEN3_FOUND OR LAPACK_FOUND)
else()
message(STATUS "NOTICE: Some of the executables in this directory need either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
endif(EIGEN3_FOUND OR LAPACK_FOUND)
message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.")
endif()
foreach(target
scale_estimation_example

View File

@ -668,79 +668,6 @@ bilateral_smooth_point_set(
return bilateral_smooth_point_set<ConcurrencyTag>
(points, k, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::bilateral_smooth_point_set(), please update your code")
double
bilateral_smooth_point_set(
ForwardIterator first, ///< forward iterator on the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
PointMap point_map, ///< point property map.
NormalMap normal_map, ///< normal property map.
unsigned int k, ///< size of the neighborhood for the implicit surface patch fitting.
///< The larger the value is, the smoother the result will be.
typename Kernel::FT sharpness_angle, ///< controls the sharpness of the result.
///< The larger the value is, the smoother the result will be.
///< The range of possible value is [0, 90].
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points = CGAL::make_range (first, beyond);
return bilateral_smooth_point_set<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map(point_map).normal_map(normal_map)
.sharpness_angle(sharpness_angle).geom_traits(Kernel()));
}
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename PointMap,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::bilateral_smooth_point_set(), please update your code")
double
bilateral_smooth_point_set(
ForwardIterator first, ///< forward iterator to the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
PointMap point_map, ///< property map OutputIterator -> Point_3.
NormalMap normal_map, ///< property map ForwardIterator -> Vector_3.
const unsigned int k, ///< number of neighbors.
double sharpness_angle ///< control sharpness(0-90)
) ///< property map OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points = CGAL::make_range (first, beyond);
return bilateral_smooth_point_set<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map(point_map).normal_map(normal_map).sharpness_angle(sharpness_angle));
}
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::bilateral_smooth_point_set(), please update your code")
double
bilateral_smooth_point_set(
ForwardIterator first, ///< forward iterator to the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
const unsigned int k, ///< number of neighbors.
double sharpness_angle, ///< control sharpness(0-90)
NormalMap normal_map) ///< property map OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points = CGAL::make_range (first, beyond);
return bilateral_smooth_point_set<ConcurrencyTag>
(points,
k,
CGAL::parameters::normal_map(normal_map).sharpness_angle(sharpness_angle));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond

View File

@ -291,65 +291,6 @@ compute_average_spacing(
return compute_average_spacing<ConcurrencyTag>
(points, k, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ConcurrencyTag,
typename InputIterator,
typename PointMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::compute_average_spacing(), please update your code")
typename Kernel::FT
compute_average_spacing(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3
unsigned int k, ///< number of neighbors.
const Kernel& /*kernel*/) ///< geometric traits.
{
return compute_average_spacing<ConcurrencyTag>(
CGAL::make_range (first,beyond),
k,
CGAL::parameters::point_map (point_map).geom_traits (Kernel()));
}
// deprecated API
template <typename ConcurrencyTag,
typename InputIterator,
typename PointMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::compute_average_spacing(), please update your code")
typename Kernel_traits<typename boost::property_traits<PointMap>::value_type>::Kernel::FT
compute_average_spacing(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3
unsigned int k) ///< number of neighbors
{
return compute_average_spacing<ConcurrencyTag>(
CGAL::make_range (first,beyond),
k,
CGAL::parameters::point_map (point_map));
}
// deprecated API
template < typename ConcurrencyTag, typename InputIterator >
typename Kernel_traits<typename std::iterator_traits<InputIterator>::value_type>::Kernel::FT
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::compute_average_spacing(), please update your code")
compute_average_spacing(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
unsigned int k) ///< number of neighbors.
{
return compute_average_spacing<ConcurrencyTag>(
CGAL::make_range (first,beyond), k);
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond

View File

@ -599,117 +599,6 @@ edge_aware_upsample_point_set(
return edge_aware_upsample_point_set<ConcurrencyTag>
(points, output, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ConcurrencyTag,
typename OutputIterator,
typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::edge_aware_upsample_point_set(), please update your code")
OutputIterator
edge_aware_upsample_point_set(
ForwardIterator first, ///< forward iterator on the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< output iterator where output points and normals
///< are put.
PointMap point_map, ///< point property map.
NormalMap normal_map, ///< vector property map.
const typename Kernel::FT sharpness_angle, ///<
///< controls the preservation of sharp features.
///< The larger the value is,
///< the smoother the result will be.
///< The range of possible values is `[0, 90]`.
///< See section \ref Point_set_processing_3Upsample_Parameter2
///< for an example.
typename Kernel::FT edge_sensitivity, ///<
///< larger values of edge-sensitivity give higher priority
///< to inserting points along sharp features.
///< The range of possible values is `[0, 1]`.
///< See section \ref Point_set_processing_3Upsample_Parameter1
///< for an example.
typename Kernel::FT neighbor_radius, ///<
///< indicates the radius of the largest hole that should be filled.
///< The default value is set to 3 times the average spacing of the point set.
///< If the value given by user is smaller than the average spacing,
///< the function will use the default value instead.
const std::size_t number_of_output_points,///< number of output
///< points to generate.
const Kernel& /*kernel*/ ///< geometric traits.
)
{
return edge_aware_upsample_point_set<ConcurrencyTag>
(CGAL::make_range (first, beyond), output,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
sharpness_angle (sharpness_angle).
edge_sensitivity (edge_sensitivity).
neighbor_radius (neighbor_radius).
number_of_output_points (number_of_output_points).
geom_traits (Kernel()));
}
// deprecated API
template <typename ConcurrencyTag,
typename OutputIterator,
typename ForwardIterator,
typename PointMap,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::edge_aware_upsample_point_set(), please update your code")
OutputIterator
edge_aware_upsample_point_set(
ForwardIterator first, ///< forward iterator to the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< output iterator over points.
PointMap point_map, ///< property map: `ForwardIterator` -> Point_3.
NormalMap normal_map, ///< property map: `ForwardIterator` -> Vector_3.
double sharpness_angle, ///< control sharpness(0-90)
double edge_sensitivity, ///< edge sensitivity(0-5)
double neighbor_radius, ///< initial size of neighbors.
const std::size_t number_of_output_points///< number of iterations.
)
{
return edge_aware_upsample_point_set<ConcurrencyTag>
(CGAL::make_range (first, beyond), output,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
sharpness_angle (sharpness_angle).
edge_sensitivity (edge_sensitivity).
neighbor_radius (neighbor_radius).
number_of_output_points (number_of_output_points));
}
// deprecated API
template <typename ConcurrencyTag,
typename OutputIterator,
typename ForwardIterator,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::edge_aware_upsample_point_set(), please update your code")
OutputIterator
edge_aware_upsample_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< output iterator over points.
NormalMap normal_map, ///< property map: OutputIterator -> Vector_3.
double sharpness_angle = 30, ///< control sharpness(0-90)
double edge_sensitivity = 1, ///< edge sensitivity(0-5)
double neighbor_radius = -1, ///< initial size of neighbors.
const std::size_t number_of_output_points = 1000///< number of output points.
)
{
return edge_aware_upsample_point_set<ConcurrencyTag>
(CGAL::make_range (first, beyond), output,
CGAL::parameters::normal_map (normal_map).
sharpness_angle (sharpness_angle).
edge_sensitivity (edge_sensitivity).
neighbor_radius (neighbor_radius).
number_of_output_points (number_of_output_points));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond
} //namespace CGAL

View File

@ -744,255 +744,6 @@ estimate_global_range_scale(const PointRange& points)
return estimate_global_range_scale
(points, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename SamplesInputIterator,
typename SamplesPointMap,
typename QueriesInputIterator,
typename QueriesPointMap,
typename OutputIterator,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_local_k_neighbor_scales(), please update your code")
OutputIterator
estimate_local_k_neighbor_scales(
SamplesInputIterator first, ///< iterator over the first input sample.
SamplesInputIterator beyond, ///< past-the-end iterator over the input samples.
SamplesPointMap samples_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
QueriesInputIterator first_query, ///< iterator over the first point where scale must be estimated
QueriesInputIterator beyond_query, ///< past-the-end iterator over the points where scale must be estimated
QueriesPointMap queries_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
OutputIterator output, ///< output iterator to store the computed scales
const Kernel& /*kernel*/) ///< geometric traits.
{
return estimate_local_k_neighbor_scales
(CGAL::make_range (first, beyond),
CGAL::make_range (first_query, beyond_query),
output,
CGAL::parameters::point_map (samples_map).
query_point_map (queries_map).
geom_traits (Kernel()));
}
// deprecated API
template <typename SamplesInputIterator,
typename SamplesPointMap,
typename QueriesInputIterator,
typename QueriesPointMap,
typename OutputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_local_k_neighbor_scales(), please update your code")
OutputIterator
estimate_local_k_neighbor_scales(
SamplesInputIterator first, ///< iterator over the first input sample.
SamplesInputIterator beyond, ///< past-the-end iterator over the input samples.
SamplesPointMap samples_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
QueriesInputIterator first_query, ///< iterator over the first point where scale must be estimated
QueriesInputIterator beyond_query, ///< past-the-end iterator over the points where scale must be estimated
QueriesPointMap queries_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
OutputIterator output) ///< output iterator to store the computed scales
{
return estimate_local_k_neighbor_scales
(CGAL::make_range (first, beyond),
CGAL::make_range (first_query, beyond_query),
output,
CGAL::parameters::point_map (samples_map).
query_point_map (queries_map));
}
// deprecated API
template <typename SamplesInputIterator,
typename QueriesInputIterator,
typename OutputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_local_k_neighbor_scales(), please update your code")
OutputIterator
estimate_local_k_neighbor_scales(
SamplesInputIterator first, ///< iterator over the first input sample.
SamplesInputIterator beyond, ///< past-the-end iterator over the input samples.
QueriesInputIterator first_query, ///< iterator over the first point where scale must be estimated
QueriesInputIterator beyond_query, ///< past-the-end iterator over the points where scale must be estimated
OutputIterator output) ///< output iterator to store the computed scales
{
return estimate_local_k_neighbor_scales
(CGAL::make_range (first, beyond),
CGAL::make_range (first_query, beyond_query),
output);
}
// deprecated API
template <typename InputIterator,
typename PointMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_global_k_neighbor_scale(), please update your code")
std::size_t
estimate_global_k_neighbor_scale(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
const Kernel& kernel) ///< geometric traits.
{
return estimate_global_k_neighbor_scale
(CGAL::make_range (first, beyond),
CGAL::parameters::point_map (point_map).
geom_traits (kernel));
}
// deprecated API
template <typename InputIterator,
typename PointMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_global_k_neighbor_scale(), please update your code")
std::size_t
estimate_global_k_neighbor_scale(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map) ///< property map: value_type of InputIterator -> Point_3 or Point_2
{
return estimate_global_k_neighbor_scale
(CGAL::make_range (first, beyond),
CGAL::parameters::point_map (point_map));
}
// deprecated API
template <typename InputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_global_k_neighbor_scale(), please update your code")
std::size_t
estimate_global_k_neighbor_scale(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond) ///< past-the-end iterator over the input points.
{
return estimate_global_k_neighbor_scale
(CGAL::make_range (first, beyond));
}
// deprecated API
template <typename SamplesInputIterator,
typename SamplesPointMap,
typename QueriesInputIterator,
typename QueriesPointMap,
typename OutputIterator,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_local_range_scales(), please update your code")
OutputIterator
estimate_local_range_scales(
SamplesInputIterator first, ///< iterator over the first input sample.
SamplesInputIterator beyond, ///< past-the-end iterator over the input samples.
SamplesPointMap samples_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
QueriesInputIterator first_query, ///< iterator over the first point where scale must be estimated
QueriesInputIterator beyond_query, ///< past-the-end iterator over the points where scale must be estimated
QueriesPointMap queries_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
OutputIterator output, ///< output iterator to store the computed scales
const Kernel& /*kernel*/) ///< geometric traits.
{
return estimate_local_range_scales
(CGAL::make_range (first, beyond),
CGAL::make_range (first_query, beyond_query),
output,
CGAL::parameters::point_map (samples_map).
query_point_map (queries_map).
geom_traits (Kernel()));
}
// deprecated API
template <typename SamplesInputIterator,
typename SamplesPointMap,
typename QueriesInputIterator,
typename QueriesPointMap,
typename OutputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_local_range_scales(), please update your code")
OutputIterator
estimate_local_range_scales(
SamplesInputIterator first, ///< iterator over the first input sample.
SamplesInputIterator beyond, ///< past-the-end iterator over the input samples.
SamplesPointMap samples_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
QueriesInputIterator first_query, ///< iterator over the first point where scale must be estimated
QueriesInputIterator beyond_query, ///< past-the-end iterator over the points where scale must be estimated
QueriesPointMap queries_map, ///< property map: value_type of InputIterator -> Point_3 or Point_2
OutputIterator output) ///< output iterator to store the computed scales
{
return estimate_local_range_scales
(CGAL::make_range (first, beyond),
CGAL::make_range (first_query, beyond_query),
output,
CGAL::parameters::point_map (samples_map).
query_point_map (queries_map));
}
// deprecated API
template <typename SamplesInputIterator,
typename QueriesInputIterator,
typename OutputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_local_range_scales(), please update your code")
OutputIterator
estimate_local_range_scales(
SamplesInputIterator first, ///< iterator over the first input sample.
SamplesInputIterator beyond, ///< past-the-end iterator over the input samples.
QueriesInputIterator first_query, ///< iterator over the first point where scale must be estimated
QueriesInputIterator beyond_query, ///< past-the-end iterator over the points where scale must be estimated
OutputIterator output) ///< output iterator to store the computed scales
{
return estimate_local_range_scales
(CGAL::make_range (first, beyond),
CGAL::make_range (first_query, beyond_query),
output);
}
// deprecated API
template <typename InputIterator,
typename PointMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_global_range_scale(), please update your code")
double
estimate_global_range_scale(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3 or Point_3
const Kernel& kernel) ///< geometric traits.
{
return estimate_global_range_scale
(CGAL::make_range (first, beyond),
CGAL::parameters::point_map (point_map).
geom_traits (kernel));
}
// deprecated API
template <typename InputIterator,
typename PointMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_global_range_scale(), please update your code")
double
estimate_global_range_scale(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map) ///< property map: value_type of InputIterator -> Point_3 or Point_3
{
return estimate_global_range_scale
(CGAL::make_range (first, beyond),
CGAL::parameters::point_map (point_map));
}
// deprecated API
template <typename InputIterator>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::estimate_global_range_scale(), please update your code")
double
estimate_global_range_scale(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond) ///< past-the-end iterator over the input points.
{
return estimate_global_range_scale
(CGAL::make_range (first, beyond));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond
} //namespace CGAL

View File

@ -252,65 +252,6 @@ grid_simplify_point_set(PointRange& points, double epsilon)
return grid_simplify_point_set
(points, epsilon, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ForwardIterator,
typename PointMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::grid_simplify_point_set(), please update your code")
ForwardIterator grid_simplify_point_set(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3
double epsilon, ///< tolerance value when merging 3D points.
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points = CGAL::make_range (first, beyond);
return grid_simplify_point_set
(points,
epsilon,
CGAL::parameters::point_map (point_map).
geom_traits (Kernel()));
}
// deprecated API
template <typename ForwardIterator,
typename PointMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::grid_simplify_point_set(), please update your code")
ForwardIterator
grid_simplify_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3
double epsilon) ///< tolerance value when merging 3D points
{
CGAL::Iterator_range<ForwardIterator> points = CGAL::make_range (first, beyond);
return grid_simplify_point_set
(points,
epsilon,
CGAL::parameters::point_map (point_map));
}
// deprecated API
template <typename ForwardIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::grid_simplify_point_set(), please update your code")
ForwardIterator
grid_simplify_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
double epsilon) ///< tolerance value when merging 3D points
{
CGAL::Iterator_range<ForwardIterator> points = CGAL::make_range (first, beyond);
return grid_simplify_point_set
(points,
epsilon);
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond

View File

@ -361,86 +361,6 @@ namespace CGAL {
return hierarchy_simplify_point_set
(points, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ForwardIterator,
typename PointMap,
typename DiagonalizeTraits,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::hierarchy_simplify_point_set(), please update your code")
ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
ForwardIterator end,
PointMap point_map,
const unsigned int size,
const double var_max,
const DiagonalizeTraits&,
const Kernel&)
{
CGAL::Iterator_range<ForwardIterator> points (begin, end);
return hierarchy_simplify_point_set
(points,
CGAL::parameters::point_map (point_map).
size (size).
maximum_variation (var_max).
diagonalize_traits (DiagonalizeTraits()).
geom_traits(Kernel()));
}
// deprecated API
template <typename ForwardIterator,
typename PointMap,
typename DiagonalizeTraits>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::hierarchy_simplify_point_set(), please update your code")
ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
ForwardIterator end,
PointMap point_map,
const unsigned int size,
const double var_max,
const DiagonalizeTraits& diagonalize_traits)
{
CGAL::Iterator_range<ForwardIterator> points (begin, end);
return hierarchy_simplify_point_set
(points,
CGAL::parameters::point_map (point_map).
size (size).
maximum_variation (var_max).
diagonalize_traits (diagonalize_traits));
}
// deprecated API
template <typename ForwardIterator,
typename PointMap >
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::hierarchy_simplify_point_set(), please update your code")
ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
ForwardIterator end,
PointMap point_map,
const unsigned int size,
const double var_max)
{
CGAL::Iterator_range<ForwardIterator> points (begin, end);
return hierarchy_simplify_point_set
(points,
CGAL::parameters::point_map (point_map).
size (size).
maximum_variation (var_max));
}
// deprecated API
template <typename ForwardIterator >
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::hierarchy_simplify_point_set(), please update your code")
ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
ForwardIterator end,
const unsigned int size = 10,
const double var_max = 0.333)
{
CGAL::Iterator_range<ForwardIterator> points (begin, end);
return hierarchy_simplify_point_set
(points,
CGAL::parameters::size (size).
maximum_variation (var_max));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond
} // namespace CGAL

View File

@ -327,121 +327,6 @@ jet_estimate_normals(
jet_estimate_normals<ConcurrencyTag>
(points, k, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename Kernel,
typename SvdTraits
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::jet_estimate_normals(), please update your code")
void
jet_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k, ///< number of neighbors.
const Kernel& /*kernel*/, ///< geometric traits.
unsigned int degree_fitting = 2) ///< fitting degree
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return jet_estimate_normals<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
degree_fitting (degree_fitting).
geom_traits(Kernel()));
}
#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::jet_estimate_normals(), please update your code")
void
jet_estimate_normals(
ForwardIterator first,
ForwardIterator beyond,
PointMap point_map,
NormalMap normal_map,
unsigned int k,
const Kernel& kernel,
unsigned int degree_fitting = 2)
{
#ifdef CGAL_EIGEN3_ENABLED
typedef Eigen_svd SvdTraits;
#else
typedef Lapack_svd SvdTraits;
#endif
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return jet_estimate_normals<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
degree_fitting (degree_fitting).
svd_traits (SvdTraits()).
geom_traits(kernel));
}
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename PointMap,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::jet_estimate_normals(), please update your code")
void
jet_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k, ///< number of neighbors.
unsigned int degree_fitting = 2)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return jet_estimate_normals<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
degree_fitting (degree_fitting));
}
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::jet_estimate_normals(), please update your code")
void
jet_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k, ///< number of neighbors.
unsigned int degree_fitting = 2)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return jet_estimate_normals<ConcurrencyTag>
(points,
k,
CGAL::parameters::normal_map (normal_map).
degree_fitting (degree_fitting));
}
#endif // CGAL Eigen / Lapack
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond
} //namespace CGAL

View File

@ -313,117 +313,6 @@ jet_smooth_point_set(
jet_smooth_point_set<ConcurrencyTag>
(points, k, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ConcurrencyTag,
typename InputIterator,
typename PointMap,
typename Kernel,
typename SvdTraits
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::jet_smooth_point_set(), please update your code")
void
jet_smooth_point_set(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3.
unsigned int k, ///< number of neighbors.
const Kernel& /*kernel*/, ///< geometric traits.
unsigned int degree_fitting = 2, ///< fitting degree
unsigned int degree_monge = 2) ///< Monge degree
{
CGAL::Iterator_range<InputIterator> points (first, beyond);
return jet_smooth_point_set<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map (point_map).
degree_fitting (degree_fitting).
degree_monge (degree_monge).
geom_traits(Kernel()));
}
#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
// deprecated API
template <typename ConcurrencyTag,
typename InputIterator,
typename PointMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::jet_smooth_point_set(), please update your code")
void
jet_smooth_point_set(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3.
unsigned int k, ///< number of neighbors.
const Kernel& kernel, ///< geometric traits.
unsigned int degree_fitting = 2, ///< fitting degree
unsigned int degree_monge = 2) ///< Monge degree
{
#ifdef CGAL_EIGEN3_ENABLED
typedef Eigen_svd SvdTraits;
#else
typedef Lapack_svd SvdTraits;
#endif
CGAL::Iterator_range<InputIterator> points (first, beyond);
return jet_smooth_point_set<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map (point_map).
degree_fitting (degree_fitting).
degree_monge (degree_monge).
svd_traits (SvdTraits()).
geom_traits(kernel));
}
// deprecated API
template <typename ConcurrencyTag,
typename InputIterator,
typename PointMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::jet_smooth_point_set(), please update your code")
void
jet_smooth_point_set(
InputIterator first, ///< iterator over the first input point
InputIterator beyond, ///< past-the-end iterator
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3
unsigned int k, ///< number of neighbors.
const unsigned int degree_fitting = 2,
const unsigned int degree_monge = 2)
{
CGAL::Iterator_range<InputIterator> points (first, beyond);
return jet_smooth_point_set<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map (point_map).
degree_fitting (degree_fitting).
degree_monge (degree_monge));
}
// deprecated API
template <typename ConcurrencyTag,
typename InputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::jet_smooth_point_set(), please update your code")
void
jet_smooth_point_set(
InputIterator first, ///< iterator over the first input point
InputIterator beyond, ///< past-the-end iterator
unsigned int k, ///< number of neighbors.
const unsigned int degree_fitting = 2,
const unsigned int degree_monge = 2)
{
CGAL::Iterator_range<InputIterator> points (first, beyond);
return jet_smooth_point_set<ConcurrencyTag>
(points,
k,
CGAL::parameters::degree_fitting (degree_fitting).
degree_monge (degree_monge));
}
#endif // CGAL Eigen / Lapack
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond

View File

@ -742,74 +742,6 @@ mst_orient_normals(
{
return mst_orient_normals (points, k, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::mst_orient_normals(), please update your code")
ForwardIterator
mst_orient_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k, ///< number of neighbors
const Kernel& kernel) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return mst_orient_normals
(points,
k,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
geom_traits(kernel));
}
// deprecated API
template <typename ForwardIterator,
typename PointMap,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::mst_orient_normals(), please update your code")
ForwardIterator
mst_orient_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k) ///< number of neighbors
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return mst_orient_normals
(points,
k,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
}
// deprecated API
template <typename ForwardIterator,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::mst_orient_normals(), please update your code")
ForwardIterator
mst_orient_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k) ///< number of neighbors
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return mst_orient_normals
(points,
k,
CGAL::parameters::normal_map (normal_map));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond

View File

@ -308,77 +308,6 @@ pca_estimate_normals(
return pca_estimate_normals<ConcurrencyTag>
(points, k, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::pca_estimate_normals(), please update your code")
void
pca_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k, ///< number of neighbors.
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return pca_estimate_normals<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
geom_traits(Kernel()));
}
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename PointMap,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::pca_estimate_normals(), please update your code")
void
pca_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k) ///< number of neighbors.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return pca_estimate_normals<ConcurrencyTag>
(points,
k,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
}
// deprecated API
template <typename ConcurrencyTag,
typename ForwardIterator,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::pca_estimate_normals(), please update your code")
void
pca_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k) ///< number of neighbors.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return pca_estimate_normals<ConcurrencyTag>
(points,
k,
CGAL::parameters::normal_map (normal_map));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond

View File

@ -76,60 +76,6 @@ random_simplify_point_set(
return first_point_to_remove;
}
/// \cond SKIP_IN_MANUAL
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ForwardIterator,
typename PointMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::random_simplify_point_set(), please update your code")
ForwardIterator
random_simplify_point_set(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap /*point_map*/, ///< property map: value_type of ForwardIterator -> Point_3
double removed_percentage, ///< percentage of points to remove.
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return random_simplify_point_set (points, removed_percentage);
}
// deprecated API
template <typename ForwardIterator,
typename PointMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::random_simplify_point_set(), please update your code")
ForwardIterator
random_simplify_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
PointMap, ///< property map: value_type of ForwardIterator -> Point_3
double removed_percentage) ///< percentage of points to remove
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return random_simplify_point_set (points, removed_percentage);
}
// deprecated API
template <typename ForwardIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::random_simplify_point_set(), please update your code")
ForwardIterator
random_simplify_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
double removed_percentage) ///< percentage of points to remove
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return random_simplify_point_set (points, removed_percentage);
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond
} //namespace CGAL
#include <CGAL/enable_warnings.h>

View File

@ -249,82 +249,6 @@ remove_outliers(
{
return remove_outliers (points, k, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename InputIterator,
typename PointMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::remove_outliers(), please update your code")
InputIterator
remove_outliers(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3
unsigned int k, ///< number of neighbors.
double threshold_percent, ///< maximum percentage of points to remove.
double threshold_distance, ///< minimum distance for a point to be
///< considered as outlier (distance here is the square root of the average
///< squared distance to K nearest
///< neighbors)
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL::Iterator_range<InputIterator> points (first, beyond);
return remove_outliers
(points,
k,
CGAL::parameters::point_map (point_map).
threshold_percent (threshold_percent).
threshold_distance (threshold_distance).
geom_traits(Kernel()));
}
// deprecated API
template <typename InputIterator,
typename PointMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::remove_outliers(), please update your code")
InputIterator
remove_outliers(
InputIterator first, ///< iterator over the first input point
InputIterator beyond, ///< past-the-end iterator
PointMap point_map, ///< property map: value_type of InputIterator -> Point_3
unsigned int k, ///< number of neighbors.
double threshold_percent, ///< percentage of points to remove
double threshold_distance = 0.0) ///< minimum average squared distance to K nearest neighbors
///< for a point to be removed.
{
CGAL::Iterator_range<InputIterator> points (first, beyond);
return remove_outliers
(points,
k,
CGAL::parameters::point_map (point_map).
threshold_percent (threshold_percent).
threshold_distance (threshold_distance));
}
// deprecated API
template <typename InputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::remove_outliers(), please update your code")
InputIterator
remove_outliers(
InputIterator first, ///< iterator over the first input point
InputIterator beyond, ///< past-the-end iterator
unsigned int k, ///< number of neighbors.
double threshold_percent, ///< percentage of points to remove
double threshold_distance = 0.0) ///< minimum average squared distance to K nearest neighbors
///< for a point to be removed.
{
CGAL::Iterator_range<InputIterator> points (first, beyond);
return remove_outliers
(points,
k,
CGAL::parameters::threshold_percent (threshold_percent).
threshold_distance (threshold_distance));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond

View File

@ -202,30 +202,6 @@ public:
}
/// \cond SKIP_IN_MANUAL
// deprecated
template <typename PointRange,
typename PointMap,
typename NormalMap,
typename PlaneRange,
typename PlaneMap,
typename IndexMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::Point_set_with_structure(), please update your code")
Point_set_with_structure (const PointRange& points,
PointMap point_map,
NormalMap normal_map,
const PlaneRange& planes,
PlaneMap plane_map,
IndexMap index_map,
double epsilon,
double attraction_factor = 3.)
{
init (points, planes, epsilon,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
plane_map (plane_map).
plane_index_map (index_map).
attraction_factor (attraction_factor));
}
template <typename PointRange,
typename PlaneRange,
@ -1582,72 +1558,6 @@ structure_point_set (const PointRange& points, ///< range of points.
}
/// \endcond
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
namespace Shape_detection_3{
//Forward declarations
template <class Traits>
class Efficient_RANSAC;
template <typename Traits>
class Plane_map;
template <typename Traits>
class Point_to_shape_index_map;
} // end of namespace Shape_detection_3
// deprecated API
template <typename Traits,
typename OutputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::structure_point_set(), please update your code")
OutputIterator
structure_point_set (typename Traits::Input_range::iterator first, ///< iterator over the first input point.
typename Traits::Input_range::iterator beyond, ///< past-the-end iterator over the input points.
typename Traits::Point_map point_map, ///< property map: value_type of InputIterator -> Point_3.
typename Traits::Normal_map normal_map, ///< property map: value_type of InputIterator -> Vector_3.
OutputIterator output, ///< output iterator where output points are written
Shape_detection_3::Efficient_RANSAC<Traits>&
shape_detection, ///< shape detection object
double epsilon, ///< size parameter
double attraction_factor = 3.) ///< attraction factor
{
typename Shape_detection_3::Efficient_RANSAC<Traits>::Plane_range planes = shape_detection.planes();
return structure_point_set (CGAL::make_range(first, beyond),
planes,
output,
epsilon, // epsilon for structuring points
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
plane_map (CGAL::Shape_detection_3::Plane_map<Traits>()).
plane_index_map (Shape_detection_3::Point_to_shape_index_map<Traits>(CGAL::make_range(first, beyond), planes)).
attraction_factor(attraction_factor));
}
// deprecated API
template <typename Traits,
typename OutputIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::structure_point_set(), please update your code")
OutputIterator
structure_point_set (typename Traits::Input_range::iterator first, ///< iterator over the first input point.
typename Traits::Input_range::iterator beyond, ///< past-the-end iterator over the input points.
OutputIterator output, ///< output iterator where output points are written
Shape_detection_3::Efficient_RANSAC<Traits>&
shape_detection, ///< shape detection object
double epsilon, ///< size parameter
double attraction_factor = 3.) ///< attraction factor
{
return structure_point_set (first, beyond,
typename Traits::Point_map(),
typename Traits::Normal_map(),
output,
shape_detection,
epsilon,
attraction_factor);
}
/// \endcond
#endif // CGAL_NO_DEPRECATED_CODE
} //namespace CGAL

View File

@ -309,28 +309,6 @@ compute_vcm (const PointRange& points,
CGAL::Point_set_processing_3::parameters::all_default (points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template < class ForwardIterator,
class PointMap,
class Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::compute_vcm(), please update your code")
void
compute_vcm (ForwardIterator first,
ForwardIterator beyond,
PointMap point_map,
std::vector< std::array<double, 6> > &ccov,
double offset_radius,
double convolution_radius,
const Kernel & kernel)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
compute_vcm (points, ccov, offset_radius, convolution_radius,
CGAL::parameters::point_map (point_map).
geom_traits (kernel));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond
/// \cond SKIP_IN_MANUAL
@ -466,33 +444,6 @@ vcm_estimate_normals (PointRange& points,
CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template < typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename VCMTraits
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::vcm_estimate_normals(), please update your code")
void
vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
double offset_radius, ///< offset radius.
double convolution_radius, ///< convolution radius.
VCMTraits
)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
vcm_estimate_normals
(points,
offset_radius, convolution_radius,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
diagonalize_traits (VCMTraits()));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond
@ -551,114 +502,7 @@ vcm_estimate_normals (PointRange& points,
CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template < typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename VCMTraits
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::vcm_estimate_normals(), please update your code")
void
vcm_estimate_normals (ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
double offset_radius, ///< offset radius.
unsigned int k, ///< number of neighbor points used for the convolution.
VCMTraits
)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
vcm_estimate_normals
(points,
offset_radius, k,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
diagonalize_traits (VCMTraits()));
}
// deprecated API
template < typename ForwardIterator,
typename PointMap,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::vcm_estimate_normals(), please update your code")
void
vcm_estimate_normals (ForwardIterator first,
ForwardIterator beyond,
PointMap point_map,
NormalMap normal_map,
double offset_radius,
double convolution_radius)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
vcm_estimate_normals
(points,
offset_radius, convolution_radius,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
}
// deprecated API
template < typename ForwardIterator,
typename PointMap,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::vcm_estimate_normals(), please update your code")
void
vcm_estimate_normals (ForwardIterator first,
ForwardIterator beyond,
PointMap point_map,
NormalMap normal_map,
double offset_radius,
unsigned int nb_neighbors_convolve)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
vcm_estimate_normals
(points,
offset_radius, nb_neighbors_convolve,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
}
// deprecated API
template < typename ForwardIterator,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::vcm_estimate_normals(), please update your code")
void
vcm_estimate_normals (ForwardIterator first,
ForwardIterator beyond,
NormalMap normal_map,
double offset_radius,
double convolution_radius) {
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
vcm_estimate_normals
(points,
offset_radius, convolution_radius,
CGAL::parameters::normal_map (normal_map));
}
// deprecated API
template < typename ForwardIterator,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::vcm_estimate_normals(), please update your code")
void
vcm_estimate_normals (ForwardIterator first,
ForwardIterator beyond,
NormalMap normal_map,
double offset_radius,
unsigned int nb_neighbors_convolve) {
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
vcm_estimate_normals
(points,
offset_radius, nb_neighbors_convolve,
CGAL::parameters::normal_map (normal_map));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \endcond
} // namespace CGAL

View File

@ -688,107 +688,7 @@ wlop_simplify_and_regularize_point_set(
return wlop_simplify_and_regularize_point_set<ConcurrencyTag>
(points, output, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
// deprecated API
template <typename ConcurrencyTag,
typename OutputIterator,
typename RandomAccessIterator,
typename PointMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::wlop_simplify_and_regularize_point_set(), please update your code")
OutputIterator
wlop_simplify_and_regularize_point_set(
RandomAccessIterator first, ///< random-access iterator to the first input point.
RandomAccessIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< output iterator where output points are put.
PointMap point_map, ///< point property map.
double select_percentage, ///< percentage of points to retain.
///< The default value is set to 5 (\%).
double radius, ///< spherical neighborhood radius.
///< This is a key parameter that needs to be finely tuned.
///< The result will be irregular if too small, but a larger
///< value will impact the runtime.
///< In practice, choosing a radius such that the neighborhood of each sample point
///< includes at least two rings of neighboring sample points
///< gives satisfactory result.
///< The default value is set to 8 times the average spacing of the point set.
unsigned int iter_number, ///< number of iterations to solve the optimsation problem. The default value is 35.
///< More iterations give a more regular result but increase the runtime.
bool require_uniform_sampling,///< an optional preprocessing, which will give better result
///< if the distribution of the input points is highly non-uniform.
///< The default value is `false`.
const Kernel& ///< geometric traits.
)
{
CGAL::Iterator_range<RandomAccessIterator> points (first, beyond);
return wlop_simplify_and_regularize_point_set<ConcurrencyTag>
(points, output,
CGAL::parameters::point_map (point_map).
select_percentage (select_percentage).
neighbor_radius (radius).
number_of_iterations(iter_number).
require_uniform_sampling (require_uniform_sampling).
geom_traits (Kernel()));
}
// deprecated API
template <typename ConcurrencyTag,
typename OutputIterator,
typename RandomAccessIterator,
typename PointMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::wlop_simplify_and_regularize_point_set(), please update your code")
OutputIterator
wlop_simplify_and_regularize_point_set(
RandomAccessIterator first, ///< iterator over the first input point
RandomAccessIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< add back-inserter
PointMap point_map, ///< property map RandomAccessIterator -> Point_3
const double select_percentage, ///< percentage of points to retain
double neighbor_radius, ///< size of neighbors.
const unsigned int max_iter_number, ///< number of iterations.
const bool require_uniform_sampling ///< if needed to compute density
/// to generate more rugularized result.
)
{
CGAL::Iterator_range<RandomAccessIterator> points (first, beyond);
return wlop_simplify_and_regularize_point_set<ConcurrencyTag>
(points, output,
CGAL::parameters::point_map (point_map).
select_percentage (select_percentage).
neighbor_radius (neighbor_radius).
number_of_iterations(max_iter_number).
require_uniform_sampling (require_uniform_sampling));
}
// deprecated API
template <typename ConcurrencyTag,
typename OutputIterator,
typename RandomAccessIterator >
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::wlop_simplify_and_regularize_point_set(), please update your code")
OutputIterator
wlop_simplify_and_regularize_point_set(
RandomAccessIterator first, ///< iterator to the first input point.
RandomAccessIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< add back-inserter.
const double select_percentage = 5, ///< percentage of points to retain
double neighbor_radius = -1, ///< size of neighbors.
const unsigned int max_iter_number = 35, ///< number of iterations.
const bool require_uniform_sampling = false ///< if needed to compute density
///to generate a more uniform result.
)
{
CGAL::Iterator_range<RandomAccessIterator> points (first, beyond);
return wlop_simplify_and_regularize_point_set<ConcurrencyTag>
(points, output,
CGAL::parameters::select_percentage (select_percentage).
neighbor_radius (neighbor_radius).
number_of_iterations(max_iter_number).
require_uniform_sampling (require_uniform_sampling));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// @endcond
/// \endcond
} //namespace CGAL

View File

@ -28,7 +28,7 @@ if ( CGAL_FOUND )
find_package( TBB QUIET )
# Executables that do *not* require LAPACK
# Executables that do *not* require Eigen
create_single_source_cgal_program( "read_test.cpp" )
create_single_source_cgal_program( "read_test_with_different_pmaps.cpp" )
create_single_source_cgal_program( "analysis_test.cpp" )
@ -38,50 +38,20 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "edge_aware_upsample_test.cpp" )
create_single_source_cgal_program( "structuring_test.cpp" )
# Deprecated tests
create_single_source_cgal_program( "deprecated_read_test.cpp" )
create_single_source_cgal_program( "deprecated_read_test_with_different_pmaps.cpp" )
create_single_source_cgal_program( "deprecated_analysis_test.cpp" )
create_single_source_cgal_program( "deprecated_remove_outliers_test.cpp" )
create_single_source_cgal_program( "deprecated_wlop_simplify_and_regularize_test.cpp" )
create_single_source_cgal_program( "deprecated_bilateral_smoothing_test.cpp" )
create_single_source_cgal_program( "deprecated_edge_aware_upsample_test.cpp" )
create_single_source_cgal_program( "deprecated_structuring_test.cpp" )
# Use Eigen or BLAS and LAPACK (optional)
# Use Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (NOT EIGEN3_FOUND)
find_package(LAPACK)
if(LAPACK_FOUND)
include( ${LAPACK_USE_FILE} )
endif(LAPACK_FOUND)
else()
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
if(EIGEN3_FOUND OR LAPACK_FOUND)
# Executables that require Eigen or BLAS and LAPACK
# Executables that require Eigen
create_single_source_cgal_program( "normal_estimation_test.cpp" )
create_single_source_cgal_program( "hierarchy_simplification_test.cpp" )
create_single_source_cgal_program( "smoothing_test.cpp" )
create_single_source_cgal_program( "vcm_plane_test.cpp" )
create_single_source_cgal_program( "vcm_all_test.cpp" )
create_single_source_cgal_program( "jet_pointer_as_property_map.cpp" )
# Deprecated tests
create_single_source_cgal_program( "deprecated_normal_estimation_test.cpp" )
create_single_source_cgal_program( "deprecated_hierarchy_simplification_test.cpp" )
create_single_source_cgal_program( "deprecated_smoothing_test.cpp" )
create_single_source_cgal_program( "deprecated_vcm_plane_test.cpp" )
create_single_source_cgal_program( "deprecated_vcm_all_test.cpp" )
create_single_source_cgal_program( "deprecated_jet_pointer_as_property_map.cpp" )
else(EIGEN3_FOUND OR LAPACK_FOUND)
message(STATUS "NOTICE: This program requires either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
endif(EIGEN3_FOUND OR LAPACK_FOUND)
else()
message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.")
endif()
foreach(target
analysis_test

View File

@ -1,139 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
// analysis_test.cpp
//----------------------------------------------------------
// Test the analysis methods:
// For each input point set, compute the average spacing.
// Input format is .xyz.
// No output.
//----------------------------------------------------------
// analysis_test points1.xyz points2.xyz...
// CGAL
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Timer.h>
#include <CGAL/Memory_sizer.h>
// This package
#include <CGAL/compute_average_spacing.h>
#include <CGAL/IO/read_xyz_points.h>
#include <deque>
#include <cstdlib>
#include <fstream>
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
// kernel
typedef CGAL::Simple_cartesian<float> Kernel;
// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
// ----------------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------------
// Computes average spacing.
void test_average_spacing(std::deque<Point>& points, // input point set
unsigned int nb_neighbors) // number of neighbors
{
std::cerr << "Computes average spacing to k nearest neighbors (k="<< nb_neighbors << ")... ";
CGAL::Timer task_timer; task_timer.start();
FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(points.begin(), points.end(), nb_neighbors);
std::cout << average_spacing << std::endl;
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "ok: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
}
// ----------------------------------------------------------------------------
// main()
// ----------------------------------------------------------------------------
int main(int argc, char * argv[])
{
std::cerr << "Analysis test" << std::endl;
//***************************************
// decode parameters
//***************************************
// usage
if(argc < 2)
{
std::cerr << "For each input point set, compute the average spacing.\n";
std::cerr << "\n";
std::cerr << "Usage: " << argv[0] << " file1.xyz file2.xyz..." << std::endl;
std::cerr << "Input file format is .xyz.\n";
std::cerr << "No output" << std::endl;
return EXIT_FAILURE;
}
// Average Spacing options
const unsigned int nb_neighbors = 6; // K-nearest neighbors = 1 ring (average spacing)
// Accumulated errors
int accumulated_fatal_err = EXIT_SUCCESS;
// Process each input file
for(int i=1; i<argc; i++)
{
std::cerr << std::endl;
//***************************************
// Loads point set
//***************************************
// File name is:
std::string input_filename = argv[i];
// Reads the point set file in points[].
std::deque<Point> points;
std::cerr << "Open " << input_filename << " for reading..." << std::endl;
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
if(stream &&
CGAL::read_xyz_points(stream, std::back_inserter(points)))
{
std::cerr << "ok (" << points.size() << " points)" << std::endl;
}
else
{
std::cerr << "Error: cannot read file " << input_filename << std::endl;
accumulated_fatal_err = EXIT_FAILURE;
continue;
}
//***************************************
// Test
//***************************************
test_average_spacing(points, nb_neighbors);
} // for each input file
std::cerr << std::endl;
// Returns accumulated fatal error
std::cerr << "Tool returned " << accumulated_fatal_err << std::endl;
return accumulated_fatal_err;
}

View File

@ -1 +0,0 @@
data/fin90_with_PCA_normals.xyz

View File

@ -1,157 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
// bilateral_smoothing_test.cpp
//----------------------------------------------------------
// Test the smoothing methods:
// For each input point set, smooth it.
// Input format is .xyz.
// No output.
//----------------------------------------------------------
// bilateral_smoothing_test points1.xyz points2.xyz...
// CGAL
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Real_timer.h>
#include <CGAL/Memory_sizer.h>
// This package
#include <CGAL/bilateral_smooth_point_set.h>
#include <CGAL/IO/read_xyz_points.h>
#include <deque>
#include <cstdlib>
#include <fstream>
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
// kernel
typedef CGAL::Simple_cartesian<double> Kernel;
// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
// Point with normal vector stored in a std::pair.
typedef std::pair<Point, Vector> PointVectorPair;
// ----------------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------------
template<typename Concurrency_tag>
void test_bilateral_smoothing(std::deque<PointVectorPair>& points,// input point set
unsigned int nb_neighbors, // number of neighbors
double sharpness_sigma)
{
CGAL::Real_timer task_timer; task_timer.start();
for (int i = 0; i < 3; i++)
{
CGAL::bilateral_smooth_point_set <Concurrency_tag>(
points.begin(),
points.end(),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>(),
nb_neighbors,
sharpness_sigma);
}
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "ok: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
}
// ----------------------------------------------------------------------------
// main()
// ----------------------------------------------------------------------------
int main(int argc, char * argv[])
{
std::cerr << "Bilateral smoothing test" << std::endl;
//***************************************
// decode parameters
//***************************************
// usage
if(argc < 2)
{
std::cerr << "For each input point set, smooth it.\n";
std::cerr << "\n";
std::cerr << "Usage: " << argv[0] << " file1.xyz file2.xyz..." << std::endl;
std::cerr << "Input file format is .xyz.\n";
std::cerr << "No output" << std::endl;
return EXIT_FAILURE;
}
// Smoothing options
const unsigned int nb_neighbors = 50; // K-nearest neighbors
const double sharpness_sigma = 25; // control sharpness
// Accumulated errors
int accumulated_fatal_err = EXIT_SUCCESS;
// Process each input file
for(int i=1; i<argc; i++)
{
std::cerr << std::endl;
//***************************************
// Loads point set
//***************************************
// File name is:
std::string input_filename = argv[i];
// Reads the point set file in points[].
std::deque<PointVectorPair> points;
std::cerr << "Opening " << input_filename << " for reading..." << std::endl;
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
if(stream &&
CGAL::read_xyz_points_and_normals(stream,
std::back_inserter(points),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>()))
{
std::cerr << "ok (" << points.size() << " points)" << std::endl;
}
else
{
std::cerr << "Error: cannot read file " << input_filename << std::endl;
accumulated_fatal_err = EXIT_FAILURE;
continue;
}
//***************************************
// Test
//***************************************
#ifdef CGAL_LINKED_WITH_TBB
std::deque<PointVectorPair> points2(points);
#endif // CGAL_LINKED_WITH_TBB
test_bilateral_smoothing<CGAL::Sequential_tag>(
points, nb_neighbors, sharpness_sigma);
#ifdef CGAL_LINKED_WITH_TBB
test_bilateral_smoothing<CGAL::Parallel_tag>(
points2, nb_neighbors, sharpness_sigma);
#endif // CGAL_LINKED_WITH_TBB
} // for each input file
std::cerr << std::endl;
// Returns accumulated fatal error
std::cerr << "Tool returned " << accumulated_fatal_err << std::endl;
return accumulated_fatal_err;
}

View File

@ -1,168 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
// edge_aware_upsample_test.cpp
//----------------------------------------------------------
// Test the edge aware up-sample test method:
// Input format is .xyz.
// No output.
//----------------------------------------------------------
// edge_aware_upsample_test points1.xyz points2.xyz...
// CGAL
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Real_timer.h>
#include <CGAL/Memory_sizer.h>
// This package
#include <CGAL/edge_aware_upsample_point_set.h>
#include <CGAL/IO/read_xyz_points.h>
#include <cstdlib>
#include <fstream>
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
// kernel
typedef CGAL::Simple_cartesian<float> Kernel;
// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
// Point with normal vector stored in a std::pair.
typedef std::pair<Point, Vector> PointVectorPair;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
// ----------------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------------
void test_edge_aware_upsample(std::vector<PointVectorPair>& points, // input point set
double sharpness_sigma, //control sharpness
double edge_sensitivity,// more points will up-sample on edge
double neighbor_radius, // initial neighbors size.
unsigned int times_of_output_points)
{
CGAL::Real_timer task_timer; task_timer.start();
std::cerr << "Running edge aware up-sample, (sharpness_sigma: "
<< sharpness_sigma << "%, number_of_output_points="
<< points.size() * times_of_output_points << ")...\n";
//Run algorithm
CGAL::edge_aware_upsample_point_set<Concurrency_tag>(
points.begin(),
points.end(),
std::back_inserter(points),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>(),
sharpness_sigma,
edge_sensitivity,
neighbor_radius,
points.size() * times_of_output_points);
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "ok: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
}
// ----------------------------------------------------------------------------
// main()
// ----------------------------------------------------------------------------
int main(int argc, char * argv[])
{
std::cerr << "Edge aware up-sample" << std::endl;
//***************************************
// decode parameters
//***************************************
// usage
if(argc < 2)
{
std::cerr << "Upsample each input point set.\n";
std::cerr << "\n";
std::cerr << "Usage: " << argv[0] << " file1.xyz file2.xyz..." << std::endl;
std::cerr << "Input file format is .xyz.\n";
std::cerr << "No output" << std::endl;
return EXIT_FAILURE;
}
//Algorithm parameters
const double sharpness_sigma = 25; //control sharpness of the result.
const double edge_sensitivity = 0; // more points will up-sample on edge.
const double neighbor_radius = 0.2; // initial neighbors size.
const unsigned int times_of_output_points = 4;
// Accumulated errors
int accumulated_fatal_err = EXIT_SUCCESS;
// Process each input file
for(int i=1; i<argc; i++)
{
std::cerr << std::endl;
//***************************************
// Loads point set
//***************************************
// File name is:
std::string input_filename = argv[i];
// Reads the point set file in points[].
std::vector<PointVectorPair> points;
std::cerr << "Opening " << input_filename << " for reading..." << std::endl;
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
if(stream &&
CGAL::read_xyz_points_and_normals
(stream,
std::back_inserter(points),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>()))
{
std::cerr << "ok (" << points.size() << " points)" << std::endl;
}
else
{
std::cerr << "Error: cannot read file " << input_filename << std::endl;
accumulated_fatal_err = EXIT_FAILURE;
continue;
}
//***************************************
// Test
//***************************************
test_edge_aware_upsample(points,
sharpness_sigma,
edge_sensitivity,
neighbor_radius,
times_of_output_points);
} // for each input file
std::cerr << std::endl;
// Returns accumulated fatal error
std::cerr << "Tool returned " << accumulated_fatal_err << std::endl;
return accumulated_fatal_err;
}

View File

@ -1,87 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
#include <limits>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/hierarchy_simplify_point_set.h>
#include <vector>
// types
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
typedef Kernel::FT FT;
void test (std::vector<Point>& input,
std::ptrdiff_t result0 = 1, int result1 = 1, int result2 = 1, int result3 = 1, int result4 = 1)
{
std::vector<Point>::iterator it =
CGAL::hierarchy_simplify_point_set (input.begin (), input.end (), 1);
if (result0 > 0 && std::distance (input.begin (), it) != result0)
exit (EXIT_FAILURE);
it = CGAL::hierarchy_simplify_point_set (input.begin (), input.end ());
if (result1 > 0 && std::distance (input.begin (), it) != result1)
exit (EXIT_FAILURE);
it = CGAL::hierarchy_simplify_point_set (input.begin (), input.end (), 100);
if (result2 > 0 && std::distance (input.begin (), it) != result2)
exit (EXIT_FAILURE);
it = CGAL::hierarchy_simplify_point_set (input.begin (), input.end (), 1000, 0.1);
if (result3 > 0 && std::distance (input.begin (), it) != result3)
exit (EXIT_FAILURE);
it = CGAL::hierarchy_simplify_point_set (input.begin (), input.end (),
CGAL::Identity_property_map<Point>(),
(std::numeric_limits<unsigned int>::max)(),
0.0001);
if (result4 > 0 && std::distance (input.begin (), it) != result4)
exit (EXIT_FAILURE);
input.clear ();
}
int main(void)
{
std::vector<Point> input;
// Test 1 point
input.push_back (Point (0., 0., 0.));
test (input);
// Test twice the same point
input.push_back (Point (0., 0., 0.));
input.push_back (Point (0., 0., 0.));
test (input);
// Test 2 points
input.push_back (Point (0., 0., 0.));
input.push_back (Point (1., 0., 0.));
test (input, 2);
// Test line
for (std::size_t i = 0; i < 1000; ++ i)
input.push_back (Point (0., 0., (double)i));
test (input, input.size (), 128, 16, 1, 1);
// Test plane
for (std::size_t i = 0; i < 128; ++ i)
for (std::size_t j = 0; j < 128; ++ j)
input.push_back (Point (0., (double)j, (double)i));
test (input, input.size (), 2048, 256, 32, 1);
// Test random
for (std::size_t i = 0; i < 10000; ++ i)
input.push_back (Point (rand() / (FT)RAND_MAX,
rand() / (FT)RAND_MAX,
rand() / (FT)RAND_MAX));
test (input, input.size (), -1, -1, -1, -1);
return EXIT_SUCCESS;
}

View File

@ -1,48 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/jet_estimate_normals.h>
#include <vector>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point_3;
typedef Kernel::Vector_3 Vector_3;
int main()
{
std::vector<Point_3> points;
std::vector<size_t> indices(100);
for(int i=0; i < 100; i++){
indices[i] = i;
}
std::vector<Vector_3> normals(100);
for(int i=0; i <10; i++){
for(int j=0; j <10; j++){
points.push_back(Point_3(i,j,0));
}
}
CGAL::jet_estimate_normals<CGAL::Sequential_tag>(indices.begin(), indices.end(),
CGAL::make_property_map(points),
CGAL::make_property_map(normals),
12);
return 0;
}

View File

@ -1 +0,0 @@
data/sphere926.pwn data/sphere_1k.xyz

View File

@ -1,407 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
// normal_estimation_test.cpp
//----------------------------------------------------------
// Test the normal estimation methods:
// For each input point set, compute and orient its normals.
// If an input mesh has normals, print the normal deviation.
// Input file formats are .off, .xyz and .pwn.
// No output.
//----------------------------------------------------------
// normal_estimation_test points1.xyz points2.xyz...
// With iterator debugging this testsuite takes to long and the process gets killed
//#define _HAS_ITERATOR_DEBUGGING 0
// CGAL
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Timer.h>
#include <CGAL/Memory_sizer.h>
// This package
#include <CGAL/pca_estimate_normals.h>
#include <CGAL/jet_estimate_normals.h>
#include <CGAL/mst_orient_normals.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/property_map.h>
#include <CGAL/IO/read_off_points.h>
#include <CGAL/IO/read_xyz_points.h>
#include <vector>
#include <string>
#include <fstream>
#include <cassert>
#include <cmath>
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
// kernel
typedef CGAL::Simple_cartesian<double> Kernel;
// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal; // position + normal vector
typedef std::vector<Point_with_normal> PointList;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
// ----------------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------------
// Check the accuracy of normals direction estimation.
// If original normals are available, compare with them and count normals with large deviation.
// @return true on success.
bool verify_normal_direction(const PointList& points, // input points + computed normals
const std::vector<Vector>& original_normals) // may be empty
{
bool success = true;
bool points_have_original_normals = ! original_normals.empty();
if (points_have_original_normals)
{
assert(points.size() == original_normals.size());
std::cerr << "Compare with original normals:" << std::endl;
double min_normal_deviation = DBL_MAX; // deviation / original normal
double max_normal_deviation = DBL_MIN;
double avg_normal_deviation = 0;
int invalid_normals = 0; // #normals with large deviation
PointList::const_iterator p;
std::vector<Vector>::const_iterator n;
for (p = points.begin(), n = original_normals.begin(); p != points.end(); p++, n++)
{
// Computes normal deviation.
Vector v1 = *n; // original normal
double norm1 = std::sqrt( v1*v1 );
assert(norm1 != 0.0);
Vector v2 = p->normal(); // computed normal
double norm2 = std::sqrt( v2*v2 );
assert(norm2 != 0.0);
double cos_normal_deviation = (v1*v2)/(norm1*norm2);
if (cos_normal_deviation < 0)
{
cos_normal_deviation = -cos_normal_deviation;
}
double normal_deviation = std::acos(cos_normal_deviation);
// statistics about normals deviation
min_normal_deviation = (std::min)(min_normal_deviation, normal_deviation);
max_normal_deviation = (std::max)(max_normal_deviation, normal_deviation);
avg_normal_deviation += normal_deviation;
// count normal if large deviation
bool valid = (normal_deviation <= CGAL_PI/3.); // valid if deviation <= 60 degrees
if ( ! valid )
{
invalid_normals++;
}
}
avg_normal_deviation /= double(points.size());
std::cerr << " Min normal deviation=" << min_normal_deviation*180.0/CGAL_PI << " degrees\n";
std::cerr << " Max normal deviation=" << max_normal_deviation*180.0/CGAL_PI << " degrees\n";
std::cerr << " Avg normal deviation=" << avg_normal_deviation*180.0/CGAL_PI << " degrees\n";
if (invalid_normals > 0)
{
std::cerr << " Error: " << invalid_normals << " normals have a deviation > 60 degrees\n";
success = false;
}
}
return success;
}
// Computes normals direction by Principal Component Analysis
// @return true on success.
bool run_pca_estimate_normals(PointList& points, // input points + output normals
unsigned int nb_neighbors_pca_normals, // number of neighbors
const std::vector<Vector>& original_normals) // may be empty
{
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Estimates Normals Direction by PCA (k="
<< nb_neighbors_pca_normals << ")...\n";
CGAL::pca_estimate_normals<Concurrency_tag>(points.begin(), points.end(),
CGAL::make_normal_of_point_with_normal_map(PointList::value_type()),
nb_neighbors_pca_normals);
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "done: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
// Check the accuracy of normals direction estimation.
// If original normals are available, compare with them.
return verify_normal_direction(points, original_normals);
}
// Computes normals direction by Jet Fitting
// @return true on success.
bool run_jet_estimate_normals(PointList& points, // input points + output normals
unsigned int nb_neighbors_jet_fitting_normals, // number of neighbors
const std::vector<Vector>& original_normals) // may be empty
{
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Estimates Normals Direction by Jet Fitting (k="
<< nb_neighbors_jet_fitting_normals << ")...\n";
CGAL::jet_estimate_normals<Concurrency_tag>(points.begin(), points.end(),
CGAL::make_normal_of_point_with_normal_map(PointList::value_type()),
nb_neighbors_jet_fitting_normals);
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "done: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
// Check the accuracy of normals direction estimation.
// If original normals are available, compare with them.
return verify_normal_direction(points, original_normals);
}
// Check the accuracy of normal orientation.
// Count non-oriented normals.
// If original normals are available, compare with them and count flipped normals.
bool verify_normal_orientation(const PointList& points, // input points + computed normals
PointList::const_iterator unoriented_points_begin, // first pt w/ unoriented normal
const std::vector<Vector>& original_normals) // may be empty
{
bool success = true;
// Count non-oriented normals
int unoriented_normals = 0;
for (PointList::const_iterator p = unoriented_points_begin ; p != points.end(); p++)
{
unoriented_normals++;
}
if (unoriented_normals > 0)
{
std::cerr << "Error: " << unoriented_normals << " normals are unoriented\n";
success = false;
}
// Compare oriented normals with original ones and count flipped normals
bool points_have_original_normals = ! original_normals.empty();
if (points_have_original_normals)
{
assert(points.size() == original_normals.size());
std::cerr << "Compare with original normals:" << std::endl;
int flipped_normals = 0; // #normals with wrong orientation
PointList::const_iterator p;
std::vector<Vector>::const_iterator n;
for (p = points.begin(), n = original_normals.begin(); p != unoriented_points_begin; p++, n++)
{
Vector v1 = *n; // original normal
double norm1 = std::sqrt( v1*v1 );
assert(norm1 != 0.0);
Vector v2 = p->normal(); // computed normal
double norm2 = std::sqrt( v2*v2 );
assert(norm2 != 0.0);
double cos_normal_deviation = (v1*v2)/(norm1*norm2);
if (cos_normal_deviation < 0) // if flipped
{
flipped_normals++;
}
}
if (flipped_normals == 0)
std::cerr << " ok\n";
else
std::cerr << " Error: " << flipped_normals << " normal(s) are flipped\n";
}
return success;
}
// Hoppe92 normal orientation using a Minimum Spanning Tree.
// @return true on success.
bool run_mst_orient_normals(PointList& points, // input points + input/output normals
unsigned int nb_neighbors_mst, // number of neighbors
const std::vector<Vector>& original_normals) // may be empty
{
#if (BOOST_VERSION / 100) == 1054
std::cerr <<
"In run_mst_orient_normals():\n"
"NOTICE: This function is incompatible with Boost 1.54, "
"and will not be tested. See the following bug:\n"
" https://svn.boost.org/trac/boost/ticket/9012\n";
return true;
#endif // Boost version is 1.54
std::cerr << "Orients Normals with a Minimum Spanning Tree (k="<< nb_neighbors_mst << ")...\n";
CGAL::Timer task_timer; task_timer.start();
PointList::iterator unoriented_points_begin =
CGAL::mst_orient_normals(points.begin(), points.end(),
CGAL::make_normal_of_point_with_normal_map(PointList::value_type()),
nb_neighbors_mst);
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "done: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
// Note: we do *not* delete points with unoriented normals in this test.
// Instead, we check the accuracy of normal orientation and,
// if original normals are available, compare with them.
return verify_normal_orientation(points, unoriented_points_begin, original_normals);
}
// ----------------------------------------------------------------------------
// main()
// ----------------------------------------------------------------------------
int main(int argc, char * argv[])
{
std::cerr << "Normal estimation test" << std::endl;
//***************************************
// decode parameters
//***************************************
// usage
if(argc < 2)
{
std::cerr << "For each input point set, compute and orient its normals.\n";
std::cerr << "If an input mesh has normals, print the normals deviation.\n";
std::cerr << "\n";
std::cerr << "Usage: " << argv[0] << " file1.xyz file2.xyz..." << std::endl;
std::cerr << "Input file formats are .off, .xyz and .pwn.\n";
std::cerr << "No output" << std::endl;
return EXIT_FAILURE;
}
// Normals Computing options
unsigned int nb_neighbors_pca_normals = 18; // K-nearest neighbors = 3 rings (estimate normals by PCA)
unsigned int nb_neighbors_jet_fitting_normals = 18; // K-nearest neighbors (estimate normals by Jet Fitting)
unsigned int nb_neighbors_mst = 18; // K-nearest neighbors (orient normals by MST)
// Accumulated errors
int accumulated_fatal_err = EXIT_SUCCESS;
// Process each input file
for(int i=1; i<argc; i++)
{
std::cerr << std::endl;
//***************************************
// Loads point set
//***************************************
// File name is:
std::string input_filename = argv[i];
// Reads the point set file in points[].
PointList points;
std::cerr << "Open " << input_filename << " for reading..." << std::endl;
// If OFF file format
bool success = false;
std::string extension = input_filename.substr(input_filename.find_last_of('.'));
if (extension == ".off" || extension == ".OFF")
{
std::ifstream stream(input_filename.c_str());
success = stream &&
CGAL::read_off_points_and_normals(stream,
std::back_inserter(points),
CGAL::make_normal_of_point_with_normal_map(PointList::value_type())
);
}
// If XYZ file format
else if (extension == ".xyz" || extension == ".XYZ" ||
extension == ".pwn" || extension == ".PWN")
{
std::ifstream stream(input_filename.c_str());
success = stream &&
CGAL::read_xyz_points_and_normals(stream,
std::back_inserter(points),
CGAL::make_normal_of_point_with_normal_map(PointList::value_type())
);
}
if (success)
{
std::cerr << "ok (" << points.size() << " points)" << std::endl;
}
else
{
std::cerr << "Error: cannot read file " << input_filename << std::endl;
accumulated_fatal_err = EXIT_FAILURE;
continue;
}
//***************************************
// Check requirements
//***************************************
if (points.size() == 0)
{
std::cerr << "Error: empty file" << std::endl;
accumulated_fatal_err = EXIT_FAILURE;
continue;
}
//***************************************
// Copy original normals
//***************************************
std::vector<Vector> original_normals;
bool points_have_original_normals = (points.begin()->normal() != CGAL::NULL_VECTOR);
if ( points_have_original_normals )
{
for (PointList::iterator p = points.begin() ; p != points.end(); p++)
original_normals.push_back(p->normal());
}
//***************************************
// Computes normals (PCA + MST)
//***************************************
// Estimates normals direction.
success = run_pca_estimate_normals(points, nb_neighbors_pca_normals, original_normals);
if ( ! success )
accumulated_fatal_err = EXIT_FAILURE; // set error and continue
// Orients normals.
success = run_mst_orient_normals(points, nb_neighbors_mst, original_normals);
if ( ! success )
accumulated_fatal_err = EXIT_FAILURE; // set error and continue
//***************************************
// Computes normals (jet fitting + MST)
//***************************************
// Estimates normals direction
success = run_jet_estimate_normals(points, nb_neighbors_jet_fitting_normals, original_normals);
if ( ! success )
accumulated_fatal_err = EXIT_FAILURE; // set error and continue
// Orients normals
success = run_mst_orient_normals(points, nb_neighbors_mst, original_normals);
if ( ! success )
accumulated_fatal_err = EXIT_FAILURE; // set error and continue
} // for each input file
std::cerr << std::endl;
// Returns accumulated fatal error
std::cerr << "Tool returned " << accumulated_fatal_err << std::endl;
return accumulated_fatal_err;
}

View File

@ -1,121 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/property_map.h>
#include <CGAL/IO/read_off_points.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/config.h>
#ifdef CGAL_CXX11
#include <CGAL/IO/read_ply_points.h>
#endif
#include <vector>
#include <cassert>
#include <string>
#include <fstream>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef Kernel::Vector_3 Vector_3;
typedef std::pair<Point_3, Vector_3> PointVectorPair;
bool read(std::string s)
{
std::ifstream fs(s.c_str());
std::vector<PointVectorPair> pv_pairs;
return CGAL::read_xyz_points_and_normals(fs,
back_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>());
}
bool read(std::string s,
std::vector<PointVectorPair>& pv_pairs)
{
std::ifstream fs(s.c_str());
return CGAL::read_xyz_points_and_normals(fs,
back_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>());
}
bool read_off(std::string s,
std::vector<PointVectorPair>& pv_pairs)
{
std::ifstream fs(s.c_str());
return CGAL::read_off_points_and_normals(fs,
back_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>());
}
#ifdef CGAL_CXX11
bool read_ply (std::string s,
std::vector<PointVectorPair>& pv_pairs)
{
std::ifstream fs(s.c_str());
return CGAL::read_ply_points_and_normals (fs,
back_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>());
}
#endif
int main()
{
std::cerr << "### There should be three errors following this line...\n";
assert(! read("data/read_test/bug_1.xyz"));
assert(! read("data/read_test/bug_2.xyz"));
assert(! read("data/read_test/bug_3.xyz"));
std::cerr << "### ... Done. Now, there should not be any error.\n";
assert(read("data/read_test/ok_1.xyz"));
assert(read("data/read_test/ok_2.xyz"));
assert(read("data/read_test/ok_3.xyz"));
std::vector<PointVectorPair> pv_pairs;
read("data/read_test/ok_2.xyz", pv_pairs);
assert(pv_pairs.size() == 4);
assert(pv_pairs[0] == std::make_pair(Point_3(2,3,4), Vector_3(4,4,2)));
assert(pv_pairs[1] == std::make_pair(Point_3(3,4,6), Vector_3(0,0,0)));
assert(pv_pairs[2] == std::make_pair(Point_3(3,6,7), Vector_3(3,5,6)));
assert(pv_pairs[3] == std::make_pair(Point_3(1,3,4), Vector_3(4,6,8)));
pv_pairs.clear();
assert(read_off("data/read_test/ok_1.off", pv_pairs));
assert(pv_pairs.size() == 4);
assert(pv_pairs[0] == std::make_pair(Point_3(3,2,0), Vector_3(1,2,3)));
assert(pv_pairs[1] == std::make_pair(Point_3(1,2,3), Vector_3(0,0,0)));
assert(pv_pairs[2] == std::make_pair(Point_3(4,5,6), Vector_3(0,0,0)));
assert(pv_pairs[3] == std::make_pair(Point_3(7,8,9), Vector_3(0,0,0)));
#ifdef CGAL_CXX11
pv_pairs.clear ();
assert(read_ply("data/read_test/simple.ply", pv_pairs));
assert(pv_pairs[0] == std::make_pair(Point_3(1,1,1), Vector_3(2,2,2)));
assert(pv_pairs[1] == std::make_pair(Point_3(3,3,3), Vector_3(4,4,4)));
assert(pv_pairs[2] == std::make_pair(Point_3(5,5,5), Vector_3(6,6,6)));
pv_pairs.clear ();
assert(read_ply("data/read_test/simple_ascii.ply", pv_pairs));
assert(pv_pairs[0] == std::make_pair(Point_3(1,1,1), Vector_3(2,2,2)));
assert(pv_pairs[1] == std::make_pair(Point_3(3,3,3), Vector_3(4,4,4)));
assert(pv_pairs[2] == std::make_pair(Point_3(5,5,5), Vector_3(6,6,6)));
pv_pairs.clear ();
assert(read_ply("data/read_test/simple_with_flag.ply", pv_pairs));
assert(pv_pairs[0] == std::make_pair(Point_3(1,1,1), Vector_3(2,2,2)));
assert(pv_pairs[1] == std::make_pair(Point_3(3,3,3), Vector_3(4,4,4)));
assert(pv_pairs[2] == std::make_pair(Point_3(5,5,5), Vector_3(6,6,6)));
#endif
return 0;
}

View File

@ -1,340 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/property_map.h>
#include <CGAL/IO/read_off_points.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/property_map.h>
#include <vector>
#include <deque>
#include <iostream>
#include <fstream>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef Kernel::Vector_3 Vector_3;
typedef std::pair<Point_3, Vector_3> PointVectorPair;
// this is going to be custom OutputIterator value_type
struct dummy_counter {
static std::size_t counter;
dummy_counter() { ++counter; }
operator std::size_t() { return counter-1; }
};
std::size_t dummy_counter::counter = 0;
bool check_points_and_vectors(
const boost::vector_property_map<Point_3>& points,
const boost::vector_property_map<Vector_3>& normals,
const std::vector<PointVectorPair>& pv_pairs,
const std::vector<std::size_t>& indices)
{
if(pv_pairs.size() != indices.size()) {
std::cerr << "Error: inconsistency between point / normal size." << std::endl;
return false;
}
for(std::size_t i = 0; i < pv_pairs.size(); ++i ) {
if(pv_pairs[i].first != points[i]) {
std::cerr << "Error: points are not equal." << std::endl;
return false;
}
if(pv_pairs[i].second != normals[i]) {
std::cerr << "Error: normals are not equal." << std::endl;
return false;
}
}
return true;
}
bool check_points(
const boost::vector_property_map<Point_3>& points_1,
const std::vector<Point_3>& points_2,
const std::vector<std::size_t>& indices)
{
if(points_2.size() != indices.size()) {
std::cerr << "Error: inconsistency between point / normal size." << std::endl;
return false;
}
for(std::size_t i = 0; i < points_2.size(); ++i ) {
if(points_2[i] != points_1[i]) {
std::cerr << "Error: points are not equal." << std::endl;
return false;
}
}
return true;
}
bool test_no_deduction_points_and_normals_xyz(const char* file_name)
{
boost::vector_property_map<Point_3> points;
boost::vector_property_map<Vector_3> normals;
std::vector<std::size_t> indices;
std::vector<PointVectorPair> pv_pairs;
// read with custom output iterator type
dummy_counter::counter = 0;
std::ifstream input(file_name);
CGAL::read_xyz_points_and_normals<dummy_counter>(
input, back_inserter(indices), points, normals, Kernel());
// read with ordinary pmaps
input.clear();
input.close();
input.open(file_name);
CGAL::read_xyz_points_and_normals(
input, back_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>(),
Kernel());
return check_points_and_vectors(points, normals, pv_pairs, indices);
}
bool test_no_deduction_points_and_normals_off(const char* file_name)
{
boost::vector_property_map<Point_3> points;
boost::vector_property_map<Vector_3> normals;
std::vector<std::size_t> indices;
std::vector<PointVectorPair> pv_pairs;
// read with custom output iterator type
dummy_counter::counter = 0;
std::ifstream input(file_name);
CGAL::read_off_points_and_normals<dummy_counter>(
input, back_inserter(indices), points, normals, Kernel());
// read with ordinary pmaps
input.clear();
input.close();
input.open(file_name);
CGAL::read_off_points_and_normals(
input, back_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>(),
Kernel());
return check_points_and_vectors(points, normals, pv_pairs, indices);
}
bool test_no_deduction_points_xyz(const char* file_name)
{
boost::vector_property_map<Point_3> points_1; \
std::vector<std::size_t> indices;
std::vector<Point_3> points_2;
// read with custom output iterator type
dummy_counter::counter = 0;
std::ifstream input(file_name);
CGAL::read_xyz_points<dummy_counter>(
input, back_inserter(indices), points_1, Kernel());
// read with ordinary pmaps
input.clear();
input.close();
input.open(file_name);
CGAL::read_xyz_points(
input, back_inserter(points_2),
CGAL::Identity_property_map<Point_3>(),
Kernel());
return check_points(points_1, points_2, indices);
}
bool test_no_deduction_points_off(const char* file_name)
{
boost::vector_property_map<Point_3> points_1;
std::vector<std::size_t> indices;
std::vector<Point_3> points_2;
// read with custom output iterator type
dummy_counter::counter = 0;
std::ifstream input(file_name);
CGAL::read_off_points<dummy_counter>(
input, back_inserter(indices), points_1, Kernel());
// read with ordinary pmaps
input.clear();
input.close();
input.open(file_name);
CGAL::read_off_points(
input, back_inserter(points_2),
CGAL::Identity_property_map<Point_3>(),
Kernel());
return check_points(points_1, points_2, indices);
}
void compile_test() {
std::deque<Point_3> points;
std::deque<Vector_3> normals;
std::deque<PointVectorPair> pv_pairs;
std::ifstream input;
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
input,
std::front_inserter(points));
input.clear();
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
input,
std::front_inserter(points),
CGAL::Identity_property_map<Point_3>());
input.clear();
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
input,
std::front_inserter(points),
CGAL::Identity_property_map<Point_3>(),
Kernel());
input.clear();
input.close();
// this will span all OutputIteratorValueType versions
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points<Point_3>(
input,
std::front_inserter(points));
input.clear();
input.close();
//-----------------------------------------------------------------------
input.open("data/read_test/simple.off");
CGAL::read_off_points(
input,
std::front_inserter(points));
input.clear();
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points(
input,
std::front_inserter(points),
CGAL::Identity_property_map<Point_3>());
input.clear();
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points(
input,
std::front_inserter(points),
CGAL::Identity_property_map<Point_3>(),
Kernel());
input.clear();
input.close();
// this will span all OutputIteratorValueType versions
input.open("data/read_test/simple.off");
CGAL::read_off_points<Point_3>(
input,
std::front_inserter(points));
input.clear();
input.close();
//-----------------------------------------------------------------------
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points_and_normals(
input,
std::front_inserter(points),
boost::dummy_property_map());
input.clear();
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points_and_normals(
input,
std::front_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>());
input.clear();
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points_and_normals(
input,
std::front_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>(),
Kernel());
input.clear();
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points_and_normals<Point_3>(
input,
std::front_inserter(points),
boost::dummy_property_map());
input.clear();
input.close();
//-----------------------------------------------------------------------
input.open("data/read_test/simple.off");
CGAL::read_off_points_and_normals(
input,
std::front_inserter(points),
boost::dummy_property_map());
input.clear();
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points_and_normals(
input,
std::front_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>());
input.clear();
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points_and_normals(
input,
std::front_inserter(pv_pairs),
CGAL::First_of_pair_property_map<PointVectorPair>(),
CGAL::Second_of_pair_property_map<PointVectorPair>(),
Kernel());
input.clear();
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points_and_normals<Point_3>(
input,
std::front_inserter(points),
boost::dummy_property_map());
input.clear();
input.close();
}
int main() {
if(!test_no_deduction_points_and_normals_xyz("data/read_test/simple.xyz")) {
return EXIT_FAILURE;
}
std::cerr << "test_no_deduction_points_and_normals_xyz OK." << std::endl;
if(!test_no_deduction_points_and_normals_off("data/read_test/simple.off")) {
return EXIT_FAILURE;
}
std::cerr << "test_no_deduction_points_and_normals_off OK." << std::endl;
if(!test_no_deduction_points_xyz("data/read_test/simple.xyz")) {
return EXIT_FAILURE;
}
std::cerr << "test_no_deduction_points_xyz OK." << std::endl;
if(!test_no_deduction_points_off("data/read_test/simple.off")) {
return EXIT_FAILURE;
}
std::cerr << "test_no_deduction_points_off OK." << std::endl;
compile_test();
return EXIT_SUCCESS;
}

View File

@ -1,144 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
// remove_outliers_test.cpp
//----------------------------------------------------------
// Test the outlier removal methods:
// For each input point set, remove outliers.
// Input format is .xyz.
// No output.
//----------------------------------------------------------
// remove_outliers_test points1.xyz points2.xyz...
// CGAL
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Timer.h>
#include <CGAL/Memory_sizer.h>
// This package
#include <CGAL/remove_outliers.h>
#include <CGAL/IO/read_xyz_points.h>
#include <deque>
#include <string>
#include <fstream>
#include <cassert>
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
// kernel
typedef CGAL::Simple_cartesian<float> Kernel;
// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
// ----------------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------------
// Removes outliers
void test_avg_knn_sq_distance(std::deque<Point>& points, // input point set
unsigned int nb_neighbors_remove_outliers, // K-nearest neighbors
double removed_percentage) // percentage of points to remove
{
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Removes outliers wrt average squared distance to k nearest neighbors (remove "
<< removed_percentage << "%, k="
<< nb_neighbors_remove_outliers << ")...\n";
// Removes outliers using erase-remove idiom
points.erase(CGAL::remove_outliers(points.begin(), points.end(),
nb_neighbors_remove_outliers, removed_percentage),
points.end());
// Optional: after erase(), use Scott Meyer's "swap trick" to trim excess capacity
std::deque<Point>(points).swap(points);
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "ok: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
}
// ----------------------------------------------------------------------------
// main()
// ----------------------------------------------------------------------------
int main(int argc, char * argv[])
{
std::cerr << "Outlier removal test" << std::endl;
//***************************************
// decode parameters
//***************************************
// usage
if(argc < 2)
{
std::cerr << "For each input point set, remove outliers.\n";
std::cerr << "\n";
std::cerr << "Usage: " << argv[0] << " file1.xyz file2.xyz..." << std::endl;
std::cerr << "Input file format is .xyz.\n";
std::cerr << "No output" << std::endl;
return EXIT_FAILURE;
}
// Outlier Removal options
const double removed_percentage = 5.0 /* % */; // percentage of outliers to remove
const unsigned int nb_neighbors_remove_outliers = 24; // K-nearest neighbors
// Accumulated errors
int accumulated_fatal_err = EXIT_SUCCESS;
// Process each input file
for(int i=1; i<argc; i++)
{
std::cerr << std::endl;
//***************************************
// Loads point set
//***************************************
// File name is:
std::string input_filename = argv[i];
// Reads the point set file in points[].
std::deque<Point> points;
std::cerr << "Open " << input_filename << " for reading..." << std::endl;
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
if(stream &&
CGAL::read_xyz_points(stream, std::back_inserter(points)))
{
std::cerr << "ok (" << points.size() << " points)" << std::endl;
}
else
{
std::cerr << "Error: cannot read file " << input_filename << std::endl;
accumulated_fatal_err = EXIT_FAILURE;
continue;
}
//***************************************
// Test
//***************************************
test_avg_knn_sq_distance(points, nb_neighbors_remove_outliers, removed_percentage);
} // for each input file
std::cerr << std::endl;
// Returns accumulated fatal error
std::cerr << "Tool returned " << accumulated_fatal_err << std::endl;
return accumulated_fatal_err;
}

View File

@ -1,140 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
// smoothing_test.cpp
//----------------------------------------------------------
// Test the smoothing methods:
// For each input point set, smooth it.
// Input format is .xyz.
// No output.
//----------------------------------------------------------
// smoothing_test points1.xyz points2.xyz...
// CGAL
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Timer.h>
#include <CGAL/Memory_sizer.h>
// This package
#include <CGAL/jet_smooth_point_set.h>
#include <CGAL/IO/read_xyz_points.h>
#include <deque>
#include <string>
#include <fstream>
#include <cassert>
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
// kernel
typedef CGAL::Simple_cartesian<double> Kernel;
// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
// ----------------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------------
void test_smooth_jet_fitting(std::deque<Point>& points,// input point set
unsigned int nb_neighbors_smooth_jet_fitting) // number of neighbors
{
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Smoothes Point Set (k=" << nb_neighbors_smooth_jet_fitting << ")...\n";
CGAL::jet_smooth_point_set<Concurrency_tag>(points.begin(), points.end(),
nb_neighbors_smooth_jet_fitting);
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "ok: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
}
// ----------------------------------------------------------------------------
// main()
// ----------------------------------------------------------------------------
int main(int argc, char * argv[])
{
std::cerr << "Smoothing test" << std::endl;
//***************************************
// decode parameters
//***************************************
// usage
if(argc < 2)
{
std::cerr << "For each input point set, smooth it.\n";
std::cerr << "\n";
std::cerr << "Usage: " << argv[0] << " file1.xyz file2.xyz..." << std::endl;
std::cerr << "Input file format is .xyz.\n";
std::cerr << "No output" << std::endl;
return EXIT_FAILURE;
}
// Smoothing options
const unsigned int nb_neighbors_smooth_jet_fitting = 24; // K-nearest neighbors (smooth points by Jet Fitting)
// Accumulated errors
int accumulated_fatal_err = EXIT_SUCCESS;
// Process each input file
for(int i=1; i<argc; i++)
{
std::cerr << std::endl;
//***************************************
// Loads point set
//***************************************
// File name is:
std::string input_filename = argv[i];
// Reads the point set file in points[].
std::deque<Point> points;
std::cerr << "Open " << input_filename << " for reading..." << std::endl;
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
if(stream &&
CGAL::read_xyz_points(stream, std::back_inserter(points)))
{
std::cerr << "ok (" << points.size() << " points)" << std::endl;
}
else
{
std::cerr << "Error: cannot read file " << input_filename << std::endl;
accumulated_fatal_err = EXIT_FAILURE;
continue;
}
//***************************************
// Test
//***************************************
test_smooth_jet_fitting(points, nb_neighbors_smooth_jet_fitting);
} // for each input file
std::cerr << std::endl;
// Returns accumulated fatal error
std::cerr << "Tool returned " << accumulated_fatal_err << std::endl;
return accumulated_fatal_err;
}

View File

@ -1,146 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/property_map.h>
#include <CGAL/Shape_detection_3.h>
#include <CGAL/structure_point_set.h>
#include <CGAL/Random.h>
#include <iostream>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef Kernel::Plane_3 Plane;
typedef std::pair<Point, Vector> Point_with_normal;
typedef std::vector<Point_with_normal> Pwn_vector;
typedef CGAL::First_of_pair_property_map<Point_with_normal> Point_map;
typedef CGAL::Second_of_pair_property_map<Point_with_normal> Normal_map;
typedef CGAL::Shape_detection_3::Shape_detection_traits
<Kernel, Pwn_vector, Point_map, Normal_map> Traits;
typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Efficient_ransac;
typedef CGAL::Point_set_with_structure<Kernel> Points_with_structure;
template <typename OutputIterator>
void generate_random_points (const Point& origin, const Vector& base1, const Vector& base2,
std::size_t nb_pts, OutputIterator output)
{
Vector normal = CGAL::cross_product (base1, base2);
normal = normal / std::sqrt (normal * normal);
for (std::size_t i = 0; i < nb_pts; ++ i)
{
Point point = origin
+ CGAL::get_default_random().get_double() * base1
+ CGAL::get_default_random().get_double() * base2;
*(output ++) = std::make_pair (point, normal);
}
}
int main()
{
Vector vx (1., 0., 0.),
vy (0., 1., 0.),
vz (0., 0., 1.);
Efficient_ransac ransac;
ransac.add_shape_factory<CGAL::Shape_detection_3::Plane<Traits> >();
const std::size_t nb_pts = 1000;
Efficient_ransac::Parameters op;
op.probability = 0.05;
op.min_points = nb_pts / 2;
op.epsilon = 0.02;
op.cluster_epsilon = 0.05;
op.normal_threshold = 0.8;
Pwn_vector points;
generate_random_points (Point (0., 0., 0.), vx, vy,
5000, std::back_inserter (points));
generate_random_points (Point (0., 0., 0.), vx, vz,
5000, std::back_inserter (points));
generate_random_points (Point (0., 0., 0.), vy, vz,
5000, std::back_inserter (points));
generate_random_points (Point (0., 0., 1.), vx, vy,
5000, std::back_inserter (points));
generate_random_points (Point (0., 1., 0.), vx, vz,
5000, std::back_inserter (points));
generate_random_points (Point (1., 0., 0.), vy, vz,
5000, std::back_inserter (points));
ransac.set_input(points);
ransac.detect(op);
Efficient_ransac::Plane_range planes = ransac.planes();
Points_with_structure pss (points, Point_map(), Normal_map(),
planes,
CGAL::Shape_detection_3::Plane_map<Traits>(),
CGAL::Shape_detection_3::Point_to_shape_index_map<Traits>(points, planes),
op.cluster_epsilon);
std::vector<Point> vertices;
for (std::size_t i = 0; i < pss.size(); ++ i)
{
std::vector<Plane> planes;
pss.adjacency (i, std::back_inserter (planes));
if (planes.size () == 3)
vertices.push_back (pss.point (i));
}
if (vertices.size () != 8)
{
std::cerr << "Error: 8 point should have been structural vertices." << std::endl;
return EXIT_FAILURE;
}
std::vector<Point> ground_truth;
ground_truth.push_back (Point (0., 0., 0.));
ground_truth.push_back (Point (0., 0., 1.));
ground_truth.push_back (Point (0., 1., 0.));
ground_truth.push_back (Point (0., 1., 1.));
ground_truth.push_back (Point (1., 0., 0.));
ground_truth.push_back (Point (1., 0., 1.));
ground_truth.push_back (Point (1., 1., 0.));
ground_truth.push_back (Point (1., 1., 1.));
std::vector<bool> found (ground_truth.size(), false);
std::size_t nb_found = 0;
for (std::size_t i = 0; i < vertices.size(); ++ i)
for (std::size_t j = 0; j < ground_truth.size(); ++ j)
{
if (found[j])
continue;
if (CGAL::squared_distance (ground_truth[j], vertices[i]) < 1e-6)
{
found[j] = true;
++ nb_found;
break;
}
}
if (nb_found != ground_truth.size())
{
std::cerr << "Error: the following vert(ex/ices) was/were not found:" << std::endl;
for (std::size_t i = 0; i < ground_truth.size(); ++ i)
if (!(found[i]))
std::cerr << " * " << ground_truth[i] << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

File diff suppressed because one or more lines are too long

View File

@ -1,44 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/vcm_estimate_normals.h>
#include <cassert>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Point_3<Kernel> Point_3;
typedef CGAL::Vector_3<Kernel> Vector_3;
typedef std::pair<Point_3, Vector_3> PointWithNormal;
int main (void) {
// Generate points on a plane
int k = 100;
double r = 10;
std::vector<PointWithNormal> points;
points.push_back(std::make_pair(Point_3(0, 0, 0), Vector_3(0, 0, 0)));
for (int i = 0; i < k; ++i) {
double theta = 2 * i * CGAL_PI / k;
points.push_back(std::make_pair(Point_3(r * cos(theta), r * sin(theta), 0),
Vector_3(0, 0, 0)));
}
// Estimate the normals using VCM
double R = 20;
vcm_estimate_normals(points.begin(), points.end(),
CGAL::First_of_pair_property_map<PointWithNormal>(),
CGAL::Second_of_pair_property_map<PointWithNormal>(),
R, 0.0);
std::cout << "Normal is " << points[0].second << std::endl;
// 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() < 0 || (points[0].second.z() < 1+epsilon && points[0].second.z() > 1-epsilon));
assert(points[0].second.z() > 0 || (points[0].second.z() < -1+epsilon && points[0].second.z() > -1-epsilon));
return 0;
}

View File

@ -1,170 +0,0 @@
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
// wlop_simplify_and_regularize_test.cpp
//----------------------------------------------------------
// Test the wlop simplify and regularize method:
// Input format is .xyz.
// No output.
//----------------------------------------------------------
// wlop_simplify_and_regularize_test points1.xyz points2.xyz...
// CGAL
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Real_timer.h>
#include <CGAL/Memory_sizer.h>
#include <CGAL/tags.h>
// This package
#include <CGAL/wlop_simplify_and_regularize_point_set.h>
#include <CGAL/IO/read_xyz_points.h>
#include <vector>
#include <string>
#include <fstream>
#include <cassert>
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
// kernel
typedef CGAL::Simple_cartesian<double> Kernel;
// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
// ----------------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------------
// Removes outliers
template<typename Concurrency_tag>
void test_wlop_simplify_and_regularize(
std::vector<Point>& points, // input point set
std::vector<Point>& output,
double retain_percentage, // percentage of points to remove
double neighbor_radius, // neighborhood size
unsigned int iter_number, // iteration number
bool need_compute_density)
{
CGAL::Real_timer task_timer; task_timer.start();
std::cerr << "Running WLOP simplify and regularize, (retain_percentage: "
<< retain_percentage << "%, neighbor_radius="
<< neighbor_radius << ")...\n";
// Make room for sample points
std::vector<Point> points_sampled;
points_sampled.resize(static_cast<std::size_t>(points.size() * (retain_percentage / 100.)));
output.clear();
// Run algorithm
CGAL::wlop_simplify_and_regularize_point_set<Concurrency_tag>(
points.begin(),
points.end(),
std::back_inserter(output),
retain_percentage,
neighbor_radius,
iter_number,
need_compute_density);
output.clear();
std::size_t memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "ok: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
}
// ----------------------------------------------------------------------------
// main()
// ----------------------------------------------------------------------------
int main(int argc, char * argv[])
{
std::cerr << "WLOP simplify and regularize" << std::endl;
//***************************************
// decode parameters
//***************************************
// usage
if(argc < 2)
{
std::cerr << "For each input point set, apply WLOP algorithm.\n";
std::cerr << "\n";
std::cerr << "Usage: " << argv[0] << " file1.xyz file2.xyz..." << std::endl;
std::cerr << "Input file format is .xyz.\n";
std::cerr << "No output" << std::endl;
return EXIT_FAILURE;
}
//Algorithm parameters
const double retain_percentage = 2; // percentage of points to retain.
const double neighbor_radius = 0.5; // neighbors size.
const unsigned int iter_number = 25; // number of iterations.
const bool need_compute_density = false; // if needed to compute density.
// Accumulated errors
int accumulated_fatal_err = EXIT_SUCCESS;
// Process each input file
for(int i=1; i<argc; i++)
{
std::cerr << std::endl;
//***************************************
// Loads point set
//***************************************
// File name is:
std::string input_filename = argv[i];
// Reads the point set file in points[].
std::vector<Point> points;
std::cerr << "Opening " << input_filename << " for reading..." << std::endl;
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
if(stream &&
CGAL::read_xyz_points(stream, std::back_inserter(points)))
{
std::cerr << "ok (" << points.size() << " points)" << std::endl;
}
else
{
std::cerr << "Error: cannot read file " << input_filename << std::endl;
accumulated_fatal_err = EXIT_FAILURE;
continue;
}
//***************************************
// Test
//***************************************
#ifdef CGAL_LINKED_WITH_TBB
std::vector<Point> points2(points);
#endif
std::vector<Point> output;
test_wlop_simplify_and_regularize<CGAL::Sequential_tag>(
points, output, retain_percentage, neighbor_radius,
iter_number, need_compute_density);
#ifdef CGAL_LINKED_WITH_TBB
output.clear();
test_wlop_simplify_and_regularize<CGAL::Parallel_tag>(
points2, output, retain_percentage, neighbor_radius,
iter_number, need_compute_density);
#endif // CGAL_LINKED_WITH_TBB
} // for each input file
std::cerr << std::endl;
// Returns accumulated fatal error
std::cerr << "Tool returned " << accumulated_fatal_err << std::endl;
return accumulated_fatal_err;
}

View File

@ -8,19 +8,11 @@ find_package(CGAL QUIET )
if ( CGAL_FOUND )
# use either Eigen or BLAS/LAPACK
# use either Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (NOT EIGEN3_FOUND)
find_package(LAPACK)
if(LAPACK_FOUND)
include( ${LAPACK_USE_FILE} )
endif(LAPACK_FOUND)
else()
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
if(EIGEN3_FOUND OR LAPACK_FOUND)
# Link with Boost.ProgramOptions (optional)
find_package(Boost QUIET COMPONENTS program_options)
if(Boost_PROGRAM_OPTIONS_FOUND)
@ -37,11 +29,11 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( Ridges_Umbilics_SM.cpp)
create_single_source_cgal_program( Ridges_Umbilics_LCC.cpp)
else(EIGEN3_FOUND OR LAPACK_FOUND)
else()
message(STATUS "NOTICE: This program requires either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.")
endif(EIGEN3_FOUND OR LAPACK_FOUND)
endif()
else()

View File

@ -11,27 +11,17 @@ find_package(CGAL QUIET)
if ( CGAL_FOUND )
# use either Eigen or BLAS/LAPACK
# use either Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (NOT EIGEN3_FOUND)
find_package(LAPACK)
if(LAPACK_FOUND)
include( ${LAPACK_USE_FILE} )
endif(LAPACK_FOUND)
else()
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
if(EIGEN3_FOUND OR LAPACK_FOUND)
create_single_source_cgal_program( "ridge_test.cpp" )
else(EIGEN3_FOUND OR LAPACK_FOUND)
else()
message(STATUS "NOTICE: This program requires either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.")
endif(EIGEN3_FOUND OR LAPACK_FOUND)
endif()
else()

View File

@ -6,7 +6,6 @@
to solve in the least square sense a linear system with a singular value decomposition
\cgalHasModel `CGAL::Eigen_svd`
\cgalHasModel `CGAL::Lapack_svd`
*/
class SvdTraits
{

View File

@ -39,7 +39,4 @@
- `CGAL::Eigen_sparse_matrix`
- `CGAL::Eigen_sparse_symmetric_matrix`
- `CGAL::Eigen_svd`
- `CGAL::Lapack_vector`
- `CGAL::Lapack_matrix`
- `CGAL::Lapack_svd`
*/

View File

@ -1,206 +0,0 @@
// Copyright (c) 2007 INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
// 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$
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Marc Pouget and Frédéric Cazals
#ifndef CGAL_LAPACK_H
#define CGAL_LAPACK_H
#include <cstdlib>
#include <CGAL/auto_link/LAPACK.h>
#include <CGAL/assertions.h>
extern "C"
{
// taken from acml.h
void dgelss(int m, int n, int nrhs,
double *a, int lda, double *b, int ldb, double *sing,
double rcond, int *irank, int *info);
void dgelss_(int *m, int *n, int *nrhs,
double *a, int *lda, double *b, int *ldb, double *
s, double *rcond, int *rank, double *work, int *lwork,
int *info);
}
namespace CGAL {
namespace LAPACK {
inline
void dgelss(int *m, int *n, int *nrhs,
double *a, int *lda, double *b, int *ldb, double *s,
double *rcond, int *rank, double *work, int *lwork, int *info)
{
#ifdef CGAL_USE_F2C
::dgelss_(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, info);
#else
::dgelss(*m, *n, *nrhs, a, *lda, b, *ldb, s, *rcond, rank, info);
#endif
}
} // namespace LAPACK
} // namespace CGAL
namespace CGAL {
/// \ingroup PkgSolverInterfaceRef
///
/// A matrix class to be used in the class `Lapack_svd`.
///
/// \cgalModels `SvdTraits::Matrix`
class Lapack_vector
{
typedef double FT;
protected:
FT* m_vector;
size_t nb_elts;
public:
/// Initializes all the elements of the vector to zero.
Lapack_vector(size_t n)
{
m_vector = (FT*) std::calloc(n, sizeof(FT));
nb_elts = n;
}
~Lapack_vector() { free(m_vector); }
/// Return the size of the vector.
size_t size() { return nb_elts; }
/// Return the vector as an array.
const FT* vector() const { return m_vector;}
/// Return the vector as an array.
FT* vector() { return m_vector; }
/// Return the `i`th entry, `i` from `0` to `size()-1`.
FT operator()(size_t i) {return m_vector[i];}
/// Set the `i`'th entry to `value`.
void set(size_t i, const FT value) { m_vector[i] = value; }
private:
/// Copy constructor and operator =() are not implemented.
Lapack_vector(const Lapack_vector& toCopy);
Lapack_vector& operator =(const Lapack_vector& toCopy);
};
/// \ingroup PkgSolverInterfaceRef
///
/// In CLAPACK, matrices are one-dimensional arrays and elements are
/// column-major ordered. This class is a wrapper defining set and get
/// in the usual way with line and column indices.
///
/// \cgalModels `SvdTraits::Matrix`
class Lapack_matrix
{
typedef double FT;
protected:
FT* m_matrix;
size_t nb_rows;
size_t nb_columns;
public:
/// Initializes all the elements of the matrix to zero.
Lapack_matrix(size_t n1, size_t n2)
{
m_matrix = (FT*) std::calloc (n1*n2, sizeof(FT));
nb_rows = n1;
nb_columns = n2;
}
~Lapack_matrix() { free(m_matrix); }
/// Return the number of rows of the matrix.
size_t number_of_rows() { return nb_rows; }
/// Return the number of columns of the matrix.
size_t number_of_columns() { return nb_columns; }
/// Return the matrix as an array.
const FT* matrix() const { return m_matrix; }
/// Return the matrix as an array.
FT* matrix() { return m_matrix; }
/// 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) { return m_matrix[j*nb_rows+i]; }
/// Set the entry at row `i` and column `j` to `value`.
void set(size_t i, size_t j, const FT value) { m_matrix[j*nb_rows+i] = value; }
private:
/// Copy constructor and operator =() are not implemented.
Lapack_matrix(const Lapack_matrix& toCopy);
Lapack_matrix& operator =(const Lapack_matrix& toCopy);
};
/// \ingroup PkgSolverInterfaceRef
///
/// This class is a wrapper to the singular value decomposition algorithm of LAPACK.
///
/// \cgalModels `SvdTraits`
class Lapack_svd
{
public:
typedef double FT;
typedef Lapack_vector Vector;
typedef Lapack_matrix Matrix;
/// Solves the system \f$ MX=B\f$ (in the least square sense if \f$ M\f$ is not
/// square) using a singular value decomposition. The solution is stored in \f$ B\f$.
/// \return the condition number of \f$ M\f$
static FT solve(Matrix& M, Vector& B);
};
inline
Lapack_svd::FT Lapack_svd::solve(Matrix& M, Vector& B)
{
int m = static_cast<int>(M.number_of_rows()),
n = static_cast<int>(M.number_of_columns()),
nrhs = 1,
lda = m,
ldb = m,
rank,
lwork = 5*m,
info;
// c style
FT* sing_values = (FT*) std::malloc(n*sizeof(FT));
FT* work = (FT*) std::malloc(lwork*sizeof(FT));
FT rcond = -1;
LAPACK::dgelss(&m, &n, &nrhs, M.matrix(), &lda, B.vector(), &ldb, sing_values,
&rcond, &rank, work, &lwork, &info);
CGAL_assertion(info==0);
FT cond_nb = sing_values[0]/sing_values[n-1];
// clean up
free(sing_values);
free(work);
return cond_nb;
}
} // namespace CGAL
#endif // CGAL_LAPACK_H