mirror of https://github.com/CGAL/cgal
merge
This commit is contained in:
commit
f246c4abf8
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
sudo add-apt-repository ppa:mikhailnov/pulseeffects -y
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libmpfr-dev \
|
||||
libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \
|
||||
libqt5svg5-dev qttools5-dev qttools5-dev-tools libboost1.72-dev
|
||||
#update cmake to 3.18.4
|
||||
sudo apt purge --auto-remove cmake
|
||||
cd /tmp
|
||||
wget https://cmake.org/files/v3.18/cmake-3.18.4-Linux-x86_64.sh
|
||||
sudo sh cmake-3.18.4-Linux-x86_64.sh --skip-license --prefix=/usr/local
|
||||
rm cmake-3.18.4-Linux-x86_64.sh
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
/usr/local/bin/cmake --version
|
||||
FACTOR=$1
|
||||
set -ex
|
||||
cd Polyhedron/demo
|
||||
LIST_OF_PLUGINS=$(/usr/local/bin/cmake --build . -t help | egrep 'plugin$' |& cut -d\ -f2)
|
||||
PLUGINS_ARRAY=(${LIST_OF_PLUGINS});
|
||||
NB_OF_PLUGINS=${#PLUGINS_ARRAY[@]}
|
||||
DEL=$(($NB_OF_PLUGINS / 4))
|
||||
mkdir build
|
||||
cd build
|
||||
/usr/local/bin/cmake -DCGAL_DIR=$2 ../Polyhedron
|
||||
make -j2 ${PLUGINS_ARRAY[@]:$(($FACTOR * $DEL)):$((($FACTOR + 1) * $DEL))}
|
||||
|
|
@ -42,6 +42,7 @@ jobs:
|
|||
repository: ${{ github.repository }}
|
||||
ref: refs/pull/${{ steps.get_pr_number.outputs.result }}/merge
|
||||
token: ${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}
|
||||
fetch-depth: 2
|
||||
|
||||
|
||||
- name: install dependencies
|
||||
|
|
@ -60,10 +61,9 @@ jobs:
|
|||
if: steps.get_round.outputs.result != 'stop'
|
||||
run: |
|
||||
set -ex
|
||||
git clone https://CGAL:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git --depth=5
|
||||
mkdir -p build_doc && cd build_doc && cmake ../Documentation/doc
|
||||
|
||||
- name: Upload Doc
|
||||
- name: Build and Upload Doc
|
||||
if: steps.get_round.outputs.result != 'stop'
|
||||
run: |
|
||||
set -ex
|
||||
|
|
@ -71,14 +71,27 @@ jobs:
|
|||
ROUND=${{ steps.get_round.outputs.result }}
|
||||
wget --no-verbose cgal.github.io -O tmp.html
|
||||
if ! egrep -q "\/$PR_NUMBER\/$ROUND" tmp.html; then
|
||||
mkdir -p cgal.github.io/${PR_NUMBER}/$ROUND
|
||||
#list impacted packages
|
||||
LIST_OF_PKGS=$(git diff --name-only HEAD^1 HEAD |cut -s -d/ -f1 |sort -u | xargs -I {} ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true)
|
||||
if [ "$LIST_OF_PKGS" = "" ]; then
|
||||
exit 1
|
||||
fi
|
||||
cd build_doc && make -j2 doc && make -j2 doc_with_postprocessing
|
||||
cp -r ./doc_output/* ../cgal.github.io/${PR_NUMBER}/$ROUND
|
||||
cd ../cgal.github.io
|
||||
egrep -v " ${PR_NUMBER}\." index.html > tmp.html
|
||||
cd ..
|
||||
git clone https://CGAL:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git
|
||||
mkdir -p cgal.github.io/${PR_NUMBER}/$ROUND
|
||||
for f in $LIST_OF_PKGS
|
||||
do
|
||||
if [ -d ./build_doc/doc_output/$f ]; then
|
||||
cp -r ./build_doc/doc_output/$f ./cgal.github.io/${PR_NUMBER}/$ROUND
|
||||
fi
|
||||
done
|
||||
cp -r ./build_doc/doc_output/Manual ./cgal.github.io/${PR_NUMBER}/$ROUND
|
||||
cd ./cgal.github.io
|
||||
egrep -v " ${PR_NUMBER}\." index.html > tmp.html || true
|
||||
echo "<li><a href=https://cgal.github.io/${PR_NUMBER}/$ROUND/Manual/index.html>Manual for PR ${PR_NUMBER} ($ROUND).</a></li>" >> ./tmp.html
|
||||
mv tmp.html index.html
|
||||
git add ${PR_NUMBER}/$ROUND && git commit -q -a -m "Add ${PR_NUMBER} $ROUND" && git push -q -u origin master
|
||||
git add ${PR_NUMBER}/$ROUND && git commit -q --amend -m "base commit" && git push -q -f -u origin master
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -88,7 +101,7 @@ jobs:
|
|||
if: steps.get_round.outputs.result != 'stop'
|
||||
with:
|
||||
script: |
|
||||
const address = "The documentation is built. You can find it here : https://cgal.github.io/${{ steps.get_pr_number.outputs.result }}/${{ steps.get_round.outputs.result }}/Manual/index.html"
|
||||
const address = "The documentation is built. It will be available, after a few minutes, here : https://cgal.github.io/${{ steps.get_pr_number.outputs.result }}/${{ steps.get_round.outputs.result }}/Manual/index.html"
|
||||
github.issues.createComment({
|
||||
owner: "CGAL",
|
||||
repo: "cgal",
|
||||
|
|
|
|||
|
|
@ -18,10 +18,15 @@ jobs:
|
|||
git clone https://maxGimeno:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git --depth=5
|
||||
PR_NUMBER=$(python -c "import json; import os; y = json.load(open(os.environ['GITHUB_EVENT_PATH'])); print(y[\"number\"])")
|
||||
cd cgal.github.io/
|
||||
egrep -v " ${PR_NUMBER}\." index.html > tmp.html
|
||||
egrep -v " ${PR_NUMBER}\." index.html > tmp.html || true
|
||||
if [ -n "$(diff -q ./index.html ./tmp.html)" ]; then
|
||||
mv tmp.html index.html
|
||||
#git rm -r ${PR_NUMBER} && git commit -a -m "Remove ${PR_NUMBER}" && git push -u origin master
|
||||
git commit -a -m "Remove ${PR_NUMBER}" && git push -u origin master
|
||||
fi
|
||||
if [ -d ${PR_NUMBER} ]; then
|
||||
git rm -r ${PR_NUMBER}
|
||||
fi
|
||||
#git diff exits with 1 if there is a diff
|
||||
if !git diff --quiet; then
|
||||
git commit -a --amend -m"base commit" && git push -f -u origin master
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
name: Test Polyhedron Demo
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
batch_1:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.0.0
|
||||
- name: install dependencies
|
||||
run: .github/install.sh
|
||||
- name: run1
|
||||
run: ./.github/test.sh 0 ${{ github.workspace }}
|
||||
batch_2:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.0.0
|
||||
- name: install dependencies
|
||||
run: .github/install.sh
|
||||
- name: run2
|
||||
run: ./.github/test.sh 1 ${{ github.workspace }}
|
||||
batch_3:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.0.0
|
||||
- name: install dependencies
|
||||
run: .github/install.sh
|
||||
- name: run3
|
||||
run: ./.github/test.sh 2 ${{ github.workspace }}
|
||||
batch_4:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.0.0
|
||||
- name: install dependencies
|
||||
run: .github/install.sh
|
||||
- name: run4
|
||||
run: ./.github/test.sh 3 ${{ github.workspace }}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
/*build*
|
||||
/*/*/*/build
|
||||
/*/*/*/VC*
|
||||
/*/*/*/GCC
|
||||
AABB_tree/demo/AABB_tree/AABB_demo
|
||||
AABB_tree/demo/AABB_tree/Makefile
|
||||
AABB_tree/examples/AABB_tree/*.kdev*
|
||||
|
|
|
|||
|
|
@ -7,30 +7,6 @@ CXX_FLAGS="-DCGAL_NDEBUG -ftemplate-backtrace-limit=0"
|
|||
function mytime {
|
||||
/usr/bin/time -f "Spend time of %C: %E (real)" "$@"
|
||||
}
|
||||
|
||||
function build_examples {
|
||||
mkdir -p build-travis
|
||||
cd build-travis
|
||||
mytime cmake -DCGAL_DIR="/usr/local/lib/cmake/CGAL" -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" ..
|
||||
mytime make -j2 VERBOSE=1
|
||||
}
|
||||
|
||||
function build_tests {
|
||||
build_examples
|
||||
}
|
||||
|
||||
function build_demo {
|
||||
mkdir -p build-travis
|
||||
cd build-travis
|
||||
EXTRA_CXX_FLAGS=
|
||||
case "$CC" in
|
||||
clang*)
|
||||
EXTRA_CXX_FLAGS="-Werror=inconsistent-missing-override"
|
||||
;;
|
||||
esac
|
||||
mytime cmake -DCGAL_DIR="/usr/local/lib/cmake/CGAL" -DCGAL_DONT_OVERRIDE_CMAKE_FLAGS:BOOL=ON -DCMAKE_CXX_FLAGS="${CXX_FLAGS} ${EXTRA_CXX_FLAGS}" ..
|
||||
mytime make -j2 VERBOSE=1
|
||||
}
|
||||
old_IFS=$IFS
|
||||
IFS=$' '
|
||||
ROOT="$PWD/.."
|
||||
|
|
@ -93,6 +69,25 @@ cd $ROOT
|
|||
exit 1
|
||||
fi
|
||||
echo "Matrix is up to date."
|
||||
#check if non standard cgal installation works
|
||||
cd $ROOT
|
||||
mkdir build_test
|
||||
cd build_test
|
||||
mytime cmake -DCMAKE_INSTALL_PREFIX=install/ -DCGAL_BUILD_THREE_DOC=TRUE ..
|
||||
mytime make install
|
||||
# test install with minimal downstream example
|
||||
mkdir installtest
|
||||
cd installtest
|
||||
touch main.cpp
|
||||
mkdir build
|
||||
echo 'project(Example)' >> CMakeLists.txt
|
||||
echo 'set(PROJECT_SRCS ${PROJECT_SOURCE_DIR}/main.cpp)' >> CMakeLists.txt
|
||||
echo 'find_package(CGAL REQUIRED)' >> CMakeLists.txt
|
||||
echo 'add_executable(${PROJECT_NAME} ${PROJECT_SRCS})' >> CMakeLists.txt
|
||||
echo 'target_link_libraries(${PROJECT_NAME} CGAL::CGAL)' >> CMakeLists.txt
|
||||
echo '#include "CGAL/remove_outliers.h"' >> main.cpp
|
||||
cd build
|
||||
mytime cmake -DCMAKE_INSTALL_PREFIX=../../install -DCGAL_BUILD_THREE_DOC=TRUE ..
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
@ -116,7 +111,7 @@ cd $ROOT
|
|||
|
||||
IFS=$old_IFS
|
||||
|
||||
if [ -n "$TRAVIS_PULL_REQUEST_BRANCH" ] && [ "$ARG" != Polyhedron_demo ]; then
|
||||
if [ -n "$TRAVIS_PULL_REQUEST_BRANCH" ]; then
|
||||
DO_IGNORE=FALSE
|
||||
. $ROOT/.travis/test_package.sh "$ROOT" "$ARG"
|
||||
echo "DO_IGNORE is $DO_IGNORE"
|
||||
|
|
@ -125,67 +120,22 @@ cd $ROOT
|
|||
fi
|
||||
fi
|
||||
IFS=$' '
|
||||
EXAMPLES="$ARG/examples/$ARG"
|
||||
TEST="$ARG/test/$ARG"
|
||||
DEMOS=$ROOT/$ARG/demo/*
|
||||
|
||||
if [ -d "$ROOT/$EXAMPLES" ]
|
||||
then
|
||||
cd $ROOT/$EXAMPLES
|
||||
if [ -f ./CMakeLists.txt ]; then
|
||||
build_examples
|
||||
else
|
||||
for dir in ./*
|
||||
do
|
||||
if [ -f $dir/CMakeLists.txt ]; then
|
||||
cd $ROOT/$EXAMPLES/$dir
|
||||
build_examples
|
||||
fi
|
||||
done
|
||||
fi
|
||||
elif [ "$ARG" != Polyhedron_demo ]; then
|
||||
echo "No example found for $ARG"
|
||||
mkdir -p build-travis
|
||||
cd build-travis
|
||||
WITHDEMOS=ON
|
||||
if [ "$ARG" = "Polyhedron" ]; then
|
||||
WITHDEMOS=OFF
|
||||
fi
|
||||
EXTRA_CXX_FLAGS=
|
||||
case "$CC" in
|
||||
clang*)
|
||||
EXTRA_CXX_FLAGS="-Werror=inconsistent-missing-override"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -d "$ROOT/$TEST" ]
|
||||
then
|
||||
cd $ROOT/$TEST
|
||||
if [ -f ./CMakeLists.txt ]; then
|
||||
build_tests
|
||||
else
|
||||
for dir in ./*
|
||||
do
|
||||
if [ -f $dir/CMakeLists.txt ]; then
|
||||
cd $ROOT/$TEST/$dir
|
||||
build_tests
|
||||
fi
|
||||
done
|
||||
fi
|
||||
elif [ "$ARG" != Polyhedron_demo ]; then
|
||||
echo "No test found for $ARG"
|
||||
fi
|
||||
#Packages like Periodic_3_triangulation_3 contain multiple demos
|
||||
for DEMO in $DEMOS; do
|
||||
DEMO=${DEMO#"$ROOT"}
|
||||
echo $DEMO
|
||||
#If there is no demo subdir, try in GraphicsView
|
||||
if [ ! -d "$ROOT/$DEMO" ] || [ ! -f "$ROOT/$DEMO/CMakeLists.txt" ]; then
|
||||
DEMO="GraphicsView/demo/$ARG"
|
||||
fi
|
||||
if [ "$ARG" != Polyhedron ] && [ -d "$ROOT/$DEMO" ]
|
||||
then
|
||||
cd $ROOT/$DEMO
|
||||
build_demo
|
||||
elif [ "$ARG" != Polyhedron_demo ]; then
|
||||
echo "No demo found for $ARG"
|
||||
fi
|
||||
done
|
||||
if [ "$ARG" = Polyhedron_demo ]; then
|
||||
DEMO=Polyhedron/demo/Polyhedron
|
||||
cd "$ROOT/$DEMO"
|
||||
build_demo
|
||||
fi
|
||||
|
||||
mytime cmake -DCMAKE_CXX_FLAGS="${CXX_FLAGS} ${EXTRA_CXX_FLAGS}" -DCGAL_DONT_OVERRIDE_CMAKE_FLAGS:BOOL=ON -DBUILD_TESTING=ON -DWITH_tests=ON -DWITH_examples=ON -DWITH_demos=$WITHDEMOS ..
|
||||
mytime ctest -j2 -L $ARG'([_][A-Z]|$)' -E execution___of__ --output-on-failure
|
||||
done
|
||||
IFS=$old_IFS
|
||||
# Local Variables:
|
||||
|
|
|
|||
|
|
@ -2,10 +2,16 @@
|
|||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.14)
|
||||
project( AABB_traits_benchmark )
|
||||
project(AABB_traits_benchmark)
|
||||
|
||||
find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core )
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core)
|
||||
|
||||
create_single_source_cgal_program( "test.cpp" )
|
||||
create_single_source_cgal_program( "tree_construction.cpp" )
|
||||
# google benchmark
|
||||
find_package(benchmark)
|
||||
|
||||
if (benchmark_FOUND)
|
||||
create_single_source_cgal_program("tree_creation.cpp")
|
||||
target_link_libraries(tree_creation benchmark::benchmark)
|
||||
endif()
|
||||
create_single_source_cgal_program("test.cpp")
|
||||
create_single_source_cgal_program("tree_construction.cpp")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
#include <benchmark/benchmark.h>
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_face_graph_triangle_primitive.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef CGAL::Surface_mesh<K::Point_3> Surface_mesh;
|
||||
typedef CGAL::AABB_face_graph_triangle_primitive<Surface_mesh> Primitive;
|
||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
typedef K::Segment_3 Segment;
|
||||
typedef K::Point_3 Point_3;
|
||||
|
||||
|
||||
Surface_mesh mesh;
|
||||
|
||||
static void BM_TreeCreation(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize([]() {
|
||||
Tree tree{mesh.faces_begin(), mesh.faces_end(), mesh};
|
||||
tree.build();
|
||||
return 0;
|
||||
}());
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_TreeCreation);
|
||||
|
||||
static void BM_Intersections(benchmark::State& state)
|
||||
{
|
||||
Point_3 p(-0.5, 0.03, 0.04);
|
||||
Point_3 q(-0.5, 0.04, 0.06);
|
||||
|
||||
Tree tree{mesh.faces_begin(), mesh.faces_end(), mesh};
|
||||
tree.accelerate_distance_queries();
|
||||
|
||||
Segment segment_query(p, q);
|
||||
for (auto _ : state)
|
||||
{
|
||||
benchmark::DoNotOptimize([&]() {
|
||||
tree.number_of_intersected_primitives(segment_query);
|
||||
Point_3 point_query(2.0, 2.0, 2.0);
|
||||
Point_3 closest = tree.closest_point(point_query);
|
||||
return 0;
|
||||
}());
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_Intersections);
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const char* default_file = "data/handle.off";
|
||||
const char* filename = argc > 2? argv[2] : default_file;
|
||||
|
||||
{
|
||||
std::ifstream input(filename);
|
||||
input >> mesh;
|
||||
}
|
||||
|
||||
::benchmark::Initialize(&argc, argv);
|
||||
::benchmark::RunSpecifiedBenchmarks();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# This is the CMake script for compiling the AABB tree demo.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( AABB_tree_Demo )
|
||||
project(AABB_tree_Demo)
|
||||
|
||||
# Find includes in corresponding build directories
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
|
@ -17,58 +17,56 @@ if(POLICY CMP0071)
|
|||
endif()
|
||||
|
||||
# Include this package's headers first
|
||||
include_directories( BEFORE ./ ./include )
|
||||
include_directories(BEFORE ./ ./include)
|
||||
|
||||
# Find CGAL and CGAL Qt5
|
||||
find_package(CGAL COMPONENTS Qt5)
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
# Find Qt5 itself
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg)
|
||||
|
||||
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
qt5_wrap_ui( UI_FILES MainWindow.ui )
|
||||
qt5_wrap_ui(UI_FILES MainWindow.ui)
|
||||
|
||||
include(AddFileDependencies)
|
||||
|
||||
qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
|
||||
add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" )
|
||||
qt5_generate_moc("MainWindow.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp")
|
||||
add_file_dependencies(MainWindow_moc.cpp
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h")
|
||||
|
||||
qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
|
||||
add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" )
|
||||
qt5_generate_moc("Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp")
|
||||
add_file_dependencies(Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h")
|
||||
|
||||
qt5_generate_moc( "Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
|
||||
add_file_dependencies( Scene_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Scene.h" )
|
||||
qt5_generate_moc("Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp")
|
||||
add_file_dependencies(Scene_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Scene.h")
|
||||
|
||||
qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES AABB_demo.qrc )
|
||||
qt5_add_resources(CGAL_Qt5_RESOURCE_FILES AABB_demo.qrc)
|
||||
|
||||
add_file_dependencies( AABB_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
|
||||
add_file_dependencies(
|
||||
AABB_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp")
|
||||
|
||||
add_executable ( AABB_demo AABB_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES}
|
||||
add_executable(
|
||||
AABB_demo AABB_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES}
|
||||
#${CGAL_Qt5_MOC_FILES}
|
||||
)
|
||||
)
|
||||
# Link with Qt libraries
|
||||
target_link_libraries( AABB_demo PRIVATE
|
||||
Qt5::OpenGL Qt5::Gui Qt5::Xml
|
||||
CGAL::CGAL
|
||||
CGAL::CGAL_Qt5
|
||||
)
|
||||
target_link_libraries(AABB_demo PRIVATE Qt5::OpenGL Qt5::Gui Qt5::Xml
|
||||
CGAL::CGAL CGAL::CGAL_Qt5)
|
||||
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS AABB_demo )
|
||||
add_to_cached_list(CGAL_EXECUTABLE_TARGETS AABB_demo)
|
||||
|
||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||
cgal_add_compilation_test(AABB_demo)
|
||||
|
||||
else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
else(CGAL_Qt5_FOUND
|
||||
AND Qt5_FOUND)
|
||||
|
||||
set(AABB_MISSING_DEPS "")
|
||||
|
||||
if(NOT CGAL_FOUND)
|
||||
set(AABB_MISSING_DEPS "the CGAL library, ${AABB_MISSING_DEPS}")
|
||||
endif()
|
||||
|
||||
if(NOT CGAL_Qt5_FOUND)
|
||||
set(AABB_MISSING_DEPS "CGAL_Qt5, ${AABB_MISSING_DEPS}")
|
||||
endif()
|
||||
|
|
@ -77,6 +75,11 @@ else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
|
|||
set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}")
|
||||
endif()
|
||||
|
||||
message(STATUS "NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled.")
|
||||
message(
|
||||
STATUS
|
||||
"NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled."
|
||||
)
|
||||
|
||||
endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
|
||||
endif(
|
||||
CGAL_Qt5_FOUND
|
||||
AND Qt5_FOUND)
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( AABB_tree_Examples )
|
||||
project(AABB_tree_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
#ifndef CGAL_AABB_TREE_H
|
||||
#define CGAL_AABB_TREE_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <CGAL/license/AABB_tree.h>
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
|
@ -62,6 +64,7 @@ namespace CGAL {
|
|||
typedef std::vector<typename AABBTraits::Primitive> Primitives;
|
||||
|
||||
typedef internal::Primitive_helper<AABBTraits> Helper;
|
||||
typedef AABB_tree<AABBTraits> Self;
|
||||
|
||||
public:
|
||||
typedef AABBTraits AABB_traits;
|
||||
|
|
@ -113,6 +116,15 @@ namespace CGAL {
|
|||
/// class using `traits`.
|
||||
AABB_tree(const AABBTraits& traits = AABBTraits());
|
||||
|
||||
/// move constructor
|
||||
AABB_tree(Self&&) noexcept;
|
||||
/// assignment operator
|
||||
Self& operator=(Self&&) noexcept;
|
||||
|
||||
// Disabled copy constructor & assignment operator
|
||||
AABB_tree(const Self&) = delete;
|
||||
Self& operator=(const Self&) = delete;
|
||||
|
||||
/**
|
||||
* @brief Builds the datastructure from a sequence of primitives.
|
||||
* @param first iterator over first primitive to insert
|
||||
|
|
@ -475,10 +487,7 @@ public:
|
|||
// clear nodes
|
||||
void clear_nodes()
|
||||
{
|
||||
if( size() > 1 ) {
|
||||
delete [] m_p_root_node;
|
||||
}
|
||||
m_p_root_node = nullptr;
|
||||
m_nodes.clear();
|
||||
}
|
||||
|
||||
// clears internal KD tree
|
||||
|
|
@ -491,8 +500,7 @@ public:
|
|||
#endif
|
||||
{
|
||||
CGAL_assertion( m_p_search_tree!=nullptr );
|
||||
delete m_p_search_tree;
|
||||
m_p_search_tree = nullptr;
|
||||
m_p_search_tree.reset();
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
m_atomic_search_tree_constructed.store(false, std::memory_order_relaxed);
|
||||
#else
|
||||
|
|
@ -522,6 +530,22 @@ public:
|
|||
private:
|
||||
typedef AABB_node<AABBTraits> Node;
|
||||
|
||||
/**
|
||||
* @brief Builds the tree by recursive expansion.
|
||||
* @param first the first primitive to insert
|
||||
* @param last the last primitive to insert
|
||||
* @param range the number of primitive of the range
|
||||
*
|
||||
* [first,last[ is the range of primitives to be added to the tree.
|
||||
*/
|
||||
template<typename ConstPrimitiveIterator, typename ComputeBbox, typename SplitPrimitives>
|
||||
void expand(Node& node,
|
||||
ConstPrimitiveIterator first,
|
||||
ConstPrimitiveIterator beyond,
|
||||
const std::size_t range,
|
||||
const ComputeBbox& compute_bbox,
|
||||
const SplitPrimitives& split_primitives,
|
||||
const AABBTraits&);
|
||||
|
||||
public:
|
||||
// returns a point which must be on one primitive
|
||||
|
|
@ -573,8 +597,8 @@ public:
|
|||
AABBTraits m_traits;
|
||||
// set of input primitives
|
||||
Primitives m_primitives;
|
||||
// single root node
|
||||
Node* m_p_root_node = nullptr;
|
||||
// tree nodes. first node is the root node
|
||||
std::vector<Node> m_nodes;
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
mutable CGAL_MUTEX build_mutex; // mutex used to protect const calls inducing build() and build_kd_tree()
|
||||
#endif
|
||||
|
|
@ -594,7 +618,13 @@ public:
|
|||
#endif
|
||||
const_cast< AABB_tree<AABBTraits>* >(this)->build();
|
||||
}
|
||||
return m_p_root_node;
|
||||
return std::addressof(m_nodes[0]);
|
||||
}
|
||||
|
||||
Node& new_node()
|
||||
{
|
||||
m_nodes.emplace_back();
|
||||
return m_nodes.back();
|
||||
}
|
||||
private:
|
||||
const Primitive& singleton_data() const {
|
||||
|
|
@ -603,7 +633,7 @@ public:
|
|||
}
|
||||
|
||||
// search KD-tree
|
||||
const Search_tree* m_p_search_tree = nullptr;
|
||||
mutable std::unique_ptr<const Search_tree> m_p_search_tree;
|
||||
bool m_use_default_search_tree = true; // indicates whether the internal kd-tree should be built
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
std::atomic<bool> m_atomic_need_build;
|
||||
|
|
@ -613,11 +643,6 @@ public:
|
|||
mutable bool m_search_tree_constructed = false;
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Disabled copy constructor & assignment operator
|
||||
typedef AABB_tree<AABBTraits> Self;
|
||||
AABB_tree(const Self& src);
|
||||
Self& operator=(const Self& src);
|
||||
|
||||
}; // end class AABB_tree
|
||||
|
||||
|
|
@ -632,6 +657,30 @@ public:
|
|||
#endif
|
||||
{}
|
||||
|
||||
template <typename Tr>
|
||||
typename AABB_tree<Tr>::Self& AABB_tree<Tr>::operator=(Self&& tree) noexcept
|
||||
{
|
||||
m_traits = std::move(tree.m_traits);
|
||||
m_primitives = std::move(tree.m_primitives);
|
||||
m_nodes = std::move(tree.m_nodes);
|
||||
m_p_search_tree = std::move(tree.m_p_search_tree);
|
||||
m_use_default_search_tree = std::exchange(tree.m_use_default_search_tree, true);
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
m_atomic_need_build = tree.m_atomic_need_build.load(std::memory_order_relaxed);
|
||||
m_atomic_search_tree_constructed = tree.m_atomic_search_tree_constructed.load(std::memory_order_relaxed);
|
||||
#else
|
||||
m_need_build = std::exchange(tree.m_need_build, false);
|
||||
m_search_tree_constructed = std::exchange(tree.m_search_tree_constructed, false);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Tr>
|
||||
AABB_tree<Tr>::AABB_tree(Self&& tree) noexcept
|
||||
{
|
||||
*this = std::move(tree);
|
||||
}
|
||||
|
||||
template<typename Tr>
|
||||
template<typename ConstPrimitiveIterator, typename ... T>
|
||||
AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
|
||||
|
|
@ -704,6 +753,41 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
template<typename Tr>
|
||||
template<typename ConstPrimitiveIterator, typename ComputeBbox, typename SplitPrimitives>
|
||||
void
|
||||
AABB_tree<Tr>::expand(Node& node,
|
||||
ConstPrimitiveIterator first,
|
||||
ConstPrimitiveIterator beyond,
|
||||
const std::size_t range,
|
||||
const ComputeBbox& compute_bbox,
|
||||
const SplitPrimitives& split_primitives,
|
||||
const Tr& traits)
|
||||
{
|
||||
node.set_bbox(compute_bbox(first, beyond));
|
||||
|
||||
// sort primitives along longest axis aabb
|
||||
split_primitives(first, beyond, node.bbox());
|
||||
|
||||
switch(range)
|
||||
{
|
||||
case 2:
|
||||
node.set_children(*first, *(first+1));
|
||||
break;
|
||||
case 3:
|
||||
node.set_children(*first, new_node());
|
||||
expand(node.right_child(), first+1, beyond, 2, compute_bbox, split_primitives, traits);
|
||||
break;
|
||||
default:
|
||||
const std::size_t new_range = range/2;
|
||||
node.set_children(new_node(), new_node());
|
||||
expand(node.left_child(), first, first + new_range, new_range, compute_bbox, split_primitives, traits);
|
||||
expand(node.right_child(), first + new_range, beyond, range - new_range, compute_bbox, split_primitives, traits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Build the data structure, after calls to insert(..)
|
||||
template<typename Tr>
|
||||
void AABB_tree<Tr>::build()
|
||||
{
|
||||
|
|
@ -719,24 +803,19 @@ public:
|
|||
const SplitPrimitives& split_primitives)
|
||||
{
|
||||
clear_nodes();
|
||||
|
||||
if(m_primitives.size() > 1) {
|
||||
|
||||
// allocates tree nodes
|
||||
m_p_root_node = new Node[m_primitives.size()-1]();
|
||||
if(m_p_root_node == nullptr)
|
||||
{
|
||||
std::cerr << "Unable to allocate memory for AABB tree" << std::endl;
|
||||
CGAL_assertion(m_p_root_node != nullptr);
|
||||
m_primitives.clear();
|
||||
clear();
|
||||
}
|
||||
m_nodes.reserve(m_primitives.size()-1);
|
||||
|
||||
// constructs the tree
|
||||
m_p_root_node->expand(m_primitives.begin(), m_primitives.end(),
|
||||
m_primitives.size(),
|
||||
compute_bbox,
|
||||
split_primitives,
|
||||
m_traits);
|
||||
expand(new_node(),
|
||||
m_primitives.begin(), m_primitives.end(),
|
||||
m_primitives.size(),
|
||||
compute_bbox,
|
||||
split_primitives,
|
||||
m_traits);
|
||||
}
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
m_atomic_need_build.store(false, std::memory_order_release); // in case build() is triggered by a call to root_node()
|
||||
|
|
@ -768,22 +847,13 @@ public:
|
|||
ConstPointIterator beyond)
|
||||
{
|
||||
clear_search_tree();
|
||||
m_p_search_tree = new Search_tree(first, beyond);
|
||||
|
||||
if(m_p_search_tree != nullptr)
|
||||
{
|
||||
m_p_search_tree = std::make_unique<const Search_tree>(first, beyond);
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
m_atomic_search_tree_constructed.store(true, std::memory_order_release); // in case build_kd_tree() is triggered by a call to best_hint()
|
||||
#else
|
||||
m_search_tree_constructed = true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Unable to allocate memory for accelerating distance queries" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Tr>
|
||||
|
|
@ -793,7 +863,6 @@ public:
|
|||
m_use_default_search_tree = false;
|
||||
}
|
||||
|
||||
|
||||
// constructs the search KD tree from internal primitives
|
||||
template<typename Tr>
|
||||
bool AABB_tree<Tr>::accelerate_distance_queries()
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ namespace CGAL {
|
|||
template<typename AABBTraits>
|
||||
class AABB_node
|
||||
{
|
||||
private:
|
||||
typedef AABB_node<AABBTraits> Self;
|
||||
|
||||
public:
|
||||
typedef typename AABBTraits::Bounding_box Bounding_box;
|
||||
|
||||
|
|
@ -41,29 +44,15 @@ public:
|
|||
, m_p_left_child(nullptr)
|
||||
, m_p_right_child(nullptr) { };
|
||||
|
||||
/// Non virtual Destructor
|
||||
/// Do not delete children because the tree hosts and delete them
|
||||
~AABB_node() { };
|
||||
AABB_node(Self&& node) = default;
|
||||
|
||||
// Disabled copy constructor & assignment operator
|
||||
AABB_node(const Self& src) = delete;
|
||||
Self& operator=(const Self& src) = delete;
|
||||
|
||||
/// Returns the bounding box of the node
|
||||
const Bounding_box& bbox() const { return m_bbox; }
|
||||
|
||||
/**
|
||||
* @brief Builds the tree by recursive expansion.
|
||||
* @param first the first primitive to insert
|
||||
* @param last the last primitive to insert
|
||||
* @param range the number of primitive of the range
|
||||
*
|
||||
* [first,last[ is the range of primitives to be added to the tree.
|
||||
*/
|
||||
template<typename ConstPrimitiveIterator, typename ComputeBbox, typename SplitPrimitives>
|
||||
void expand(ConstPrimitiveIterator first,
|
||||
ConstPrimitiveIterator beyond,
|
||||
const std::size_t range,
|
||||
const ComputeBbox& compute_bbox,
|
||||
const SplitPrimitives& split_primitives,
|
||||
const AABBTraits&);
|
||||
|
||||
/**
|
||||
* @brief General traversal query
|
||||
* @param query the query
|
||||
|
|
@ -95,8 +84,17 @@ public:
|
|||
{ return *static_cast<Primitive*>(m_p_left_child); }
|
||||
const Primitive& right_data() const
|
||||
{ return *static_cast<Primitive*>(m_p_right_child); }
|
||||
template <class Left, class Right>
|
||||
void set_children(Left& l, Right& r)
|
||||
{
|
||||
m_p_left_child = static_cast<void*>(std::addressof(l));
|
||||
m_p_right_child = static_cast<void*>(std::addressof(r));
|
||||
}
|
||||
void set_bbox(const Bounding_box& bbox)
|
||||
{
|
||||
m_bbox = bbox;
|
||||
}
|
||||
|
||||
private:
|
||||
Node& left_child() { return *static_cast<Node*>(m_p_left_child); }
|
||||
Node& right_child() { return *static_cast<Node*>(m_p_right_child); }
|
||||
Primitive& left_data() { return *static_cast<Primitive*>(m_p_left_child); }
|
||||
|
|
@ -111,49 +109,8 @@ private:
|
|||
void *m_p_left_child;
|
||||
void *m_p_right_child;
|
||||
|
||||
private:
|
||||
// Disabled copy constructor & assignment operator
|
||||
typedef AABB_node<AABBTraits> Self;
|
||||
AABB_node(const Self& src);
|
||||
Self& operator=(const Self& src);
|
||||
|
||||
}; // end class AABB_node
|
||||
|
||||
template<typename Tr>
|
||||
template<typename ConstPrimitiveIterator, typename ComputeBbox, typename SplitPrimitives>
|
||||
void
|
||||
AABB_node<Tr>::expand(ConstPrimitiveIterator first,
|
||||
ConstPrimitiveIterator beyond,
|
||||
const std::size_t range,
|
||||
const ComputeBbox& compute_bbox,
|
||||
const SplitPrimitives& split_primitives,
|
||||
const Tr& traits)
|
||||
{
|
||||
m_bbox = compute_bbox(first, beyond);
|
||||
|
||||
// sort primitives along longest axis aabb
|
||||
split_primitives(first, beyond, m_bbox);
|
||||
|
||||
switch(range)
|
||||
{
|
||||
case 2:
|
||||
m_p_left_child = &(*first);
|
||||
m_p_right_child = &(*(++first));
|
||||
break;
|
||||
case 3:
|
||||
m_p_left_child = &(*first);
|
||||
m_p_right_child = static_cast<Node*>(this)+1;
|
||||
right_child().expand(first+1, beyond, 2, compute_bbox, split_primitives, traits);
|
||||
break;
|
||||
default:
|
||||
const std::size_t new_range = range/2;
|
||||
m_p_left_child = static_cast<Node*>(this) + 1;
|
||||
m_p_right_child = static_cast<Node*>(this) + new_range;
|
||||
left_child().expand(first, first + new_range, new_range, compute_bbox, split_primitives, traits);
|
||||
right_child().expand(first + new_range, beyond, range - new_range, compute_bbox, split_primitives, traits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename Tr>
|
||||
template<class Traversal_traits, class Query>
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace CGAL
|
|||
typedef typename CGAL::Orthogonal_k_neighbor_search<TreeTraits> Neighbor_search;
|
||||
typedef typename Neighbor_search::Tree Tree;
|
||||
private:
|
||||
Tree* m_p_tree;
|
||||
Tree m_tree;
|
||||
|
||||
|
||||
Point_and_primitive_id get_p_and_p(const Point_and_primitive_id& p)
|
||||
|
|
@ -98,30 +98,22 @@ namespace CGAL
|
|||
public:
|
||||
template <class ConstPointIterator>
|
||||
AABB_search_tree(ConstPointIterator begin, ConstPointIterator beyond)
|
||||
: m_p_tree(nullptr)
|
||||
: m_tree{}
|
||||
{
|
||||
typedef typename Add_decorated_point<Traits, typename Traits::Primitive::Id>::Point_3 Decorated_point;
|
||||
typedef typename Add_decorated_point<Traits,typename Traits::Primitive::Id>::Point_3 Decorated_point;
|
||||
std::vector<Decorated_point> points;
|
||||
while(begin != beyond) {
|
||||
Point_and_primitive_id pp = get_p_and_p(*begin);
|
||||
points.push_back(Decorated_point(pp.first,pp.second));
|
||||
points.emplace_back(pp.first, pp.second);
|
||||
++begin;
|
||||
}
|
||||
m_p_tree = new Tree(points.begin(), points.end());
|
||||
if(m_p_tree != nullptr)
|
||||
m_p_tree->build();
|
||||
else
|
||||
std::cerr << "unable to build the search tree!" << std::endl;
|
||||
m_tree.insert(points.begin(), points.end());
|
||||
m_tree.build();
|
||||
}
|
||||
|
||||
~AABB_search_tree() {
|
||||
delete m_p_tree;
|
||||
}
|
||||
|
||||
|
||||
Point_and_primitive_id closest_point(const Point& query) const
|
||||
{
|
||||
Neighbor_search search(*m_p_tree, query, 1);
|
||||
Neighbor_search search(m_tree, query, 1);
|
||||
return Point_and_primitive_id(static_cast<Point>(search.begin()->first), search.begin()->first.id());
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( AABB_tree_Tests )
|
||||
project(AABB_tree_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include( ${CGAL_USE_FILE} ) # Kept to test the old behaviour.
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
include(${CGAL_USE_FILE}) # Kept to test the old behaviour.
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,207 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#include <CGAL/AABB_face_graph_triangle_primitive.h>
|
||||
#include <CGAL/AABB_halfedge_graph_segment_primitive.h>
|
||||
#include <CGAL/AABB_segment_primitive.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/assertions.h>
|
||||
#include <fstream>
|
||||
|
||||
template <int test_number>
|
||||
class TestCase
|
||||
{
|
||||
};
|
||||
|
||||
// test 0 is from "aabb_test_singleton_tree"
|
||||
template <>
|
||||
class TestCase<0>
|
||||
{
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef K::FT FT;
|
||||
typedef K::Point_3 Point;
|
||||
typedef K::Plane_3 Plane;
|
||||
typedef K::Segment_3 Segment;
|
||||
typedef K::Triangle_3 Triangle;
|
||||
typedef std::vector<Segment>::iterator Iterator;
|
||||
typedef CGAL::AABB_segment_primitive<K, Iterator> Primitive;
|
||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
|
||||
public:
|
||||
Tree create_tree()
|
||||
{
|
||||
return Tree(segments.begin(), segments.end());
|
||||
}
|
||||
|
||||
void init_tree(Tree&) {}
|
||||
|
||||
bool test_tree(Tree& tree)
|
||||
{
|
||||
Plane plane_query(a, b, d);
|
||||
Triangle triangle_query(a, b, c);
|
||||
|
||||
// Test calls to all functions
|
||||
CGAL::Emptyset_iterator devnull;
|
||||
tree.all_intersections(triangle_query, devnull);
|
||||
tree.all_intersected_primitives(triangle_query, devnull);
|
||||
assert(tree.any_intersected_primitive(triangle_query));
|
||||
assert(tree.any_intersection(triangle_query));
|
||||
const CGAL::Bbox_3 bbox = tree.bbox();
|
||||
assert(bbox == CGAL::Bbox_3(0, 0, 0, 2, 2, 2));
|
||||
tree.clear();
|
||||
tree.insert(segments.begin(), segments.end());
|
||||
tree.build();
|
||||
assert(tree.closest_point(Point(-0.1, -0.1, -0.1)) == Point(0, 0, 0));
|
||||
assert(tree.closest_point(Point(-0.1, -0.1, -0.1), Point(0, 0, 0)) ==
|
||||
Point(0, 0, 0));
|
||||
assert(tree.closest_point_and_primitive(Point(-0.1, -0.1, -0.1)).second ==
|
||||
segments.begin());
|
||||
assert(tree.do_intersect(plane_query) == true);
|
||||
assert(tree.do_intersect(triangle_query) == true);
|
||||
assert(!tree.empty());
|
||||
assert(tree.size() == 1);
|
||||
tree.clear();
|
||||
assert(tree.size() == 0);
|
||||
tree.insert(segments.begin(), segments.end());
|
||||
assert(tree.size() == 1);
|
||||
assert(tree.number_of_intersected_primitives(plane_query) == 1);
|
||||
tree.rebuild(segments.begin(), segments.end());
|
||||
assert(tree.size() == 1);
|
||||
assert(tree.number_of_intersected_primitives(triangle_query) == 1);
|
||||
assert(tree.squared_distance(Point(0, 0, 0)) == 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Point a = {1.0, 0.0, 0.0};
|
||||
Point b = {0.0, 1.0, 0.0};
|
||||
Point c = {0.0, 0.0, 1.0};
|
||||
Point d = {0.0, 0.0, 0.0};
|
||||
std::vector<Segment> segments = {Segment(Point(0, 0, 0), Point(2, 2, 2))};
|
||||
};
|
||||
|
||||
// test 1 is from "aabb_test_all_intersected_primitives"
|
||||
template <>
|
||||
class TestCase<1>
|
||||
{
|
||||
typedef CGAL::Epick K;
|
||||
typedef K::FT FT;
|
||||
typedef K::Point_3 Point;
|
||||
typedef K::Vector_3 Vector;
|
||||
typedef K::Segment_3 Segment;
|
||||
typedef K::Ray_3 Ray;
|
||||
typedef CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>> Mesh;
|
||||
typedef CGAL::AABB_halfedge_graph_segment_primitive<Mesh, CGAL::Default,
|
||||
CGAL::Tag_false>
|
||||
S_Primitive;
|
||||
typedef CGAL::AABB_face_graph_triangle_primitive<Mesh, CGAL::Default,
|
||||
CGAL::Tag_false>
|
||||
T_Primitive;
|
||||
typedef CGAL::AABB_traits<K, T_Primitive> T_Traits;
|
||||
typedef CGAL::AABB_traits<K, S_Primitive> S_Traits;
|
||||
typedef CGAL::AABB_tree<T_Traits> T_Tree;
|
||||
typedef CGAL::AABB_tree<S_Traits> S_Tree;
|
||||
typedef T_Tree::Primitive_id T_Primitive_id;
|
||||
typedef S_Tree::Primitive_id S_Primitive_id;
|
||||
typedef std::pair<T_Tree, S_Tree> TreePair;
|
||||
|
||||
public:
|
||||
TreePair create_tree()
|
||||
{
|
||||
static CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>> m1 = {};
|
||||
static CGAL::Surface_mesh<CGAL::Point_3<CGAL::Epick>> m2 = {};
|
||||
static bool mesh_loaded = false;
|
||||
if (!mesh_loaded) {
|
||||
std::ifstream in("data/cube.off");
|
||||
assert(in);
|
||||
in >> m1;
|
||||
in.close();
|
||||
in.open("data/tetrahedron.off");
|
||||
assert(in);
|
||||
in >> m2;
|
||||
in.close();
|
||||
mesh_loaded = true;
|
||||
}
|
||||
return std::make_pair(T_Tree{faces(m1).first, faces(m1).second, m1},
|
||||
S_Tree{edges(m2).first, edges(m2).second, m2});
|
||||
}
|
||||
|
||||
void init_tree(TreePair& trees)
|
||||
{
|
||||
trees.first.build();
|
||||
trees.second.build();
|
||||
}
|
||||
|
||||
bool test_tree(TreePair& trees)
|
||||
{
|
||||
auto &cube_tree = trees.first;
|
||||
auto &tet_tree = trees.second;
|
||||
|
||||
std::list<T_Tree::Primitive::Id> t_primitives;
|
||||
std::list<S_Tree::Primitive::Id> s_primitives;
|
||||
cube_tree.all_intersected_primitives(tet_tree,
|
||||
std::back_inserter(t_primitives));
|
||||
CGAL_assertion(t_primitives.size() == 6);
|
||||
tet_tree.all_intersected_primitives(cube_tree,
|
||||
std::back_inserter(s_primitives));
|
||||
CGAL_assertion(s_primitives.size() == 6);
|
||||
CGAL_assertion(tet_tree.do_intersect(cube_tree));
|
||||
CGAL_assertion(cube_tree.do_intersect(tet_tree));
|
||||
|
||||
std::vector<T_Tree::Primitive::Id> all_primitives;
|
||||
cube_tree.all_intersected_primitives(tet_tree,
|
||||
std::back_inserter(all_primitives));
|
||||
bool found_f5 = false;
|
||||
for (auto prim : all_primitives) {
|
||||
if ((int)prim.first == 5)
|
||||
found_f5 = true;
|
||||
}
|
||||
CGAL_assertion(found_f5);
|
||||
CGAL_USE(found_f5);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <int test_number>
|
||||
bool run_test()
|
||||
{
|
||||
TestCase<test_number> test_case;
|
||||
|
||||
// create_tree should return prvalue for guaranteed copy elision
|
||||
auto tree_1 = test_case.create_tree();
|
||||
test_case.init_tree(tree_1);
|
||||
|
||||
auto tree_2 = test_case.create_tree();
|
||||
test_case.init_tree(tree_2);
|
||||
|
||||
auto tree_3 = test_case.create_tree();
|
||||
test_case.init_tree(tree_3);
|
||||
|
||||
decltype(tree_1) tree_ctor{std::move(tree_2)};
|
||||
decltype(tree_1) tree_assig{};
|
||||
tree_assig = std::move(tree_3);
|
||||
|
||||
bool normal = test_case.test_tree(tree_1);
|
||||
bool move_ctor = test_case.test_tree(tree_ctor);
|
||||
bool move_ass =
|
||||
test_case.test_tree(tree_assig); // test move assignment operator
|
||||
|
||||
if (!normal)
|
||||
std::cout << "Test " << test_number << "failed on the original tree\n";
|
||||
if (!move_ctor)
|
||||
std::cout << "Test " << test_number << "failed on move constructed tree\n";
|
||||
if (!move_ass)
|
||||
std::cout << "Test " << test_number << "failed on move assigned tree\n";
|
||||
return normal && move_ctor && move_ass;
|
||||
}
|
||||
|
||||
int main() { return (run_test<0>() && run_test<1>()) ? 0 : 1; }
|
||||
|
|
@ -1,24 +1,16 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Advancing_front_surface_reconstruction_Examples )
|
||||
project(Advancing_front_surface_reconstruction_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Advancing_front_surface_reconstruction_Tests )
|
||||
project(Advancing_front_surface_reconstruction_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Algebraic_foundations_Examples )
|
||||
project(Algebraic_foundations_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Algebraic_foundations_Tests )
|
||||
project(Algebraic_foundations_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED COMPONENTS Core)
|
||||
|
||||
find_package(CGAL QUIET COMPONENTS Core)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Algebraic_kernel_d_Examples )
|
||||
project(Algebraic_kernel_d_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED COMPONENTS Core)
|
||||
|
||||
find_package(MPFI QUIET)
|
||||
|
||||
find_package(CGAL QUIET COMPONENTS Core)
|
||||
if(MPFI_FOUND)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
find_package(MPFI QUIET)
|
||||
endif()
|
||||
include(${CGAL_USE_FILE})
|
||||
include(${MPFI_USE_FILE})
|
||||
include(CGAL_VersionUtils)
|
||||
|
||||
if( CGAL_FOUND AND MPFI_FOUND)
|
||||
|
||||
include( ${CGAL_USE_FILE} )
|
||||
include( ${MPFI_USE_FILE} )
|
||||
include( CGAL_VersionUtils )
|
||||
|
||||
create_single_source_cgal_program( "Compare_1.cpp" )
|
||||
create_single_source_cgal_program( "Construct_algebraic_real_1.cpp" )
|
||||
create_single_source_cgal_program( "Isolate_1.cpp" )
|
||||
create_single_source_cgal_program( "Sign_at_1.cpp" )
|
||||
create_single_source_cgal_program( "Solve_1.cpp" )
|
||||
create_single_source_cgal_program("Compare_1.cpp")
|
||||
create_single_source_cgal_program("Construct_algebraic_real_1.cpp")
|
||||
create_single_source_cgal_program("Isolate_1.cpp")
|
||||
create_single_source_cgal_program("Sign_at_1.cpp")
|
||||
create_single_source_cgal_program("Solve_1.cpp")
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library and MPFI, and will not be compiled.")
|
||||
message(
|
||||
STATUS
|
||||
"This program requires the CGAL library and MPFI, and will not be compiled."
|
||||
)
|
||||
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,67 +1,65 @@
|
|||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Algebraic_kernel_d_Tests )
|
||||
|
||||
|
||||
project(Algebraic_kernel_d_Tests)
|
||||
|
||||
# CGAL and its components
|
||||
find_package( CGAL QUIET COMPONENTS Core)
|
||||
|
||||
if ( NOT CGAL_FOUND )
|
||||
|
||||
message(STATUS "This project requires the CGAL library, and will not be compiled.")
|
||||
return()
|
||||
|
||||
endif()
|
||||
find_package(CGAL REQUIRED COMPONENTS Core)
|
||||
|
||||
find_package(RS3 QUIET)
|
||||
|
||||
if(MPFI_FOUND)
|
||||
include( ${MPFI_USE_FILE} )
|
||||
include(${MPFI_USE_FILE})
|
||||
endif()
|
||||
if(RS3_FOUND)
|
||||
include( ${RS3_USE_FILE} )
|
||||
include(${RS3_USE_FILE})
|
||||
endif()
|
||||
|
||||
# Boost and its components
|
||||
find_package( Boost )
|
||||
find_package(Boost)
|
||||
|
||||
if ( NOT Boost_FOUND )
|
||||
if(NOT Boost_FOUND)
|
||||
|
||||
message(STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
message(
|
||||
STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
||||
# include for local directory
|
||||
include_directories( BEFORE include )
|
||||
include_directories(BEFORE include)
|
||||
|
||||
include( ${CGAL_USE_FILE} )
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
# Creating entries for all .cpp/.C files with "main" routine
|
||||
# ##########################################################
|
||||
|
||||
create_single_source_cgal_program( "cyclic.cpp" )
|
||||
create_single_source_cgal_program( "Algebraic_curve_kernel_2.cpp" )
|
||||
create_single_source_cgal_program( "algebraic_curve_kernel_2_tools.cpp" )
|
||||
create_single_source_cgal_program( "Algebraic_kernel_d_1_LEDA.cpp" )
|
||||
create_single_source_cgal_program("cyclic.cpp")
|
||||
create_single_source_cgal_program("Algebraic_curve_kernel_2.cpp")
|
||||
create_single_source_cgal_program("algebraic_curve_kernel_2_tools.cpp")
|
||||
create_single_source_cgal_program("Algebraic_kernel_d_1_LEDA.cpp")
|
||||
|
||||
create_single_source_cgal_program( "Algebraic_kernel_d_1_CORE_Integer_rational.cpp" )
|
||||
create_single_source_cgal_program( "Algebraic_kernel_d_1_CORE_SqrtII_rational.cpp" )
|
||||
create_single_source_cgal_program( "Algebraic_kernel_d_1_CORE_SqrtRI_rational.cpp" )
|
||||
create_single_source_cgal_program( "Algebraic_kernel_d_1_CORE_SqrtRR_rational.cpp" )
|
||||
create_single_source_cgal_program(
|
||||
"Algebraic_kernel_d_1_CORE_Integer_rational.cpp")
|
||||
create_single_source_cgal_program(
|
||||
"Algebraic_kernel_d_1_CORE_SqrtII_rational.cpp")
|
||||
create_single_source_cgal_program(
|
||||
"Algebraic_kernel_d_1_CORE_SqrtRI_rational.cpp")
|
||||
create_single_source_cgal_program(
|
||||
"Algebraic_kernel_d_1_CORE_SqrtRR_rational.cpp")
|
||||
|
||||
create_single_source_cgal_program( "Algebraic_kernel_d_1_GMP.cpp" )
|
||||
create_single_source_cgal_program( "Algebraic_kernel_d_2.cpp" )
|
||||
create_single_source_cgal_program( "Algebraic_real_d_1.cpp" )
|
||||
create_single_source_cgal_program( "Bitstream_descartes.cpp" )
|
||||
create_single_source_cgal_program( "Curve_analysis_2.cpp" )
|
||||
create_single_source_cgal_program( "Curve_pair_analysis_2.cpp" )
|
||||
create_single_source_cgal_program( "Descartes.cpp" )
|
||||
create_single_source_cgal_program( "Real_embeddable_traits_extension.cpp" )
|
||||
create_single_source_cgal_program("Algebraic_kernel_d_1_GMP.cpp")
|
||||
create_single_source_cgal_program("Algebraic_kernel_d_2.cpp")
|
||||
create_single_source_cgal_program("Algebraic_real_d_1.cpp")
|
||||
create_single_source_cgal_program("Bitstream_descartes.cpp")
|
||||
create_single_source_cgal_program("Curve_analysis_2.cpp")
|
||||
create_single_source_cgal_program("Curve_pair_analysis_2.cpp")
|
||||
create_single_source_cgal_program("Descartes.cpp")
|
||||
create_single_source_cgal_program("Real_embeddable_traits_extension.cpp")
|
||||
if(RS_FOUND)
|
||||
create_single_source_cgal_program( "Algebraic_kernel_rs_gmpq_d_1.cpp" )
|
||||
create_single_source_cgal_program( "Algebraic_kernel_rs_gmpz_d_1.cpp" )
|
||||
create_single_source_cgal_program("Algebraic_kernel_rs_gmpq_d_1.cpp")
|
||||
create_single_source_cgal_program("Algebraic_kernel_rs_gmpz_d_1.cpp")
|
||||
else()
|
||||
message(STATUS "NOTICE: Some tests require the RS library, and will not be compiled.")
|
||||
message(
|
||||
STATUS
|
||||
"NOTICE: Some tests require the RS library, and will not be compiled.")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Algebraic_kernel_for_circles_Tests )
|
||||
project(Algebraic_kernel_for_circles_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include_directories (BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
include_directories(BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Algebraic_kernel_for_spheres_Tests )
|
||||
project(Algebraic_kernel_for_spheres_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include_directories (BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
include_directories(BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Alpha_shapes_2_Examples )
|
||||
project(Alpha_shapes_2_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Alpha_shapes_2_Tests )
|
||||
project(Alpha_shapes_2_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project (Alpha_shapes_3_Demo)
|
||||
project(Alpha_shapes_3_Demo)
|
||||
|
||||
# Find includes in corresponding build directories
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
|
@ -16,35 +16,38 @@ if(POLICY CMP0071)
|
|||
cmake_policy(SET CMP0071 NEW)
|
||||
endif()
|
||||
|
||||
find_package(CGAL COMPONENTS Qt5)
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
|
||||
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
|
||||
# include(${QT_USE_FILE})
|
||||
include_directories (BEFORE ./ )
|
||||
# include(${QT_USE_FILE})
|
||||
include_directories(BEFORE ./)
|
||||
|
||||
# ui file, created wih Qt Designer
|
||||
qt5_wrap_ui( uis MainWindow.ui )
|
||||
qt5_wrap_ui(uis MainWindow.ui)
|
||||
|
||||
# qrc files (resources files, that contain icons, at least)
|
||||
qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Alpha_shape_3.qrc )
|
||||
qt5_add_resources(CGAL_Qt5_RESOURCE_FILES ./Alpha_shape_3.qrc)
|
||||
|
||||
add_executable ( Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shape_3 )
|
||||
add_executable(
|
||||
Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp ${uis}
|
||||
${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
|
||||
add_to_cached_list(CGAL_EXECUTABLE_TARGETS Alpha_shape_3)
|
||||
|
||||
target_link_libraries( Alpha_shape_3 PRIVATE
|
||||
CGAL::CGAL CGAL::CGAL_Qt5
|
||||
Qt5::OpenGL Qt5::Gui )
|
||||
target_link_libraries(Alpha_shape_3 PRIVATE CGAL::CGAL CGAL::CGAL_Qt5
|
||||
Qt5::OpenGL Qt5::Gui)
|
||||
|
||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||
cgal_add_compilation_test(Alpha_shape_3)
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
|
||||
message(
|
||||
STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled."
|
||||
)
|
||||
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Alpha_shapes_3_Examples )
|
||||
project(Alpha_shapes_3_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Alpha_shapes_3_Tests )
|
||||
project(Alpha_shapes_3_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include_directories (BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
include_directories(BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Apollonius_graph_2_Examples )
|
||||
project(Apollonius_graph_2_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED COMPONENTS Core)
|
||||
|
||||
find_package(CGAL QUIET COMPONENTS Core )
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Apollonius_graph_2_Tests )
|
||||
project(Apollonius_graph_2_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include_directories (BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
include_directories(BEFORE "include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -1,56 +1,53 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Arithmetic_kernel_Tests )
|
||||
project(Arithmetic_kernel_Tests)
|
||||
|
||||
|
||||
|
||||
|
||||
find_package(CGAL QUIET COMPONENTS Core)
|
||||
find_package(CGAL REQUIRED COMPONENTS Core)
|
||||
|
||||
find_package(GMP QUIET)
|
||||
|
||||
if ( CGAL_FOUND AND GMP_FOUND )
|
||||
if(GMP_FOUND)
|
||||
|
||||
include(${CGAL_USE_FILE})
|
||||
include( CGAL_VersionUtils )
|
||||
include(CGAL_VersionUtils)
|
||||
|
||||
get_dependency_version( GMP )
|
||||
get_dependency_version(GMP)
|
||||
|
||||
IS_VERSION_LESS("${GMP_VERSION}" "4.2.0" _IS_GMP_VERSION_TO_LOW)
|
||||
is_version_less("${GMP_VERSION}" "4.2.0" _IS_GMP_VERSION_TO_LOW)
|
||||
|
||||
include_directories(include)
|
||||
|
||||
find_package( MPFI )
|
||||
find_package(MPFI)
|
||||
|
||||
if( MPFI_FOUND )
|
||||
include( ${MPFI_USE_FILE} )
|
||||
if(MPFI_FOUND)
|
||||
include(${MPFI_USE_FILE})
|
||||
|
||||
# for the testsuite, the version of MPFI shipped with RS is used; this
|
||||
# version needs GMP>=4.2, so we require this dependency only here and
|
||||
# not in FindMPFI.cmake
|
||||
if( _IS_GMP_VERSION_TO_LOW )
|
||||
message( STATUS
|
||||
"MPFI tests need GMP>=4.2, some of the tests will not be compiled" )
|
||||
else( _IS_GMP_VERSION_TO_LOW )
|
||||
include( ${MPFI_USE_FILE} )
|
||||
create_single_source_cgal_program( "GMP_arithmetic_kernel.cpp" )
|
||||
endif( _IS_GMP_VERSION_TO_LOW )
|
||||
else( MPFI_FOUND )
|
||||
message( STATUS
|
||||
"MPFI is not present, some of the tests will not be compiled." )
|
||||
endif( MPFI_FOUND )
|
||||
if(_IS_GMP_VERSION_TO_LOW)
|
||||
message(
|
||||
STATUS
|
||||
"MPFI tests need GMP>=4.2, some of the tests will not be compiled")
|
||||
else(_IS_GMP_VERSION_TO_LOW)
|
||||
include(${MPFI_USE_FILE})
|
||||
create_single_source_cgal_program("GMP_arithmetic_kernel.cpp")
|
||||
endif(_IS_GMP_VERSION_TO_LOW)
|
||||
else(MPFI_FOUND)
|
||||
message(
|
||||
STATUS "MPFI is not present, some of the tests will not be compiled.")
|
||||
endif(MPFI_FOUND)
|
||||
|
||||
create_single_source_cgal_program( "Arithmetic_kernel.cpp" )
|
||||
create_single_source_cgal_program( "LEDA_arithmetic_kernel.cpp" )
|
||||
create_single_source_cgal_program( "CORE_arithmetic_kernel.cpp" )
|
||||
create_single_source_cgal_program( "Get_arithmetic_kernel.cpp" )
|
||||
create_single_source_cgal_program("Arithmetic_kernel.cpp")
|
||||
create_single_source_cgal_program("LEDA_arithmetic_kernel.cpp")
|
||||
create_single_source_cgal_program("CORE_arithmetic_kernel.cpp")
|
||||
create_single_source_cgal_program("Get_arithmetic_kernel.cpp")
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
message(
|
||||
STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -280,9 +280,9 @@ void ArrangementDemoWindow::updateInputType(QAction* a)
|
|||
tab->activateCurveInputCallback(curveType);
|
||||
}
|
||||
|
||||
#ifdef CGAL_USE_CORE
|
||||
void ArrangementDemoWindow::on_actionAddAlgebraicCurve_triggered()
|
||||
{
|
||||
#ifdef CGAL_USE_CORE
|
||||
AlgebraicCurveInputDialog newDialog;
|
||||
|
||||
if (newDialog.exec() == QDialog::Accepted)
|
||||
|
|
@ -312,10 +312,12 @@ void ArrangementDemoWindow::on_actionAddAlgebraicCurve_triggered()
|
|||
algCurveInputCallback->generate(cv);
|
||||
if (is_first_curve) currentTab->adjustViewport();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ArrangementDemoWindow::on_actionAddRationalCurve_triggered()
|
||||
{
|
||||
#ifdef CGAL_USE_CORE
|
||||
RationalCurveInputDialog newDialog;
|
||||
|
||||
if (newDialog.exec() == QDialog::Accepted)
|
||||
|
|
@ -346,8 +348,8 @@ void ArrangementDemoWindow::on_actionAddRationalCurve_triggered()
|
|||
algCurveInputCallback->generate(cv);
|
||||
if (is_first_curve) currentTab->adjustViewport();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ArrangementDemoWindow::on_actionQuit_triggered() { qApp->exit(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -78,10 +78,8 @@ public Q_SLOTS:
|
|||
void on_actionMerge_toggled(bool);
|
||||
void on_actionSplit_toggled(bool);
|
||||
void on_actionFill_toggled(bool);
|
||||
#ifdef CGAL_USE_CORE
|
||||
void on_actionAddAlgebraicCurve_triggered();
|
||||
void on_actionAddRationalCurve_triggered();
|
||||
#endif
|
||||
|
||||
Q_SIGNALS:
|
||||
void modelChanged();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Arrangement_on_surface_2_Demo )
|
||||
project(Arrangement_on_surface_2_Demo)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
|
|
@ -134,7 +134,6 @@ else()
|
|||
if(NOT Qt5_FOUND)
|
||||
set(MISSING_DEPS "Qt5, ${MISSING_DEPS}")
|
||||
endif()
|
||||
|
||||
message(STATUS
|
||||
"NOTICE: This demo requires ${MISSING_DEPS} and will not be compiled.")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@
|
|||
#ifndef ARRANGEMENT_DEMO_RATIONAL_TYPES_H
|
||||
#define ARRANGEMENT_DEMO_RATIONAL_TYPES_H
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#ifdef CGAL_USE_CORE
|
||||
#include <CGAL/CORE_BigRat.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#else
|
||||
#include <CGAL/Exact_rational.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Arrangement_on_surface_2_Examples )
|
||||
project(Arrangement_on_surface_2_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED COMPONENTS Core)
|
||||
|
||||
find_package(CGAL QUIET COMPONENTS Core)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -91,6 +91,11 @@ public:
|
|||
/*! Destructor. */
|
||||
virtual ~Arr_vertex_base() {}
|
||||
|
||||
// Access/modification for pointer squatting
|
||||
void* inc() const { return p_inc; }
|
||||
void set_inc(void * inc) const
|
||||
{ const_cast<Arr_vertex_base&>(*this).p_inc = inc; }
|
||||
|
||||
/*! Check if the point pointer is nullptr. */
|
||||
bool has_null_point() const { return (p_pt == nullptr); }
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,89 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
template <typename Arr1, typename Arr2, typename Curve>
|
||||
class Indexed_sweep_accessor
|
||||
{
|
||||
const Arr1& arr1;
|
||||
const Arr2& arr2;
|
||||
mutable std::vector<void*> backup_inc;
|
||||
|
||||
public:
|
||||
|
||||
Indexed_sweep_accessor (const Arr1& arr1, const Arr2& arr2)
|
||||
: arr1(arr1), arr2(arr2) { }
|
||||
|
||||
std::size_t nb_vertices() const
|
||||
{
|
||||
return arr1.number_of_vertices() + arr2.number_of_vertices();
|
||||
}
|
||||
|
||||
std::size_t min_end_index (const Curve& c) const
|
||||
{
|
||||
if (c.red_halfedge_handle() != typename Curve::HH_red())
|
||||
return reinterpret_cast<std::size_t>(c.red_halfedge_handle()->target()->inc());
|
||||
// else
|
||||
CGAL_assertion (c.blue_halfedge_handle() != typename Curve::HH_blue());
|
||||
return reinterpret_cast<std::size_t>(c.blue_halfedge_handle()->target()->inc());
|
||||
}
|
||||
|
||||
std::size_t max_end_index (const Curve& c) const
|
||||
{
|
||||
if (c.red_halfedge_handle() != typename Curve::HH_red())
|
||||
return reinterpret_cast<std::size_t>(c.red_halfedge_handle()->source()->inc());
|
||||
// else
|
||||
CGAL_assertion (c.blue_halfedge_handle() != typename Curve::HH_blue());
|
||||
return reinterpret_cast<std::size_t>(c.blue_halfedge_handle()->source()->inc());
|
||||
}
|
||||
|
||||
const Curve& curve (const Curve& c) const
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
// Initializes indices by squatting Vertex::inc();
|
||||
void before_init() const
|
||||
{
|
||||
std::size_t idx = 0;
|
||||
backup_inc.resize (nb_vertices());
|
||||
for (typename Arr1::Vertex_const_iterator vit = arr1.vertices_begin();
|
||||
vit != arr1.vertices_end(); ++vit, ++idx)
|
||||
{
|
||||
CGAL_assertion (idx < backup_inc.size());
|
||||
backup_inc[idx] = vit->inc();
|
||||
vit->set_inc (reinterpret_cast<void*>(idx));
|
||||
}
|
||||
for (typename Arr2::Vertex_const_iterator vit = arr2.vertices_begin();
|
||||
vit != arr2.vertices_end(); ++vit, ++idx)
|
||||
{
|
||||
CGAL_assertion (idx < backup_inc.size());
|
||||
backup_inc[idx] = vit->inc();
|
||||
vit->set_inc (reinterpret_cast<void*>(idx));
|
||||
}
|
||||
}
|
||||
|
||||
// Restores state of arrangements before index squatting
|
||||
void after_init() const
|
||||
{
|
||||
std::size_t idx = 0;
|
||||
for (typename Arr1::Vertex_const_iterator vit = arr1.vertices_begin();
|
||||
vit != arr1.vertices_end(); ++vit, ++idx)
|
||||
{
|
||||
CGAL_assertion (idx < backup_inc.size());
|
||||
vit->set_inc (backup_inc[idx]);
|
||||
}
|
||||
for (typename Arr2::Vertex_const_iterator vit = arr2.vertices_begin();
|
||||
vit != arr2.vertices_end(); ++vit, ++idx)
|
||||
{
|
||||
CGAL_assertion (idx < backup_inc.size());
|
||||
vit->set_inc (backup_inc[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
/*! Compute the overlay of two input arrangements.
|
||||
* \tparam GeometryTraitsA_2 the geometry traits of the first arrangement.
|
||||
* \tparam GeometryTraitsB_2 the geometry traits of the second arrangement.
|
||||
|
|
@ -183,7 +266,14 @@ overlay(const Arrangement_on_surface_2<GeometryTraitsA_2, TopologyTraitsA>& arr1
|
|||
if (total_iso_verts == 0) {
|
||||
// Clear the result arrangement and perform the sweep to construct it.
|
||||
arr.clear();
|
||||
surface_sweep.sweep(xcvs_vec.begin(), xcvs_vec.end());
|
||||
if (std::is_same<typename Agt2::Bottom_side_category,
|
||||
Arr_contracted_side_tag>::value)
|
||||
surface_sweep.sweep (xcvs_vec.begin(), xcvs_vec.end());
|
||||
else
|
||||
surface_sweep.indexed_sweep (xcvs_vec,
|
||||
Indexed_sweep_accessor
|
||||
<Arr_a, Arr_b, Ovl_x_monotone_curve_2>
|
||||
(arr1, arr2));
|
||||
xcvs_vec.clear();
|
||||
return;
|
||||
}
|
||||
|
|
@ -215,8 +305,16 @@ overlay(const Arrangement_on_surface_2<GeometryTraitsA_2, TopologyTraitsA>& arr1
|
|||
|
||||
// Clear the result arrangement and perform the sweep to construct it.
|
||||
arr.clear();
|
||||
surface_sweep.sweep(xcvs_vec.begin(), xcvs_vec.end(),
|
||||
pts_vec.begin(), pts_vec.end());
|
||||
if (std::is_same<typename Agt2::Bottom_side_category,
|
||||
Arr_contracted_side_tag>::value)
|
||||
surface_sweep.sweep(xcvs_vec.begin(), xcvs_vec.end(),
|
||||
pts_vec.begin(), pts_vec.end());
|
||||
else
|
||||
surface_sweep.indexed_sweep (xcvs_vec,
|
||||
Indexed_sweep_accessor
|
||||
<Arr_a, Arr_b, Ovl_x_monotone_curve_2>
|
||||
(arr1, arr2),
|
||||
pts_vec.begin(), pts_vec.end());
|
||||
xcvs_vec.clear();
|
||||
pts_vec.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -716,14 +716,19 @@ public:
|
|||
Comparison_result dir1 = cmp_seg_endpts(cv1[0]);
|
||||
Comparison_result dir2 = cmp_seg_endpts(cv2[0]);
|
||||
|
||||
std::vector<X_monotone_subcurve_2> ocv; // Used to represent overlaps.
|
||||
const bool invert_ocv = ((dir1 == LARGER) && (dir2 == LARGER));
|
||||
const bool consistent = (dir1 == dir2);
|
||||
#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
|
||||
CGAL_assertion(consistent);
|
||||
#endif
|
||||
|
||||
const std::size_t n1 = cv1.number_of_subcurves();
|
||||
const std::size_t n2 = cv2.number_of_subcurves();
|
||||
|
||||
std::size_t i1 = (dir1 == SMALLER) ? 0 : n1-1;
|
||||
std::size_t i2 = (dir2 == SMALLER) ? 0 : n2-1;
|
||||
|
||||
X_monotone_curve_2 ocv; // Used to represent overlaps.
|
||||
|
||||
auto compare_xy = m_poly_traits.compare_xy_2_object();
|
||||
Comparison_result left_res =
|
||||
compare_xy(cv1[i1], ARR_MIN_END, cv2[i2], ARR_MIN_END);
|
||||
|
|
@ -825,8 +830,7 @@ public:
|
|||
boost::get<X_monotone_subcurve_2>(&xection);
|
||||
if (subcv_p != nullptr) {
|
||||
ocv.push_back(*subcv_p);
|
||||
*oi++ = Intersection_result(ocv);
|
||||
ocv.clear();
|
||||
oi = output_ocv (ocv, invert_ocv, oi);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -848,10 +852,16 @@ public:
|
|||
boost::get<X_monotone_subcurve_2>(&item);
|
||||
if (x_seg != nullptr) {
|
||||
X_monotone_subcurve_2 seg = *x_seg;
|
||||
|
||||
// If for some reason the subcurve intersection
|
||||
// results in left oriented curve.
|
||||
if (cmp_seg_endpts(seg) == LARGER) seg = construct_opposite(seg);
|
||||
// We maintain the variant that if the input curves have opposite
|
||||
// directions (! consistent), the overalpping curves are directed
|
||||
// left=>right. This, however, is not guaranteed for the
|
||||
// subcurves. Therefore, we need to enforce it. That is, we make
|
||||
// sure the subcurves are also directed left=>right in this case.
|
||||
if (! consistent && (cmp_seg_endpts(seg) == LARGER))
|
||||
seg = construct_opposite(seg);
|
||||
#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
|
||||
CGAL_assertion(cmp_seg_endpts(seg) == SMALLER);
|
||||
#endif
|
||||
ocv.push_back(seg);
|
||||
}
|
||||
|
||||
|
|
@ -876,9 +886,8 @@ public:
|
|||
if (left_overlap) {
|
||||
// An overlap occurred at the previous iteration:
|
||||
// Output the overlapping polycurve.
|
||||
CGAL_assertion(ocv.number_of_subcurves() > 0);
|
||||
*oi++ = Intersection_result(ocv);
|
||||
ocv.clear();
|
||||
CGAL_assertion(ocv.size() > 0);
|
||||
oi = output_ocv (ocv, invert_ocv, oi);
|
||||
}
|
||||
else {
|
||||
// The left point of the current subcurve of one
|
||||
|
|
@ -923,8 +932,8 @@ public:
|
|||
} // END of while loop
|
||||
|
||||
// Output the remaining overlapping polycurve, if necessary.
|
||||
if (ocv.number_of_subcurves() > 0) {
|
||||
*oi++ = Intersection_result(ocv);
|
||||
if (ocv.size() > 0) {
|
||||
oi = output_ocv (ocv, invert_ocv, oi);
|
||||
}
|
||||
else if (right_coincides) {
|
||||
typedef std::pair<Point_2,Multiplicity> return_point;
|
||||
|
|
@ -974,6 +983,27 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
return oi;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template <typename OutputIterator>
|
||||
inline OutputIterator output_ocv
|
||||
(std::vector<X_monotone_subcurve_2>& ocv, bool invert_ocv, OutputIterator oi) const
|
||||
{
|
||||
typedef std::pair<Point_2, Multiplicity> Intersection_point;
|
||||
typedef boost::variant<Intersection_point, X_monotone_curve_2>
|
||||
Intersection_result;
|
||||
X_monotone_curve_2 curve;
|
||||
if (invert_ocv)
|
||||
std::reverse (ocv.begin(), ocv.end());
|
||||
for (X_monotone_subcurve_2& sc : ocv)
|
||||
curve.push_back (sc);
|
||||
*(oi ++) = Intersection_result(curve);
|
||||
|
||||
ocv.clear();
|
||||
|
||||
return oi;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -82,12 +82,13 @@ public:
|
|||
typedef typename Kernel::Point_2 Point_2;
|
||||
|
||||
protected:
|
||||
Line_2 m_l; // the line that supports the segment.
|
||||
Point_2 m_ps; // the source point of the segment.
|
||||
Point_2 m_pt; // the target point of the segment.
|
||||
bool m_is_directed_right; // is (lexicographically) directed left to right.
|
||||
bool m_is_vert; // is this a vertical segment.
|
||||
bool m_is_degen; // is the segment degenerate (a single point).
|
||||
mutable Line_2 m_l; // the line that supports the segment.
|
||||
Point_2 m_ps; // the source point of the segment.
|
||||
Point_2 m_pt; // the target point of the segment.
|
||||
bool m_is_directed_right; // is (lexicographically) directed left to right.
|
||||
mutable bool m_is_vert; // is this a vertical segment.
|
||||
mutable bool m_is_computed; // is the support line computed.
|
||||
bool m_is_degen; // is the segment degenerate (a single point).
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1170,13 +1171,16 @@ template <typename Kernel>
|
|||
Arr_segment_traits_2<Kernel>::_Segment_cached_2::_Segment_cached_2() :
|
||||
m_is_directed_right(false),
|
||||
m_is_vert(false),
|
||||
m_is_computed(false),
|
||||
m_is_degen(true)
|
||||
{}
|
||||
|
||||
//! \brief constructs a segment from a Kernel segment.
|
||||
template <typename Kernel>
|
||||
Arr_segment_traits_2<Kernel>::
|
||||
_Segment_cached_2::_Segment_cached_2(const Segment_2& seg)
|
||||
_Segment_cached_2::_Segment_cached_2(const Segment_2& seg) :
|
||||
m_is_vert(false),
|
||||
m_is_computed(false)
|
||||
{
|
||||
Kernel kernel;
|
||||
auto vertex_ctr = kernel.construct_vertex_2_object();
|
||||
|
|
@ -1189,9 +1193,6 @@ _Segment_cached_2::_Segment_cached_2(const Segment_2& seg)
|
|||
m_is_directed_right = (res == SMALLER);
|
||||
|
||||
CGAL_precondition_msg(! m_is_degen, "Cannot construct a degenerate segment.");
|
||||
|
||||
m_l = kernel.construct_line_2_object()(seg);
|
||||
m_is_vert = kernel.is_vertical_2_object()(seg);
|
||||
}
|
||||
|
||||
//! \brief Constructs a segment from two endpoints.
|
||||
|
|
@ -1200,7 +1201,9 @@ Arr_segment_traits_2<Kernel>::
|
|||
_Segment_cached_2::_Segment_cached_2(const Point_2& source,
|
||||
const Point_2& target) :
|
||||
m_ps(source),
|
||||
m_pt(target)
|
||||
m_pt(target),
|
||||
m_is_vert(false),
|
||||
m_is_computed(false)
|
||||
{
|
||||
Kernel kernel;
|
||||
|
||||
|
|
@ -1209,9 +1212,6 @@ _Segment_cached_2::_Segment_cached_2(const Point_2& source,
|
|||
m_is_directed_right = (res == SMALLER);
|
||||
|
||||
CGAL_precondition_msg(! m_is_degen, "Cannot construct a degenerate segment.");
|
||||
|
||||
m_l = kernel.construct_line_2_object()(source, target);
|
||||
m_is_vert = kernel.is_vertical_2_object()(m_l);
|
||||
}
|
||||
|
||||
//! \brief constructs a segment from two endpoints on a supporting line.
|
||||
|
|
@ -1233,6 +1233,7 @@ _Segment_cached_2::_Segment_cached_2(const Line_2& line,
|
|||
Has_exact_division()));
|
||||
|
||||
m_is_vert = kernel.is_vertical_2_object()(m_l);
|
||||
m_is_computed = true;
|
||||
|
||||
Comparison_result res = kernel.compare_xy_2_object()(m_ps, m_pt);
|
||||
m_is_degen = (res == EQUAL);
|
||||
|
|
@ -1252,6 +1253,7 @@ _Segment_cached_2(const Line_2& line,
|
|||
m_pt(target),
|
||||
m_is_directed_right(is_directed_right),
|
||||
m_is_vert(is_vert),
|
||||
m_is_computed(true),
|
||||
m_is_degen(is_degen)
|
||||
{}
|
||||
|
||||
|
|
@ -1274,6 +1276,7 @@ Arr_segment_traits_2<Kernel>::_Segment_cached_2::operator=(const Segment_2& seg)
|
|||
|
||||
m_l = kernel.construct_line_2_object()(seg);
|
||||
m_is_vert = kernel.is_vertical_2_object()(seg);
|
||||
m_is_computed = true;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
|
@ -1283,12 +1286,26 @@ Arr_segment_traits_2<Kernel>::_Segment_cached_2::operator=(const Segment_2& seg)
|
|||
//! \brief obtains the supporting line.
|
||||
template <typename Kernel>
|
||||
const typename Kernel::Line_2&
|
||||
Arr_segment_traits_2<Kernel>::_Segment_cached_2::line() const { return m_l; }
|
||||
Arr_segment_traits_2<Kernel>::_Segment_cached_2::line() const
|
||||
{
|
||||
if (!m_is_computed) {
|
||||
Kernel kernel;
|
||||
m_l = kernel.construct_line_2_object()(m_ps, m_pt);
|
||||
m_is_vert = kernel.is_vertical_2_object()(m_l);
|
||||
m_is_computed = true;
|
||||
}
|
||||
return m_l;
|
||||
}
|
||||
|
||||
//! \brief determines whether the curve is vertical.
|
||||
template <typename Kernel>
|
||||
bool Arr_segment_traits_2<Kernel>::_Segment_cached_2::is_vertical() const
|
||||
{ return m_is_vert; }
|
||||
{
|
||||
// Force computation of line is orientation is still unknown
|
||||
if (! m_is_computed) line();
|
||||
CGAL_precondition(!m_is_degen);
|
||||
return m_is_vert;
|
||||
}
|
||||
|
||||
//! \brief determines whether the curve is degenerate.
|
||||
template <typename Kernel>
|
||||
|
|
@ -1447,12 +1464,7 @@ public:
|
|||
|
||||
/*! Create a bounding box for the segment.
|
||||
*/
|
||||
Bbox_2 bbox() const
|
||||
{
|
||||
Kernel kernel;
|
||||
auto construct_bbox = kernel.construct_bbox_2_object();
|
||||
return construct_bbox(this->m_ps) + construct_bbox(this->m_pt);
|
||||
}
|
||||
Bbox_2 bbox() const;
|
||||
};
|
||||
|
||||
//! \brief constructs default.
|
||||
|
|
@ -1506,6 +1518,15 @@ Arr_segment_2<Kernel> Arr_segment_2<Kernel>::flip() const
|
|||
this->is_degenerate());
|
||||
}
|
||||
|
||||
//! \brief creates a bounding box for the segment.
|
||||
template <typename Kernel>
|
||||
Bbox_2 Arr_segment_2<Kernel>::bbox() const
|
||||
{
|
||||
Kernel kernel;
|
||||
auto construct_bbox = kernel.construct_bbox_2_object();
|
||||
return construct_bbox(this->m_ps) + construct_bbox(this->m_pt);
|
||||
}
|
||||
|
||||
/*! Exporter for the segment class used by the traits-class.
|
||||
*/
|
||||
template <typename Kernel, typename OutputStream>
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ public:
|
|||
class Ex_x_monotone_curve_2 {
|
||||
public:
|
||||
typedef Base_x_monotone_curve_2 Base;
|
||||
typedef Halfedge_handle_red HH_red;
|
||||
typedef Halfedge_handle_blue HH_blue;
|
||||
|
||||
protected:
|
||||
Base m_base_xcv; // The base curve.
|
||||
|
|
|
|||
|
|
@ -1,35 +1,28 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( Arrangement_on_surface_2_Tests )
|
||||
project(Arrangement_on_surface_2_Tests)
|
||||
|
||||
enable_testing()
|
||||
|
||||
find_package(CGAL REQUIRED COMPONENTS Core)
|
||||
|
||||
find_package(CGAL QUIET COMPONENTS Core)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
if(COMMAND target_compile_options)
|
||||
# Since CMake-2.8.12: New CMake script, that defines the targets and
|
||||
# the CTest test cases.
|
||||
include( ${CMAKE_CURRENT_SOURCE_DIR}/cgal_test.cmake )
|
||||
else()
|
||||
# If CMake version is <= 2.8.11, use the usual CMake script.
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
endif()
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
if(COMMAND target_compile_options)
|
||||
# Since CMake-2.8.12: New CMake script, that defines the targets and
|
||||
# the CTest test cases.
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cgal_test.cmake)
|
||||
else()
|
||||
# If CMake version is <= 2.8.11, use the usual CMake script.
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -911,7 +911,7 @@ function(test_polycurve_conic_traits)
|
|||
compile_test_with_flags(test_traits conic_polycurve "${flags}")
|
||||
|
||||
# The input arguments for the execute_commands_new_structure,
|
||||
# 1. Polycurve_conics is the directory name in "data"
|
||||
# 1. polycurve_conics is the directory name in "data"
|
||||
# 2. polycurve_conic_traits is a string
|
||||
# Execute_command_new_structure will only run the test on functors provided as the third, fourth and so on arguments.
|
||||
# To see how the input data directory should be structured for each functor, check the execute_commands_new_structure function in this file.
|
||||
|
|
@ -947,7 +947,7 @@ function(test_polycurve_circular_arc_traits)
|
|||
|
||||
compile_test_with_flags(test_traits circular_arc_polycurve "${flags}")
|
||||
|
||||
execute_commands_new_structure(Polycurves_circular_arcs polycurve_circular_arc_traits
|
||||
execute_commands_new_structure(polycurves_circular_arcs polycurve_circular_arc_traits
|
||||
COMPARE_Y_AT_X
|
||||
EQUAL
|
||||
IS_VERTICAL
|
||||
|
|
@ -981,7 +981,7 @@ function(test_polycurve_bezier_traits)
|
|||
|
||||
compile_test_with_flags(test_traits bezier_polycurve "${flags}")
|
||||
|
||||
execute_commands_new_structure(Polycurves_bezier test_polycurve_bezier_traits
|
||||
execute_commands_new_structure(polycurves_bezier test_polycurve_bezier_traits
|
||||
MERGE
|
||||
EQUAL
|
||||
IS_VERTICAL
|
||||
|
|
@ -1422,3 +1422,5 @@ compile_and_run(test_spherical_removal)
|
|||
compile_and_run(test_io)
|
||||
|
||||
compile_and_run(test_sgm)
|
||||
|
||||
compile_and_run(test_polycurve_intersection)
|
||||
|
|
|
|||
|
|
@ -1127,7 +1127,7 @@ test_polycurve_conic_traits()
|
|||
if [ -n "${SUCCESS}" ] ; then
|
||||
|
||||
# The input arguments for the execute_commands_new_structure,
|
||||
# 1. Polycurve_conics is the directory name in "data"
|
||||
# 1. polycurve_conics is the directory name in "data"
|
||||
# 2. polycurve_conic_traits is a string
|
||||
# Execute_command_new_structure will only run the test on functors provided as the third, fourth and so on arguments.
|
||||
# To see how the input data directory should be structured for each functor, check the execute_commands_new_structure function in this file.
|
||||
|
|
@ -1168,7 +1168,7 @@ test_polycurve_circular_arc_traits()
|
|||
|
||||
compile_test_with_flags test_traits circular_arc_polycurve "$flags"
|
||||
if [ -n "${SUCCESS}" ] ; then
|
||||
execute_commands_new_structure Polycurves_circular_arcs polycurve_circular_arc_traits \
|
||||
execute_commands_new_structure polycurves_circular_arcs polycurve_circular_arc_traits \
|
||||
COMPARE_Y_AT_X \
|
||||
EQUAL \
|
||||
IS_VERTICAL \
|
||||
|
|
@ -1208,7 +1208,7 @@ test_polycurve_bezier_traits()
|
|||
|
||||
compile_test_with_flags test_traits bezier_polycurve "$flags"
|
||||
if [ -n "${SUCCESS}" ] ; then
|
||||
execute_commands_new_structure Polycurves_bezier test_polycurve_bezier_traits \
|
||||
execute_commands_new_structure polycurves_bezier test_polycurve_bezier_traits \
|
||||
MERGE \
|
||||
EQUAL \
|
||||
IS_VERTICAL \
|
||||
|
|
@ -1751,6 +1751,8 @@ compile_and_run test_io
|
|||
|
||||
compile_and_run test_sgm
|
||||
|
||||
compile_and_run test_polycurve_intersection
|
||||
|
||||
# if any error occurred then append the full error description file to error file
|
||||
|
||||
if [ -f $FULL_ERROR_DESCRIPTION_FILE ] ; then
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Arr_segment_traits_2.h>
|
||||
#include <CGAL/Arr_polyline_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
#include <boost/function_output_iterator.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Segment_traits_2;
|
||||
typedef CGAL::Arr_polyline_traits_2<Segment_traits_2> Geom_traits_2;
|
||||
|
||||
typedef Geom_traits_2::Point_2 Point_2;
|
||||
typedef Geom_traits_2::Segment_2 Segment_2;
|
||||
typedef Geom_traits_2::Curve_2 Polyline_2;
|
||||
typedef CGAL::Arrangement_2<Geom_traits_2> Arrangement_2;
|
||||
typedef Geom_traits_2::X_monotone_curve_2 X_monotone_polyline;
|
||||
typedef Geom_traits_2::X_monotone_subcurve_2 X_monotone_subcurve;
|
||||
|
||||
struct Test_functor
|
||||
{
|
||||
const X_monotone_polyline* reference;
|
||||
|
||||
Test_functor (const X_monotone_polyline& reference)
|
||||
: reference (&reference) { }
|
||||
|
||||
void operator() (const CGAL::Object& obj) const
|
||||
{
|
||||
const X_monotone_polyline* poly
|
||||
= CGAL::object_cast<X_monotone_polyline>(&obj);
|
||||
CGAL_assertion_msg (poly != nullptr, "Intersection is not a polyline");
|
||||
|
||||
typename X_monotone_polyline::Point_const_iterator
|
||||
itref = reference->points_begin(),
|
||||
itpoly = poly->points_begin();
|
||||
|
||||
for (; itref != reference->points_end()
|
||||
&& itpoly != poly->points_end();
|
||||
++ itref, ++ itpoly)
|
||||
CGAL_assertion (*itref == *itpoly);
|
||||
}
|
||||
};
|
||||
|
||||
void test (const X_monotone_polyline& a, const X_monotone_polyline& b,
|
||||
const X_monotone_polyline& reference)
|
||||
{
|
||||
Geom_traits_2 traits;
|
||||
Geom_traits_2::Intersect_2 intersect_2 =
|
||||
traits.intersect_2_object();
|
||||
|
||||
std::cerr << " * Polyline A = " << a << std::endl
|
||||
<< " * Polyline B = " << b << std::endl;
|
||||
|
||||
intersect_2
|
||||
(a, b, boost::make_function_output_iterator (Test_functor(reference)));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Geom_traits_2 traits;
|
||||
Arrangement_2 arr(&traits);
|
||||
|
||||
Geom_traits_2::Construct_x_monotone_curve_2 x_mono_polyline_construct =
|
||||
traits.construct_x_monotone_curve_2_object();
|
||||
|
||||
std::array<Segment_2, 2> r2l
|
||||
= { Segment_2(Point_2(1, 0), Point_2(0, 1)),
|
||||
Segment_2(Point_2(0, 1), Point_2(-1, 0)) };
|
||||
|
||||
std::array<Segment_2, 2> l2r
|
||||
= { Segment_2(Point_2(-1, 0), Point_2(0, 1)),
|
||||
Segment_2(Point_2(0, 1), Point_2(1, 0)), };
|
||||
|
||||
X_monotone_polyline p0l2r
|
||||
= x_mono_polyline_construct (l2r.begin(), l2r.end());
|
||||
X_monotone_polyline p1l2r
|
||||
= x_mono_polyline_construct (l2r.begin(), l2r.end());
|
||||
X_monotone_polyline p0r2l
|
||||
= x_mono_polyline_construct (r2l.begin(), r2l.end());
|
||||
X_monotone_polyline p1r2l
|
||||
= x_mono_polyline_construct (r2l.begin(), r2l.end());
|
||||
|
||||
std::cerr << "Testing intersection left-to-right / left-to-right" << std::endl;
|
||||
test (p0l2r, p1l2r, p0l2r);
|
||||
std::cerr << "Testing intersection left-to-right / right-to-left" << std::endl;
|
||||
test (p0l2r, p1r2l, p0l2r);
|
||||
std::cerr << "Testing intersection right-to-left / left-to-right" << std::endl;
|
||||
test (p0r2l, p1l2r, p0l2r);
|
||||
std::cerr << "Testing intersection right-to-left / right-to-left" << std::endl;
|
||||
test (p0r2l, p1r2l, p0r2l);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ A face descriptor must be `DefaultConstructible`, `Assignable`, `EqualityCompara
|
|||
\sa \link PkgBGLConcepts Graph Concepts \endlink
|
||||
*/
|
||||
class FaceGraph {
|
||||
/// Returns a special `boost::graph_traits<HalfedgeGraph>::face_descriptor` object which
|
||||
/// Returns a special `boost::graph_traits<HalfedgeGraph>::%face_descriptor` object which
|
||||
/// does not refer to any face of graph object which type is `FaceGraph`.
|
||||
static boost::graph_traits<HalfedgeGraph>::halfedge_descriptor null_face();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ A model of `HalfedgeGraph` must have the interior property `vertex_point` attach
|
|||
\sa \link PkgBGLConcepts Graph Concepts \endlink
|
||||
*/
|
||||
class HalfedgeGraph {
|
||||
/// Returns a special `boost::graph_traits<HalfedgeGraph>::halfedge_descriptor` object which
|
||||
/// Returns a special `boost::graph_traits<HalfedgeGraph>::%halfedge_descriptor` object which
|
||||
/// does not refer to any halfedge of graph object which type is `HalfedgeGraph`.
|
||||
static boost::graph_traits<HalfedgeGraph>::halfedge_descriptor null_halfedge();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,26 +2,18 @@
|
|||
# This is the CMake script for compiling a set of CGAL applications.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( BGL_LCC_Examples )
|
||||
|
||||
|
||||
project(BGL_LCC_Examples)
|
||||
|
||||
# CGAL and its components
|
||||
find_package( CGAL QUIET COMPONENTS )
|
||||
|
||||
if ( NOT CGAL_FOUND )
|
||||
|
||||
message(STATUS "This project requires the CGAL library, and will not be compiled.")
|
||||
return()
|
||||
|
||||
endif()
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
# Boost and its components
|
||||
find_package( Boost REQUIRED )
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
if ( NOT Boost_FOUND )
|
||||
if(NOT Boost_FOUND)
|
||||
|
||||
message(STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
message(
|
||||
STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
|
||||
return()
|
||||
|
||||
|
|
@ -33,7 +25,10 @@ endif()
|
|||
# ##########################################################
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB_RECURSE cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
||||
file(
|
||||
GLOB_RECURSE cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -2,38 +2,31 @@
|
|||
# This is the CMake script for compiling a set of CGAL applications.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( BGL_OpenMesh_Examples )
|
||||
|
||||
|
||||
project(BGL_OpenMesh_Examples)
|
||||
|
||||
# CGAL and its components
|
||||
find_package( CGAL QUIET COMPONENTS )
|
||||
|
||||
if ( NOT CGAL_FOUND )
|
||||
|
||||
message(STATUS "This project requires the CGAL library, and will not be compiled.")
|
||||
return()
|
||||
|
||||
endif()
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
# Boost and its components
|
||||
find_package( Boost REQUIRED )
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
if ( NOT Boost_FOUND )
|
||||
if(NOT Boost_FOUND)
|
||||
|
||||
message(STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
message(
|
||||
STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
||||
find_package( OpenMesh QUIET )
|
||||
find_package(OpenMesh QUIET)
|
||||
|
||||
if ( OpenMesh_FOUND )
|
||||
include( UseOpenMesh )
|
||||
if(OpenMesh_FOUND)
|
||||
include(UseOpenMesh)
|
||||
else()
|
||||
|
||||
message(STATUS "NOTICE: These examples require OpenMesh and will not be compiled.")
|
||||
message(
|
||||
STATUS "NOTICE: These examples require OpenMesh and will not be compiled.")
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
|
@ -46,7 +39,6 @@ endif()
|
|||
# ##########################################################
|
||||
|
||||
if(OpenMesh_FOUND)
|
||||
create_single_source_cgal_program( "TriMesh.cpp" )
|
||||
target_link_libraries( TriMesh PRIVATE ${OPENMESH_LIBRARIES} )
|
||||
create_single_source_cgal_program("TriMesh.cpp")
|
||||
target_link_libraries(TriMesh PRIVATE ${OPENMESH_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,13 @@
|
|||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( BGL_arrangement_2_Examples )
|
||||
project(BGL_arrangement_2_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -3,26 +3,18 @@
|
|||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
|
||||
project( BGL_graphcut_Examples )
|
||||
|
||||
project(BGL_graphcut_Examples)
|
||||
|
||||
# CGAL and its components
|
||||
find_package( CGAL QUIET COMPONENTS )
|
||||
|
||||
if ( NOT CGAL_FOUND )
|
||||
|
||||
message(STATUS "This project requires the CGAL library, and will not be compiled.")
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
# Boost and its components
|
||||
find_package( Boost REQUIRED )
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
if ( NOT Boost_FOUND )
|
||||
if(NOT Boost_FOUND)
|
||||
|
||||
message(STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
message(
|
||||
STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
|
||||
return()
|
||||
|
||||
|
|
@ -32,12 +24,9 @@ endif()
|
|||
|
||||
# include for local package
|
||||
|
||||
|
||||
# Creating entries for all C++ files with "main" routine
|
||||
# ##########################################################
|
||||
|
||||
|
||||
create_single_source_cgal_program( "alpha_expansion_example.cpp" )
|
||||
create_single_source_cgal_program( "face_selection_borders_regularization_example.cpp" )
|
||||
|
||||
|
||||
create_single_source_cgal_program("alpha_expansion_example.cpp")
|
||||
create_single_source_cgal_program(
|
||||
"face_selection_borders_regularization_example.cpp")
|
||||
|
|
|
|||
|
|
@ -2,46 +2,38 @@
|
|||
# This is the CMake script for compiling a set of CGAL applications.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( BGL_polyhedron_3_Examples )
|
||||
|
||||
|
||||
project(BGL_polyhedron_3_Examples)
|
||||
|
||||
# CGAL and its components
|
||||
find_package( CGAL QUIET COMPONENTS )
|
||||
|
||||
if ( NOT CGAL_FOUND )
|
||||
|
||||
message(STATUS "This project requires the CGAL library, and will not be compiled.")
|
||||
return()
|
||||
|
||||
endif()
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
# Boost and its components
|
||||
find_package( Boost REQUIRED )
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
if ( NOT Boost_FOUND )
|
||||
if(NOT Boost_FOUND)
|
||||
|
||||
message(STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
message(
|
||||
STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
||||
find_package( OpenMesh QUIET )
|
||||
find_package(OpenMesh QUIET)
|
||||
|
||||
if ( OpenMesh_FOUND )
|
||||
include( UseOpenMesh )
|
||||
add_definitions( -DCGAL_USE_OPENMESH )
|
||||
if(OpenMesh_FOUND)
|
||||
include(UseOpenMesh)
|
||||
add_definitions(-DCGAL_USE_OPENMESH)
|
||||
else()
|
||||
message(STATUS "Examples that use OpenMesh will not be compiled.")
|
||||
endif()
|
||||
|
||||
find_package( METIS )
|
||||
find_package(METIS)
|
||||
|
||||
if( METIS_FOUND )
|
||||
include_directories(${METIS_INCLUDE_DIRS} )
|
||||
if(METIS_FOUND)
|
||||
include_directories(${METIS_INCLUDE_DIRS})
|
||||
else()
|
||||
message( STATUS "Examples that use the METIS library will not be compiled." )
|
||||
message(STATUS "Examples that use the METIS library will not be compiled.")
|
||||
endif()
|
||||
|
||||
# include for local directory
|
||||
|
|
@ -51,28 +43,27 @@ endif()
|
|||
# Creating entries for all C++ files with "main" routine
|
||||
# ##########################################################
|
||||
|
||||
create_single_source_cgal_program( "distance.cpp" )
|
||||
create_single_source_cgal_program("distance.cpp")
|
||||
|
||||
create_single_source_cgal_program( "incident_vertices.cpp" )
|
||||
create_single_source_cgal_program("incident_vertices.cpp")
|
||||
|
||||
create_single_source_cgal_program( "kruskal.cpp" )
|
||||
create_single_source_cgal_program("kruskal.cpp")
|
||||
|
||||
create_single_source_cgal_program( "kruskal_with_stored_id.cpp" )
|
||||
create_single_source_cgal_program("kruskal_with_stored_id.cpp")
|
||||
|
||||
create_single_source_cgal_program( "normals.cpp" )
|
||||
create_single_source_cgal_program("normals.cpp")
|
||||
|
||||
create_single_source_cgal_program( "range.cpp" )
|
||||
create_single_source_cgal_program("range.cpp")
|
||||
|
||||
create_single_source_cgal_program( "transform_iterator.cpp" )
|
||||
create_single_source_cgal_program("transform_iterator.cpp")
|
||||
|
||||
create_single_source_cgal_program( "copy_polyhedron.cpp" )
|
||||
create_single_source_cgal_program("copy_polyhedron.cpp")
|
||||
|
||||
if(OpenMesh_FOUND)
|
||||
target_link_libraries( copy_polyhedron PRIVATE ${OPENMESH_LIBRARIES} )
|
||||
target_link_libraries(copy_polyhedron PRIVATE ${OPENMESH_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if( METIS_FOUND )
|
||||
create_single_source_cgal_program( "polyhedron_partition.cpp" )
|
||||
target_link_libraries( polyhedron_partition PRIVATE ${METIS_LIBRARIES} )
|
||||
if(METIS_FOUND)
|
||||
create_single_source_cgal_program("polyhedron_partition.cpp")
|
||||
target_link_libraries(polyhedron_partition PRIVATE ${METIS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +1,24 @@
|
|||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( BGL_surface_mesh_Examples )
|
||||
project(BGL_surface_mesh_Examples)
|
||||
|
||||
|
||||
find_package( CGAL QUIET )
|
||||
|
||||
if ( NOT CGAL_FOUND )
|
||||
message( STATUS "This project requires the CGAL library, and will not be compiled." )
|
||||
return()
|
||||
endif()
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
# include for local package
|
||||
|
||||
create_single_source_cgal_program( "prim.cpp" )
|
||||
create_single_source_cgal_program( "gwdwg.cpp" )
|
||||
create_single_source_cgal_program( "seam_mesh.cpp" )
|
||||
create_single_source_cgal_program( "write_inp.cpp" )
|
||||
create_single_source_cgal_program( "surface_mesh_dual.cpp" )
|
||||
create_single_source_cgal_program( "connected_components.cpp" )
|
||||
create_single_source_cgal_program("prim.cpp")
|
||||
create_single_source_cgal_program("gwdwg.cpp")
|
||||
create_single_source_cgal_program("seam_mesh.cpp")
|
||||
create_single_source_cgal_program("write_inp.cpp")
|
||||
create_single_source_cgal_program("surface_mesh_dual.cpp")
|
||||
create_single_source_cgal_program("connected_components.cpp")
|
||||
|
||||
find_package( METIS )
|
||||
find_package(METIS)
|
||||
|
||||
if( METIS_FOUND )
|
||||
include_directories(${METIS_INCLUDE_DIRS} )
|
||||
if(METIS_FOUND)
|
||||
include_directories(${METIS_INCLUDE_DIRS})
|
||||
|
||||
create_single_source_cgal_program( "surface_mesh_partition.cpp" )
|
||||
target_link_libraries( surface_mesh_partition PRIVATE ${METIS_LIBRARIES} )
|
||||
create_single_source_cgal_program("surface_mesh_partition.cpp")
|
||||
target_link_libraries(surface_mesh_partition PRIVATE ${METIS_LIBRARIES})
|
||||
else()
|
||||
message( STATUS "Examples that use the METIS library will not be compiled." )
|
||||
message(STATUS "Examples that use the METIS library will not be compiled.")
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,13 @@
|
|||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
project( BGL_triangulation_2_Examples )
|
||||
project(BGL_triangulation_2_Examples)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(
|
||||
GLOB cppfiles
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program("${cppfile}")
|
||||
endforeach()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
namespace CGAL {
|
||||
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
|
||||
template <typename HD>
|
||||
class Seam_mesh_halfedge_descriptor
|
||||
{
|
||||
|
|
@ -86,8 +88,92 @@ public:
|
|||
return 2 * hash_value(hd.tmhd) + static_cast<std::size_t>(hd.seam);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename HD>
|
||||
class Seam_mesh_vertex_descriptor
|
||||
{
|
||||
public:
|
||||
Seam_mesh_halfedge_descriptor<HD> hd;
|
||||
|
||||
Seam_mesh_vertex_descriptor() { }
|
||||
|
||||
Seam_mesh_vertex_descriptor(const Seam_mesh_halfedge_descriptor<HD>& h)
|
||||
: hd(h)
|
||||
{ }
|
||||
|
||||
bool operator==(const Seam_mesh_vertex_descriptor& other) const
|
||||
{
|
||||
return (hd == other.hd);
|
||||
}
|
||||
|
||||
bool operator!=(const Seam_mesh_vertex_descriptor& other) const
|
||||
{
|
||||
return (hd != other.hd);
|
||||
}
|
||||
|
||||
bool operator<(const Seam_mesh_vertex_descriptor& other) const
|
||||
{
|
||||
return hd < other.hd;
|
||||
}
|
||||
|
||||
operator HD() const
|
||||
{
|
||||
return hd;
|
||||
}
|
||||
|
||||
#ifdef CGAL_SEAM_MESH_INSERT_OPERATOR
|
||||
friend std::ostream& operator<<(std::ostream& os, const Seam_mesh_vertex_descriptor vd)
|
||||
{
|
||||
os << "seam mesh vertex: " << vd.hd;
|
||||
return os;
|
||||
}
|
||||
#endif
|
||||
|
||||
friend std::size_t hash_value(const Seam_mesh_vertex_descriptor& vd)
|
||||
{
|
||||
return hash_value(vd.hd.tmhd);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename HD, typename SM>
|
||||
class Seam_mesh_edge_descriptor
|
||||
{
|
||||
public:
|
||||
Seam_mesh_halfedge_descriptor<HD> hd;
|
||||
const SM* mesh_;
|
||||
|
||||
Seam_mesh_edge_descriptor() : mesh_(nullptr) { }
|
||||
|
||||
Seam_mesh_edge_descriptor(const Seam_mesh_halfedge_descriptor<HD>& hd, const SM* m)
|
||||
: hd(hd), mesh_(m)
|
||||
{}
|
||||
|
||||
friend bool operator==(Seam_mesh_edge_descriptor e1, Seam_mesh_edge_descriptor e2)
|
||||
{
|
||||
return (e1.hd == e2.hd) || (e1.hd == e2.mesh_->opposite(e2.hd));
|
||||
}
|
||||
|
||||
friend bool operator!=(Seam_mesh_edge_descriptor e1, Seam_mesh_edge_descriptor e2)
|
||||
{
|
||||
return ! (e1 == e2);
|
||||
}
|
||||
|
||||
#ifdef CGAL_SEAM_MESH_INSERT_OPERATOR
|
||||
friend std::ostream& operator<<(std::ostream& os, const Seam_mesh_edge_descriptor& ed)
|
||||
{
|
||||
os << ed.hd;
|
||||
return os;
|
||||
}
|
||||
#endif
|
||||
|
||||
friend std::size_t hash_value(const Seam_mesh_edge_descriptor& ed)
|
||||
{
|
||||
return hash_value((std::min)(ed.hd, ed.mesh_->opposite(ed.hd)));
|
||||
}
|
||||
};
|
||||
|
||||
#endif // DOXYGEN_RUNNING
|
||||
|
||||
/// \ingroup PkgBGLAdaptors
|
||||
///
|
||||
/// This class is a data structure that takes a triangle mesh, further refered
|
||||
|
|
@ -112,6 +198,10 @@ class Seam_mesh
|
|||
typedef Seam_mesh<TM, SEM, SVM> Self;
|
||||
|
||||
public:
|
||||
/// The underlying mesh type
|
||||
typedef TM Triangle_mesh;
|
||||
|
||||
// backward compatibility
|
||||
typedef TM TriangleMesh;
|
||||
|
||||
public:
|
||||
|
|
@ -187,23 +277,15 @@ public:
|
|||
class halfedge_descriptor
|
||||
{
|
||||
public:
|
||||
TM_halfedge_descriptor tmhd;
|
||||
bool seam;
|
||||
|
||||
/// %Default constructor
|
||||
halfedge_descriptor() : tmhd(), seam(false) { }
|
||||
halfedge_descriptor();
|
||||
|
||||
halfedge_descriptor(TM_halfedge_descriptor tmhd, bool seam = false)
|
||||
: tmhd(tmhd), seam(seam)
|
||||
{ }
|
||||
/// Constructor from a halfedge of the underlying mesh
|
||||
halfedge_descriptor(TM_halfedge_descriptor tmhd, bool seam = false);
|
||||
|
||||
#ifdef CGAL_SEAM_MESH_INSERT_OPERATOR
|
||||
/// Print the halfedge and if it is on a seam.
|
||||
friend std::ostream& operator<<(std::ostream& os, const halfedge_descriptor& hd)
|
||||
{
|
||||
os << hd.tmhd << ((hd.seam)?" on seam":"");
|
||||
return os;
|
||||
}
|
||||
friend std::ostream& operator<<(std::ostream& os, const halfedge_descriptor& hd);
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
|
|
@ -265,13 +347,13 @@ public:
|
|||
return halfedge_descriptor(*hd, seam);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#endif // DOXYGEN_RUNNING
|
||||
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
/// This class represents a vertex of the seam mesh.
|
||||
///
|
||||
/// Implementation note: to properly duplicate vertices that are on seams,
|
||||
/// a vertex_descriptor is in fact represented as a halfedge of the underlying
|
||||
/// mesh.
|
||||
/// a vertex_descriptor is in fact represented as a halfedge of the seam mesh.
|
||||
///
|
||||
/// \cgalModels `Descriptor`
|
||||
/// \cgalModels `LessThanComparable`
|
||||
|
|
@ -280,48 +362,20 @@ public:
|
|||
class vertex_descriptor
|
||||
{
|
||||
public:
|
||||
halfedge_descriptor hd;
|
||||
|
||||
/// %Default constructor
|
||||
vertex_descriptor() { }
|
||||
vertex_descriptor();
|
||||
|
||||
vertex_descriptor(const halfedge_descriptor& h)
|
||||
: hd(h)
|
||||
{ }
|
||||
|
||||
bool operator==(const vertex_descriptor& other) const
|
||||
{
|
||||
return (hd == other.hd);
|
||||
}
|
||||
|
||||
bool operator!=(const vertex_descriptor& other) const
|
||||
{
|
||||
return (hd != other.hd);
|
||||
}
|
||||
|
||||
bool operator<(const vertex_descriptor& other) const
|
||||
{
|
||||
return hd < other.hd;
|
||||
}
|
||||
|
||||
operator TM_halfedge_descriptor() const
|
||||
{
|
||||
return hd;
|
||||
}
|
||||
/// Constructor from a seam mesh halfedge
|
||||
vertex_descriptor(const halfedge_descriptor& h);
|
||||
|
||||
#ifdef CGAL_SEAM_MESH_INSERT_OPERATOR
|
||||
friend std::ostream& operator<<(std::ostream& os, const vertex_descriptor vd)
|
||||
{
|
||||
os << "seam mesh vertex: " << vd.hd;
|
||||
return os;
|
||||
}
|
||||
/// Print the seam mesh vertex.
|
||||
friend std::ostream& operator<<(std::ostream& os, const vertex_descriptor vd);
|
||||
#endif
|
||||
|
||||
friend std::size_t hash_value(const vertex_descriptor& vd)
|
||||
{
|
||||
return hash_value(vd.hd.tmhd);
|
||||
}
|
||||
};
|
||||
#else
|
||||
typedef Seam_mesh_vertex_descriptor<TM_halfedge_descriptor> vertex_descriptor;
|
||||
#endif
|
||||
|
||||
// iterator
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
|
|
@ -403,48 +457,24 @@ public:
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
/// This class represents an edge of the seam mesh.
|
||||
///
|
||||
/// \cgalModels `Descriptor`
|
||||
/// \cgalModels `Hashable`
|
||||
///
|
||||
class edge_descriptor
|
||||
{
|
||||
public:
|
||||
halfedge_descriptor hd;
|
||||
const Self* mesh_;
|
||||
/// %Default constructor
|
||||
edge_descriptor();
|
||||
|
||||
#ifdef CGAL_SEAM_MESH_INSERT_OPERATOR
|
||||
friend
|
||||
std::ostream& operator<<(std::ostream& os, const edge_descriptor& ed)
|
||||
{
|
||||
os << ed.hd;
|
||||
return os;
|
||||
}
|
||||
friend std::ostream& operator<<(std::ostream& os, const edge_descriptor& ed);
|
||||
#endif
|
||||
|
||||
edge_descriptor()
|
||||
: mesh_(nullptr)
|
||||
{}
|
||||
|
||||
edge_descriptor(const halfedge_descriptor& hd, const Self* m)
|
||||
: hd(hd), mesh_(m)
|
||||
{}
|
||||
|
||||
friend bool operator==(edge_descriptor e1, edge_descriptor e2)
|
||||
{
|
||||
return (e1.hd == e2.hd) || (e1.hd == e2.mesh_->opposite(e2.hd));
|
||||
}
|
||||
|
||||
friend bool operator!=(edge_descriptor e1, edge_descriptor e2)
|
||||
{
|
||||
return ! (e1 == e2);
|
||||
}
|
||||
|
||||
friend std::size_t hash_value(const edge_descriptor& ed)
|
||||
{
|
||||
return hash_value((std::min)(ed.hd, ed.mesh_->opposite(ed.hd)));
|
||||
}
|
||||
};
|
||||
#else
|
||||
typedef Seam_mesh_edge_descriptor<TM_halfedge_descriptor, Self> edge_descriptor;
|
||||
#endif
|
||||
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
// iterator
|
||||
|
|
@ -1120,6 +1150,46 @@ public:
|
|||
|
||||
} // namespace CGAL
|
||||
|
||||
#ifndef CGAL_CFG_NO_STD_HASH
|
||||
|
||||
namespace std {
|
||||
|
||||
template <typename HD>
|
||||
struct hash<CGAL::Seam_mesh_vertex_descriptor<HD> >
|
||||
: public CGAL::cpp98::unary_function<CGAL::Seam_mesh_vertex_descriptor<HD>, std::size_t>
|
||||
{
|
||||
std::size_t operator()(const CGAL::Seam_mesh_vertex_descriptor<HD>& v) const
|
||||
{
|
||||
return hash_value(v);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename HD>
|
||||
struct hash<CGAL::Seam_mesh_halfedge_descriptor<HD> >
|
||||
: public CGAL::cpp98::unary_function<CGAL::Seam_mesh_halfedge_descriptor<HD>, std::size_t>
|
||||
{
|
||||
std::size_t operator()(const CGAL::Seam_mesh_halfedge_descriptor<HD>& h) const
|
||||
{
|
||||
return hash_value(h);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename HD, typename SM>
|
||||
struct hash<CGAL::Seam_mesh_edge_descriptor<HD, SM> >
|
||||
: public CGAL::cpp98::unary_function<CGAL::Seam_mesh_edge_descriptor<HD, SM>, std::size_t>
|
||||
{
|
||||
std::size_t operator()(const CGAL::Seam_mesh_edge_descriptor<HD, SM>& e) const
|
||||
{
|
||||
return hash_value(e);
|
||||
}
|
||||
};
|
||||
|
||||
// Seam_mesh::face_descriptor is equal to TM_face_descriptor so nothing to do
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // CGAL_CFG_NO_STD_HASH
|
||||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif //CGAL_SEAM_MESH_H
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue