mirror of https://github.com/CGAL/cgal
Merge branch 'master' into gsoc2022-EBVs-Mostafa-ashraf19
This commit is contained in:
commit
3bc56024d3
|
|
@ -1,12 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
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 libboost-dev libinsighttoolkit4-dev zsh \
|
||||
qt6-base-dev qt6-declarative-dev
|
||||
#update cmake to 3.18.4
|
||||
sudo apt-get install -y \
|
||||
libmpfr-dev \
|
||||
libtbb-dev \
|
||||
libmetis-dev \
|
||||
libssh-dev \
|
||||
libeigen3-dev \
|
||||
qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev libqt5websockets5-dev \
|
||||
libqt5svg5-dev qttools5-dev qttools5-dev-tools \
|
||||
libboost-dev libboost-serialization-dev libboost-iostreams-dev libboost-filesystem-dev libboost-filesystem-dev \
|
||||
libvtk9-dev libgdcm-tools libvtkgdcm-dev libunwind-dev \
|
||||
libinsighttoolkit5-dev \
|
||||
libceres-dev \
|
||||
libglpk-dev \
|
||||
libopencv-dev \
|
||||
zsh \
|
||||
qt6-base-dev qt6-declarative-dev libqt6svg6-dev libqt6websockets6-dev
|
||||
|
||||
#update CMake
|
||||
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
|
||||
CMAKE_VER=$(curl --silent https://cmake.org/files/LatestRelease/cmake-latest-files-v1.json | jq -r .version.string)
|
||||
wget https://cmake.org/files/LatestRelease/cmake-$CMAKE_VER-linux-x86_64.sh
|
||||
sudo sh cmake-*.sh --skip-license --prefix=/usr/local
|
||||
rm cmake-*.sh
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ jobs:
|
|||
name: remove label
|
||||
steps:
|
||||
- name: removelabel
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
name: "Tested",
|
||||
});
|
||||
- name: Post address
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
if: ${{ success() }}
|
||||
with:
|
||||
script: |
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ jobs:
|
|||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
id: get_round
|
||||
with:
|
||||
result-encoding: string
|
||||
|
|
@ -38,7 +38,7 @@ jobs:
|
|||
}
|
||||
}
|
||||
return 'stop'
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
if: steps.get_round.outputs.result != 'stop'
|
||||
id: get_pr_number
|
||||
with:
|
||||
|
|
@ -49,7 +49,7 @@ jobs:
|
|||
return pr_number
|
||||
|
||||
- name: Emoji-comment
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
if: steps.get_round.outputs.result != 'stop'
|
||||
with:
|
||||
script: |
|
||||
|
|
@ -136,7 +136,7 @@ jobs:
|
|||
fi
|
||||
|
||||
- name: Post address
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
if: ${{ success() && steps.get_round.outputs.result != 'stop' }}
|
||||
with:
|
||||
script: |
|
||||
|
|
@ -154,7 +154,7 @@ jobs:
|
|||
- name: Post error
|
||||
env:
|
||||
ERRORMSG: ${{steps.build_and_run.outputs.DoxygenError}}
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
if: ${{ failure() && steps.get_round.outputs.result != 'stop' }}
|
||||
with:
|
||||
script: |
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
- name: configure all
|
||||
run: |
|
||||
set -e
|
||||
mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DBUILD_TESTING=ON ..
|
||||
mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DCGAL_ENABLE_TESTING=ON ..
|
||||
ctest -L Installation -j $(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
cmake-testsuite-with-qt:
|
||||
|
|
@ -31,5 +31,5 @@ jobs:
|
|||
- name: configure all
|
||||
run: |
|
||||
set -e
|
||||
mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DBUILD_TESTING=ON ..
|
||||
mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DCGAL_ENABLE_TESTING=ON ..
|
||||
ctest -L Installation -j $(getconf _NPROCESSORS_ONLN)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
if: (github.event.comment.user.login == 'sloriot' || github.event.comment.user.login == 'lrineau') && contains(github.event.comment.body, '/testme')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
id: get_label
|
||||
with:
|
||||
result-encoding: string
|
||||
|
|
@ -63,7 +63,7 @@ jobs:
|
|||
ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE $PR_NUMBER"
|
||||
done
|
||||
- name: Post address
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const address = "Testsuite launched. Results will appear on the following page: https://cgal.geometryfactory.com/~cgaltest/test_suite/TESTRESULTS/index.shtml "
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ jobs:
|
|||
messages: ${{ steps.set-result.outputs.result }}
|
||||
steps:
|
||||
- name: get informations and prepare email
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
id: set-result
|
||||
with:
|
||||
result-encoding: string
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#include <CGAL/AABB_primitive.h>
|
||||
#include <CGAL/boost/graph/property_maps.h>
|
||||
#include <CGAL/Default.h>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -57,9 +56,9 @@ template < class FaceGraph,
|
|||
class CacheDatum=Tag_false >
|
||||
class AABB_face_graph_triangle_primitive
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
: public AABB_primitive<typename boost::mpl::if_<OneFaceGraphPerTree,
|
||||
typename boost::graph_traits<FaceGraph>::face_descriptor,
|
||||
std::pair<typename boost::graph_traits<FaceGraph>::face_descriptor, const FaceGraph*> >::type,
|
||||
: public AABB_primitive<std::conditional_t<OneFaceGraphPerTree::value,
|
||||
typename boost::graph_traits<FaceGraph>::face_descriptor,
|
||||
std::pair<typename boost::graph_traits<FaceGraph>::face_descriptor, const FaceGraph*> >,
|
||||
Triangle_from_face_descriptor_map<
|
||||
FaceGraph,
|
||||
typename Default::Get<VertexPointPMap,
|
||||
|
|
@ -76,7 +75,7 @@ class AABB_face_graph_triangle_primitive
|
|||
{
|
||||
typedef typename Default::Get<VertexPointPMap, typename boost::property_map< FaceGraph, vertex_point_t>::const_type >::type VertexPointPMap_;
|
||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor FD;
|
||||
typedef typename boost::mpl::if_<OneFaceGraphPerTree, FD, std::pair<FD, const FaceGraph*> >::type Id_;
|
||||
typedef std::conditional_t<OneFaceGraphPerTree::value, FD, std::pair<FD, const FaceGraph*> > Id_;
|
||||
|
||||
typedef Triangle_from_face_descriptor_map<FaceGraph,VertexPointPMap_> Triangle_property_map;
|
||||
typedef One_point_from_face_descriptor_map<FaceGraph,VertexPointPMap_> Point_property_map;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <iterator>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <CGAL/type_traits/is_iterator.h>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#include <CGAL/Default.h>
|
||||
|
||||
|
|
@ -70,9 +69,9 @@ template < class HalfedgeGraph,
|
|||
class CacheDatum = Tag_false >
|
||||
class AABB_halfedge_graph_segment_primitive
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
: public AABB_primitive< typename boost::mpl::if_<OneHalfedgeGraphPerTree,
|
||||
typename boost::graph_traits<HalfedgeGraph>::edge_descriptor,
|
||||
std::pair<typename boost::graph_traits<HalfedgeGraph>::edge_descriptor, const HalfedgeGraph*> >::type,
|
||||
: public AABB_primitive< std::conditional_t<OneHalfedgeGraphPerTree::value,
|
||||
typename boost::graph_traits<HalfedgeGraph>::edge_descriptor,
|
||||
std::pair<typename boost::graph_traits<HalfedgeGraph>::edge_descriptor, const HalfedgeGraph*> >,
|
||||
Segment_from_edge_descriptor_map<
|
||||
HalfedgeGraph,
|
||||
typename Default::Get<VertexPointPMap,
|
||||
|
|
@ -89,7 +88,7 @@ class AABB_halfedge_graph_segment_primitive
|
|||
{
|
||||
typedef typename Default::Get<VertexPointPMap,typename boost::property_map< HalfedgeGraph,vertex_point_t>::const_type >::type VertexPointPMap_;
|
||||
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor ED;
|
||||
typedef typename boost::mpl::if_<OneHalfedgeGraphPerTree, ED, std::pair<ED, const HalfedgeGraph*> >::type Id_;
|
||||
typedef std::conditional_t<OneHalfedgeGraphPerTree::value, ED, std::pair<ED, const HalfedgeGraph*> > Id_;
|
||||
|
||||
typedef Segment_from_edge_descriptor_map<HalfedgeGraph,VertexPointPMap_> Segment_property_map;
|
||||
typedef Source_point_from_edge_descriptor_map<HalfedgeGraph,VertexPointPMap_> Point_property_map;
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_cartesian_const_iterator_3,Cartesian_const
|
|||
|
||||
template<typename GeomTraits>
|
||||
struct Is_ray_intersection_geomtraits
|
||||
: boost::mpl::and_< Has_ray_3<GeomTraits>,
|
||||
Has_construct_source_3<GeomTraits>,
|
||||
Has_vector_3<GeomTraits>,
|
||||
Has_construct_cartesian_const_iterator_3<GeomTraits>,
|
||||
Has_cartesian_const_iterator_3<GeomTraits> >::type
|
||||
: std::bool_constant< Has_ray_3<GeomTraits>::value &&
|
||||
Has_construct_source_3<GeomTraits>::value &&
|
||||
Has_vector_3<GeomTraits>::value &&
|
||||
Has_construct_cartesian_const_iterator_3<GeomTraits>::value &&
|
||||
Has_cartesian_const_iterator_3<GeomTraits>::value >
|
||||
{};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -194,21 +194,21 @@ root_of( int k, Input_iterator begin, Input_iterator end ) {
|
|||
template< class Number_type >
|
||||
inline
|
||||
// select a Is_zero functor
|
||||
typename boost::mpl::if_c<
|
||||
::std::is_same< typename Algebraic_structure_traits< Number_type >::Is_zero,
|
||||
Null_functor >::value ,
|
||||
typename std::conditional_t<
|
||||
std::is_same_v< typename Algebraic_structure_traits< Number_type >::Is_zero,
|
||||
Null_functor >,
|
||||
typename Real_embeddable_traits< Number_type >::Is_zero,
|
||||
typename Algebraic_structure_traits< Number_type >::Is_zero
|
||||
>::type::result_type
|
||||
>::result_type
|
||||
is_zero( const Number_type& x ) {
|
||||
// We take the Algebraic_structure_traits<>::Is_zero functor by default. If it
|
||||
// is not available, we take the Real_embeddable_traits functor
|
||||
typename ::boost::mpl::if_c<
|
||||
::std::is_same<
|
||||
std::conditional_t<
|
||||
std::is_same_v<
|
||||
typename Algebraic_structure_traits< Number_type >::Is_zero,
|
||||
Null_functor >::value ,
|
||||
Null_functor > ,
|
||||
typename Real_embeddable_traits< Number_type >::Is_zero,
|
||||
typename Algebraic_structure_traits< Number_type >::Is_zero >::type
|
||||
typename Algebraic_structure_traits< Number_type >::Is_zero >
|
||||
is_zero;
|
||||
return is_zero( x );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
# 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.20)
|
||||
project(Alpha_wrap_3_Benchmark)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
include_directories (BEFORE ../../include ./Quality ./Robustness) # AW3 includes
|
||||
include_directories (BEFORE ../../../CGAL-Patches/include)
|
||||
|
||||
# create a target per cppfile
|
||||
create_single_source_cgal_program("Performance/performance_benchmark.cpp")
|
||||
create_single_source_cgal_program("Quality/quality_benchmark.cpp")
|
||||
create_single_source_cgal_program("Robustness/robustness_benchmark.cpp")
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
# Copyright (c) 2019-2023 Google LLC (USA).
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of CGAL (www.cgal.org).
|
||||
#
|
||||
# $URL$
|
||||
# $Id$
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
#
|
||||
# Author(s) : Pierre Alliez
|
||||
# Michael Hemmer
|
||||
# Cedric Portaneri
|
||||
#
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, sys, subprocess, datetime, time, getopt
|
||||
|
||||
def compute_performance_benchmark_data(execname, filename, alpha):
|
||||
|
||||
output = ""
|
||||
cmd = ("/usr/bin/time", "-v",
|
||||
execname, "-i",
|
||||
filename, "-a", alpha)
|
||||
proc = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
start_new_session=True)
|
||||
|
||||
outs, errs = proc.communicate()
|
||||
output = outs.decode("utf-8") + errs.decode("utf-8")
|
||||
|
||||
for output_line in output.split("\n"):
|
||||
if "User time (seconds): " in output_line:
|
||||
print(output_line[len("User time (seconds): "):])
|
||||
continue
|
||||
if "Maximum resident set size (kbytes): " in output_line:
|
||||
print(output_line[len("Maximum resident set size (kbytes): "):])
|
||||
continue
|
||||
|
||||
def main(argv):
|
||||
execname=""
|
||||
filename=""
|
||||
alpha=""
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'e:i:a:')
|
||||
except getopt.GetoptError:
|
||||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
if opt == "-e":
|
||||
execname = arg
|
||||
elif opt == "-i":
|
||||
filename = arg
|
||||
elif opt == "-a":
|
||||
alpha = arg
|
||||
|
||||
compute_performance_benchmark_data(execname, filename, alpha)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
# Copyright (c) 2019-2023 Google LLC (USA).
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of CGAL (www.cgal.org).
|
||||
#
|
||||
# $URL$
|
||||
# $Id$
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
#
|
||||
# Author(s) : Pierre Alliez
|
||||
# Michael Hemmer
|
||||
# Cedric Portaneri
|
||||
#
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, sys, subprocess, datetime, time, signal, getopt
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def main(argv):
|
||||
|
||||
inputdir=""
|
||||
outputdir=""
|
||||
commit_hash=""
|
||||
alpha=""
|
||||
do_diff=False
|
||||
diffdir=""
|
||||
diff_hash=""
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'i:a:o:c:d:p:')
|
||||
except getopt.GetoptError:
|
||||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
if opt == "-i":
|
||||
inputdir = arg
|
||||
elif opt == "-a":
|
||||
alpha = arg
|
||||
elif opt == "-o":
|
||||
outputdir = arg
|
||||
elif opt == "-c":
|
||||
commit_hash = arg
|
||||
elif opt == "-d":
|
||||
diff_hash = arg
|
||||
do_diff = True
|
||||
elif opt == "-p":
|
||||
diffdir = arg
|
||||
|
||||
all_metric = {
|
||||
"Time_(second)" : {},
|
||||
"Memory_Peak_(kbytes)" : {}}
|
||||
num_input = 0
|
||||
for filename in os.listdir(inputdir) :
|
||||
new_path = os.path.join(inputdir,filename)
|
||||
new_file = open(new_path)
|
||||
is_empty_new = os.path.getsize(new_path) <= 1
|
||||
if do_diff :
|
||||
old_path = os.path.join(diffdir,filename)
|
||||
old_file = open(old_path)
|
||||
is_empty_old = os.path.getsize(old_path) <= 1
|
||||
for key in all_metric:
|
||||
if is_empty_new or is_empty_old :
|
||||
new_val = 0.
|
||||
old_val = 0.
|
||||
else :
|
||||
new_val = float(new_file.readline().rstrip('\n'))
|
||||
old_val = float(old_file.readline().rstrip('\n'))
|
||||
mesh_id = str(filename.split('.')[0])
|
||||
all_metric[key][mesh_id] = [new_val, old_val]
|
||||
else :
|
||||
for key in all_metric:
|
||||
if is_empty_new :
|
||||
new_val = 0.
|
||||
else :
|
||||
new_val = float(new_file.readline().rstrip('\n'))
|
||||
mesh_id = str(filename.split('.')[0])
|
||||
all_metric[key][mesh_id] = [new_val, new_val]
|
||||
num_input = num_input+1
|
||||
|
||||
# update .pdf chart
|
||||
date_now = datetime.datetime.now()
|
||||
date_for_filename = str(date_now.year) +"_"+ str(date_now.month) +"_"+ str(date_now.day) +"_"+ str(date_now.hour) +"h"+ str(date_now.minute) +"mn"
|
||||
for key in all_metric:
|
||||
goal = 0
|
||||
num_el = range(len(all_metric[key]))
|
||||
avg_diff_to_goal = 0.
|
||||
avg = 0.
|
||||
x1 = []
|
||||
x2 = []
|
||||
for value in all_metric[key].values() :
|
||||
avg += value[0]
|
||||
diff_to_goal = abs(value[1]-goal) - abs(value[0]-goal)
|
||||
avg_diff_to_goal += diff_to_goal
|
||||
x1.append(value[0])
|
||||
x2.append(value[1])
|
||||
avg_diff_to_goal /= float(len(all_metric[key]))
|
||||
avg /= float(len(all_metric[key]))
|
||||
|
||||
plt.figure(figsize=(8,8))
|
||||
if do_diff :
|
||||
plt.hist(x2, bins=100, color='tab:green', alpha=0.5)
|
||||
plt.hist(x1, bins=100, color='tab:blue', alpha=0.5)
|
||||
plt.vlines(x = goal, ymin=plt.ylim()[0], ymax=plt.ylim()[1], linestyles='dashed')
|
||||
|
||||
title = ""
|
||||
if do_diff :
|
||||
title += "Diff between " + commit_hash + " and " + diff_hash + " on " + str(num_input) + " meshes from Thingi10K\nAlpha = Bbox diag length / " + alpha
|
||||
else :
|
||||
title += "Benchmarking on " + str(num_input) + " meshes from Thingi10K\nAlpha = Bbox diag length / " + alpha
|
||||
|
||||
avg_str = str(format(abs(avg), '.2f'))
|
||||
if key == "Time_(second)" :
|
||||
title += "\nIn average we spend " + avg_str + " seconds"
|
||||
else :
|
||||
title += "\nIn average we use up to " + avg_str + " kbytes"
|
||||
|
||||
if do_diff and avg_diff_to_goal == 0. :
|
||||
title += "\nNo change between the two commits"
|
||||
elif do_diff :
|
||||
avg_diff_str = str(format(abs(avg_diff_to_goal), '.2f'))
|
||||
if key == "Time_(second)" :
|
||||
if avg_diff_to_goal < 0 :
|
||||
title += "\nIn average we get slower by "
|
||||
else :
|
||||
title += "\nIn average we get faster "
|
||||
title += avg_diff_str + " seconds"
|
||||
else :
|
||||
if avg_diff_to_goal < 0 :
|
||||
title += "\nIn average we use " + avg_diff_str + " more"
|
||||
else :
|
||||
title += "\nIn average we use " + avg_diff_str + " less"
|
||||
title += " kbytes"
|
||||
|
||||
plt.title(title, fontsize=15)
|
||||
plt.xlabel(key.replace("_"," "), fontsize=14)
|
||||
plt.ylabel("# of meshes", fontsize=14)
|
||||
plt.tick_params(axis="x", labelsize=9)
|
||||
plt.tick_params(axis="y", labelsize=9)
|
||||
|
||||
chart_filename = ""
|
||||
if do_diff :
|
||||
chart_filename += "diff_"+commit_hash+"_"+diff_hash+"_"+key+"_"+date_for_filename+".pdf"
|
||||
else :
|
||||
chart_filename += "results_"+commit_hash+"_"+key+"_"+date_for_filename+".pdf"
|
||||
chart_path = os.path.join(outputdir+"/charts",chart_filename)
|
||||
if os.path.isfile(chart_path) :
|
||||
os.remove(chart_path)
|
||||
plt.savefig(chart_path, bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
print("pdf updated")
|
||||
|
||||
sys.exit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
|
||||
#include <CGAL/IO/polygon_soup_io.h>
|
||||
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Point_3 = K::Point_3;
|
||||
using Vector_3 = K::Vector_3;
|
||||
|
||||
using Mesh = CGAL::Surface_mesh<Point_3>;
|
||||
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int argc_check = argc - 1;
|
||||
const char* entry_name_ptr = nullptr;
|
||||
double relative_alpha_ratio = 20., relative_offset_ratio = 600.;
|
||||
|
||||
for(int i=1; i<argc; ++i)
|
||||
{
|
||||
if(!strcmp("-i", argv[i]) && i < argc_check)
|
||||
entry_name_ptr = argv[++i];
|
||||
else if(!strcmp("-a", argv[i]) && i < argc_check)
|
||||
relative_alpha_ratio = std::stod(argv[++i]);
|
||||
else if(!strcmp("-d", argv[i]) && i < argc_check)
|
||||
relative_offset_ratio = std::stod(argv[++i]);
|
||||
}
|
||||
|
||||
if(argc < 3 || relative_alpha_ratio <= 0.)
|
||||
{
|
||||
std::cerr << "Error: bad input parameters." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::vector<Point_3> points;
|
||||
std::vector<std::array<std::size_t, 3> > faces;
|
||||
if(!CGAL::IO::read_polygon_soup(entry_name_ptr, points, faces) || faces.empty())
|
||||
{
|
||||
std::cerr << "Error: Invalid input data." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
CGAL::Bbox_3 bbox;
|
||||
for(const Point_3& p : points)
|
||||
bbox += p.bbox();
|
||||
|
||||
const double diag_length = std::sqrt(CGAL::square(bbox.xmax() - bbox.xmin()) +
|
||||
CGAL::square(bbox.ymax() - bbox.ymin()) +
|
||||
CGAL::square(bbox.zmax() - bbox.zmin()));
|
||||
const double alpha = diag_length / relative_alpha_ratio;
|
||||
const double offset = diag_length / relative_offset_ratio;
|
||||
|
||||
Mesh wrap;
|
||||
CGAL::alpha_wrap_3(points, faces, alpha, offset, wrap);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
# Copyright (c) 2019-2023 Google LLC (USA).
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of CGAL (www.cgal.org).
|
||||
#
|
||||
# $URL$
|
||||
# $Id$
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
#
|
||||
# Author(s) : Pierre Alliez
|
||||
# Michael Hemmer
|
||||
# Cedric Portaneri
|
||||
#
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, sys, subprocess, datetime, time, getopt
|
||||
|
||||
def compute_quality_benchmark_data(execname, filename, alpha):
|
||||
|
||||
output = ""
|
||||
cmd = (execname, "-i",
|
||||
filename, "-a", alpha)
|
||||
proc = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
start_new_session=True)
|
||||
|
||||
outs, errs = proc.communicate()
|
||||
output = outs.decode("utf-8") + errs.decode("utf-8")
|
||||
|
||||
print(output)
|
||||
|
||||
def main(argv):
|
||||
execname=""
|
||||
filename=""
|
||||
alpha=""
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'e:i:a:')
|
||||
except getopt.GetoptError:
|
||||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
if opt == "-e":
|
||||
execname = arg
|
||||
elif opt == "-i":
|
||||
filename = arg
|
||||
elif opt == "-a":
|
||||
alpha = arg
|
||||
|
||||
compute_quality_benchmark_data(execname, filename, alpha)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
// Copyright (c) 2019-2022 Google LLC (USA).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Pierre Alliez
|
||||
// Michael Hemmer
|
||||
// Cedric Portaneri
|
||||
|
||||
#ifndef CGAL_ALPHA_WRAP_3_BENCHMARK_ALPHA_WRAP_3_QUALITY_DISTANCE_H_
|
||||
#define CGAL_ALPHA_WRAP_3_BENCHMARK_ALPHA_WRAP_3_QUALITY_DISTANCE_H_
|
||||
|
||||
#include <CGAL/AABB_face_graph_triangle_primitive.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/bounding_box.h>
|
||||
#include <CGAL/Polygon_mesh_processing/bbox.h>
|
||||
#include <CGAL/Polygon_mesh_processing/distance.h>
|
||||
#include <CGAL/point_generators_3.h>
|
||||
#include <CGAL/Search_traits_3.h>
|
||||
|
||||
namespace Aw3i {
|
||||
|
||||
enum Distance_metric { HAUSDORFF = 0, MEAN = 1, RMS = 2 };
|
||||
|
||||
template <typename Point, typename AABBTree>
|
||||
inline double approximate_hausdorff_distance(const std::vector<Point>& sample_points,
|
||||
const AABBTree& tree,
|
||||
Point& hint)
|
||||
{
|
||||
double hdist = 0;
|
||||
for(const Point& pt : sample_points)
|
||||
{
|
||||
hint = tree.closest_point(pt, hint);
|
||||
auto dist = CGAL::squared_distance(hint, pt);
|
||||
double d = CGAL::to_double(CGAL::approximate_sqrt(dist));
|
||||
if(d > hdist)
|
||||
hdist = d;
|
||||
}
|
||||
|
||||
return hdist;
|
||||
}
|
||||
|
||||
template <typename Point, typename AABBTree>
|
||||
inline double approximate_mean_distance(const std::vector<Point>& sample_points,
|
||||
const AABBTree& tree,
|
||||
Point& hint)
|
||||
{
|
||||
double mdist = 0;
|
||||
for(const Point& pt : sample_points)
|
||||
{
|
||||
hint = tree.closest_point(pt, hint);
|
||||
auto dist = CGAL::squared_distance(hint, pt);
|
||||
double d = CGAL::to_double(CGAL::approximate_sqrt(dist));
|
||||
mdist += d;
|
||||
}
|
||||
|
||||
return mdist / sample_points.size();
|
||||
}
|
||||
|
||||
template <typename Point, typename AABBTree>
|
||||
inline double approximate_rms_distance(const std::vector<Point>& sample_points,
|
||||
const AABBTree& tree,
|
||||
Point& hint)
|
||||
{
|
||||
double rmsdist = 0;
|
||||
for(const Point& pt : sample_points)
|
||||
{
|
||||
hint = tree.closest_point(pt, hint);
|
||||
auto dist = CGAL::squared_distance(hint, pt);
|
||||
rmsdist += CGAL::to_double(dist);
|
||||
}
|
||||
|
||||
return CGAL::to_double(CGAL::approximate_sqrt(rmsdist / sample_points.size()));
|
||||
}
|
||||
|
||||
template <typename TriangleMesh>
|
||||
inline double approximate_distance(const TriangleMesh& tm1,
|
||||
const TriangleMesh& tm2,
|
||||
const Distance_metric& metric)
|
||||
{
|
||||
using GT = typename CGAL::GetGeomTraits<TriangleMesh>::type;
|
||||
using Point_3 = typename GT::Point_3;
|
||||
|
||||
using Primitive = CGAL::AABB_face_graph_triangle_primitive<TriangleMesh>;
|
||||
using AABB_traits = CGAL::AABB_traits<GT, Primitive>;
|
||||
using AABB_tree = CGAL::AABB_tree<AABB_traits>;
|
||||
|
||||
using CGAL::parameters::choose_parameter;
|
||||
using CGAL::parameters::get_parameter;
|
||||
|
||||
std::vector<Point_3> original_sample_points;
|
||||
CGAL::Polygon_mesh_processing::sample_triangle_mesh(tm1, std::back_inserter(original_sample_points),
|
||||
CGAL::parameters::all_default());
|
||||
|
||||
std::vector<Point_3> sample_points(std::begin(original_sample_points),
|
||||
std::end(original_sample_points));
|
||||
CGAL::spatial_sort(sample_points.begin(), sample_points.end());
|
||||
|
||||
AABB_tree tree(faces(tm2).first, faces(tm2).second, tm2);
|
||||
tree.build();
|
||||
|
||||
auto vpm_2 = get(CGAL::vertex_point, tm2);
|
||||
Point_3 hint = get(vpm_2, *vertices(tm2).first);
|
||||
|
||||
if(metric == HAUSDORFF)
|
||||
return approximate_hausdorff_distance(sample_points, tree, hint);
|
||||
else if(metric == MEAN)
|
||||
return approximate_mean_distance(sample_points, tree, hint);
|
||||
else if(metric == RMS)
|
||||
return approximate_rms_distance(sample_points, tree, hint);
|
||||
else
|
||||
std::cerr << "Metric unknown\n" << std::endl;
|
||||
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
template <typename TriangleMesh>
|
||||
double get_longest_diag_bbox(const TriangleMesh& tm)
|
||||
{
|
||||
CGAL::Bbox_3 bbox = CGAL::Polygon_mesh_processing::bbox(tm);
|
||||
return std::sqrt(CGAL::square(bbox.xmax() - bbox.xmin()) +
|
||||
CGAL::square(bbox.ymax() - bbox.ymin()) +
|
||||
CGAL::square(bbox.zmax() - bbox.zmin()));
|
||||
}
|
||||
|
||||
template <typename TriangleMesh>
|
||||
inline double approximate_distance_relative_to_bbox(const TriangleMesh& tm1,
|
||||
const TriangleMesh& tm2,
|
||||
const Distance_metric& metric)
|
||||
{
|
||||
double longest_diag_length = get_longest_diag_bbox(tm1);
|
||||
return approximate_distance(tm1, tm2, metric) / longest_diag_length;
|
||||
}
|
||||
|
||||
template <typename TriangleMesh, typename FT>
|
||||
inline double approximate_distance_relative_to_bbox(const TriangleMesh& tm1,
|
||||
const TriangleMesh& tm2,
|
||||
const Distance_metric& metric,
|
||||
const FT& longest_diag_length)
|
||||
{
|
||||
return approximate_distance(tm1, tm2, metric) / CGAL::to_double(longest_diag_length);
|
||||
}
|
||||
|
||||
} // namespace Aw3i
|
||||
|
||||
#endif // CGAL_CGAL_ALPHA_WRAP_3_BENCHMARK_ALPHA_WRAP_3_QUALITY_DISTANCE_H_
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
# Copyright (c) 2019-2023 Google LLC (USA).
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of CGAL (www.cgal.org).
|
||||
#
|
||||
# $URL$
|
||||
# $Id$
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
#
|
||||
# Author(s) : Pierre Alliez
|
||||
# Michael Hemmer
|
||||
# Cedric Portaneri
|
||||
#
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, sys, subprocess, datetime, time, signal, getopt
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def main(argv):
|
||||
|
||||
inputdir=""
|
||||
outputdir=""
|
||||
commit_hash=""
|
||||
alpha=""
|
||||
do_diff=False
|
||||
diffdir=""
|
||||
diff_hash=""
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'i:a:o:c:d:p:')
|
||||
except getopt.GetoptError:
|
||||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
if opt == "-i":
|
||||
inputdir = arg
|
||||
elif opt == "-a":
|
||||
alpha = arg
|
||||
elif opt == "-o":
|
||||
outputdir = arg
|
||||
elif opt == "-c":
|
||||
commit_hash = arg
|
||||
elif opt == "-d":
|
||||
diff_hash = arg
|
||||
do_diff = True
|
||||
elif opt == "-p":
|
||||
diffdir = arg
|
||||
|
||||
all_metric = {
|
||||
"Mean_Min_Angle_(degree)" : {},
|
||||
"Mean_Max_Angle_(degree)" : {},
|
||||
"Mean_Radius_Ratio" : {},
|
||||
"Mean_Edge_Ratio" : {},
|
||||
"Mean_Aspect_Ratio" : {},
|
||||
"Complexity_(#_of_triangle)" : {},
|
||||
"#_of_almost_degenerate_triangle" : {},
|
||||
"Hausdorff_distance_output_to_input_(%_of_bbox_diag)" : {}}
|
||||
num_input = 0
|
||||
print("inputdir = ", inputdir)
|
||||
for filename in os.listdir(inputdir) :
|
||||
new_path = os.path.join(inputdir,filename)
|
||||
new_file = open(new_path)
|
||||
if do_diff :
|
||||
old_path = os.path.join(diffdir,filename)
|
||||
old_file = open(old_path)
|
||||
is_empty_old = os.path.getsize(old_path) <= 1
|
||||
for key in all_metric :
|
||||
try :
|
||||
new_val = float(new_file.readline().rstrip('\n'))
|
||||
old_val = float(old_file.readline().rstrip('\n'))
|
||||
mesh_id = str(filename.split('.')[0])
|
||||
all_metric[key][mesh_id] = [new_val, old_val]
|
||||
except ValueError:
|
||||
pass
|
||||
else :
|
||||
for key in all_metric :
|
||||
try :
|
||||
new_val = float(new_file.readline().rstrip('\n'))
|
||||
mesh_id = str(filename.split('.')[0])
|
||||
all_metric[key][mesh_id] = [new_val, new_val]
|
||||
except ValueError:
|
||||
pass
|
||||
num_input = num_input+1
|
||||
|
||||
# update .pdf chart
|
||||
date_now = datetime.datetime.now()
|
||||
date_for_filename = str(date_now.year) +"_"+ str(date_now.month) +"_"+ str(date_now.day) +"_"+ str(date_now.hour) +"h"+ str(date_now.minute) +"mn"
|
||||
for key in all_metric:
|
||||
goal = 0
|
||||
if key == "Mean_Min_Angle_(degree)" or key == "Mean_Max_Angle_(degree)":
|
||||
goal = 60
|
||||
elif key == "Mean_Radius_Ratio" or key == "Mean_Edge_Ratio" or key == "Mean_Aspect_Ratio" :
|
||||
goal = 1
|
||||
|
||||
num_el = range(len(all_metric[key]))
|
||||
avg_diff_to_goal = 0.
|
||||
avg = 0.
|
||||
x1 = []
|
||||
x2 = []
|
||||
for value in all_metric[key].values() :
|
||||
avg += value[0]
|
||||
diff_to_goal = abs(value[1]-goal) - abs(value[0]-goal)
|
||||
avg_diff_to_goal += diff_to_goal
|
||||
x1.append(value[0])
|
||||
x2.append(value[1])
|
||||
avg_diff_to_goal /= float(len(all_metric[key]))
|
||||
avg /= float(len(all_metric[key]))
|
||||
|
||||
plt.figure(figsize=(8,8))
|
||||
if do_diff :
|
||||
plt.hist(x2, bins=100, color='tab:green', alpha=0.5)
|
||||
plt.hist(x1, bins=100, color='tab:blue', alpha=0.5)
|
||||
plt.vlines(x = goal, ymin=plt.ylim()[0], ymax=plt.ylim()[1], linestyles='dashed')
|
||||
|
||||
title = ""
|
||||
if do_diff :
|
||||
title += "Diff between " + commit_hash + " and " + diff_hash + " on " + str(num_input) + " meshes from Thingi10K\nAlpha = Bbox diag length / " + alpha
|
||||
else :
|
||||
title += "Benchmarking on " + str(num_input) + " meshes from Thingi10K\nAlpha = Bbox diag length / " + alpha
|
||||
|
||||
avg_str = str(format(abs(avg), '.2f'))
|
||||
if key == "Mean_Min_Angle_(degree)" or key == "Mean_Max_Angle_(degree)":
|
||||
title += "\nIn average we have " + avg_str + "°"
|
||||
elif key == "Mean_Radius_Ratio" or key == "Mean_Edge_Ratio" or key == "Mean_Aspect_Ratio" :
|
||||
title += "\nIn average we have a ratio of " + avg_str
|
||||
elif key == "Hausdorff_distance_output_to_input_(%_of_bbox_diag)" :
|
||||
title += "\nIn average we have a distance of " + avg_str + "% of bbox diag"
|
||||
elif key == "Complexity_(#_of_triangle)" or key == "#_of_almost_degenerate_triangle" :
|
||||
title += "\nIn average we have " + avg_str + " triangles"
|
||||
|
||||
if do_diff and avg_diff_to_goal == 0. :
|
||||
title += "\nNo change between the two commits"
|
||||
elif do_diff :
|
||||
avg_diff_str = str(format(abs(avg_diff_to_goal), '.2f'))
|
||||
if key == "Mean_Min_Angle_(degree)" or key == "Mean_Max_Angle_(degree)":
|
||||
if avg_diff_to_goal < 0 :
|
||||
title += "\nIn average we loose "
|
||||
else :
|
||||
title += "\nIn average we gain "
|
||||
title += avg_diff_str + "° toward 60°"
|
||||
elif key == "Mean_Radius_Ratio" or key == "Mean_Edge_Ratio" or key == "Mean_Aspect_Ratio" :
|
||||
if avg_diff_to_goal < 0 :
|
||||
title += "\nIn average we loose "
|
||||
else :
|
||||
title += "\nIn average we gain "
|
||||
title += avg_diff_str + " of ratio toward 1"
|
||||
elif key == "Hausdorff_distance_output_to_input_(%_of_bbox_diag)" :
|
||||
if avg_diff_to_goal < 0 :
|
||||
title += "\nIn average we increase by "
|
||||
else :
|
||||
title += "\nIn average we reduce by "
|
||||
title += avg_diff_str + " the bbox ratio"
|
||||
elif key == "Complexity_(#_of_triangle)" or key == "#_of_almost_degenerate_triangle" :
|
||||
if avg_diff_to_goal < 0 :
|
||||
title += "\nIn average we get " + avg_diff_str + " more"
|
||||
else :
|
||||
title += "\nIn average we get " + avg_diff_str + " less"
|
||||
title += " triangles"
|
||||
|
||||
plt.title(title, fontsize=15)
|
||||
plt.xlabel(key.replace("_"," "), fontsize=14)
|
||||
plt.ylabel("# of meshes", fontsize=14)
|
||||
plt.tick_params(axis="x", labelsize=9)
|
||||
plt.tick_params(axis="y", labelsize=9)
|
||||
|
||||
chart_filename = ""
|
||||
if do_diff :
|
||||
chart_filename += "diff_"+commit_hash+"_"+diff_hash+"_"+key+"_"+date_for_filename+".pdf"
|
||||
else :
|
||||
chart_filename += "results_"+commit_hash+"_"+key+"_"+date_for_filename+".pdf"
|
||||
chart_path = os.path.join(outputdir+"/charts",chart_filename)
|
||||
if os.path.isfile(chart_path) :
|
||||
os.remove(chart_path)
|
||||
plt.savefig(chart_path, bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
print("pdf updated")
|
||||
|
||||
sys.exit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
#include <distance_utils.h>
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Point_3 = Kernel::Point_3;
|
||||
using Vector_3 = Kernel::Vector_3;
|
||||
using Triangle_3 = Kernel::Triangle_3;
|
||||
using FT = Kernel::FT;
|
||||
|
||||
using Mesh = CGAL::Surface_mesh<Point_3>;
|
||||
using face_descriptor = boost::graph_traits<Mesh>::face_descriptor;
|
||||
|
||||
using Oracle = CGAL::Alpha_wraps_3::internal::Triangle_mesh_oracle<Kernel>;
|
||||
using Dt = CGAL::Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle>::Triangulation;
|
||||
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
std::array<FT, 3> triangle_angles(const Triangle_3& tr)
|
||||
{
|
||||
FT sq_a = CGAL::squared_distance(tr[0], tr[1]);
|
||||
FT sq_b = CGAL::squared_distance(tr[1], tr[2]);
|
||||
FT sq_c = CGAL::squared_distance(tr[2], tr[0]);
|
||||
|
||||
FT two_ab = 2. * CGAL::sqrt(sq_a) * CGAL::sqrt(sq_b);
|
||||
FT two_bc = 2. * CGAL::sqrt(sq_b) * CGAL::sqrt(sq_c);
|
||||
FT two_ca = 2. * CGAL::sqrt(sq_c) * CGAL::sqrt(sq_a);
|
||||
|
||||
FT angle_a = (sq_b + sq_c - sq_a) / two_bc;
|
||||
FT angle_b = (sq_c + sq_a - sq_b) / two_ca;
|
||||
FT angle_c = (sq_a + sq_b - sq_c) / two_ab;
|
||||
if(angle_a < -1.) angle_a = -1.;
|
||||
if(angle_b < -1.) angle_b = -1.;
|
||||
if(angle_c < -1.) angle_c = -1.;
|
||||
if(angle_a > 1.) angle_a = 1.;
|
||||
if(angle_b > 1.) angle_b = 1.;
|
||||
if(angle_c > 1.) angle_c = 1.;
|
||||
angle_a = std::acos(angle_a);
|
||||
angle_b = std::acos(angle_b);
|
||||
angle_c = std::acos(angle_c);
|
||||
|
||||
return {angle_a, angle_b, angle_c};
|
||||
}
|
||||
|
||||
bool is_almost_degenerate(const Triangle_3& tr,
|
||||
double threshold)
|
||||
{
|
||||
FT sq_area = tr.squared_area();
|
||||
return (CGAL::sqrt(CGAL::to_double(sq_area)) < threshold);
|
||||
}
|
||||
|
||||
auto surface_mesh_face_to_triangle(const face_descriptor fd,
|
||||
const Mesh& sm)
|
||||
{
|
||||
typename boost::graph_traits<Mesh>::halfedge_descriptor hd = halfedge(fd,sm);
|
||||
return Triangle_3(sm.point(target(hd,sm)),
|
||||
sm.point(target(next(hd,sm),sm)),
|
||||
sm.point(target(next(next(hd,sm),sm),sm)));
|
||||
}
|
||||
|
||||
double mean_min_angle(const Mesh& mesh)
|
||||
{
|
||||
double mean_min_angle = 0.;
|
||||
for(const face_descriptor f : faces(mesh))
|
||||
{
|
||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
||||
std::array<FT, 3> angles = triangle_angles(tr);
|
||||
|
||||
FT min_angle = std::min({angles[0], angles[1], angles[2]});
|
||||
|
||||
min_angle = min_angle * (180.0 / CGAL_PI);
|
||||
mean_min_angle += min_angle;
|
||||
}
|
||||
|
||||
mean_min_angle /= static_cast<double>(mesh.number_of_faces());
|
||||
return mean_min_angle;
|
||||
}
|
||||
|
||||
double mean_max_angle(const Mesh& mesh)
|
||||
{
|
||||
double mean_max_angle = 0.;
|
||||
for(const face_descriptor f : faces(mesh))
|
||||
{
|
||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
||||
std::array<FT, 3> angles = triangle_angles(tr);
|
||||
|
||||
FT max_angle = std::max({angles[0], angles[1], angles[2]});
|
||||
|
||||
max_angle = max_angle * (180.0 / CGAL_PI);
|
||||
mean_max_angle += max_angle;
|
||||
}
|
||||
|
||||
mean_max_angle /= static_cast<double>(mesh.number_of_faces());
|
||||
return mean_max_angle;
|
||||
}
|
||||
|
||||
double mean_radius_ratio(const Mesh& mesh,
|
||||
double degenerate_threshold)
|
||||
{
|
||||
double mean_radius_ratio = 0.;
|
||||
size_t num_almost_degenerate_tri = 0;
|
||||
for(const face_descriptor f : faces(mesh))
|
||||
{
|
||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
||||
if(is_almost_degenerate(tr, degenerate_threshold))
|
||||
{
|
||||
++num_almost_degenerate_tri;
|
||||
continue;
|
||||
}
|
||||
|
||||
FT circumsphere_radius = std::sqrt(CGAL::squared_radius(tr[0], tr[1], tr[2]));
|
||||
|
||||
FT a = std::sqrt(CGAL::squared_distance(tr[0], tr[1]));
|
||||
FT b = std::sqrt(CGAL::squared_distance(tr[1], tr[2]));
|
||||
FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0]));
|
||||
FT s = 0.5 * (a + b + c);
|
||||
FT inscribed_radius = std::sqrt((s * (s - a) * (s - b) * (s - c)) / s);
|
||||
FT radius_ratio = circumsphere_radius / inscribed_radius;
|
||||
radius_ratio /= 2.; // normalized
|
||||
mean_radius_ratio += radius_ratio;
|
||||
}
|
||||
|
||||
mean_radius_ratio /= static_cast<double>(mesh.number_of_faces() - num_almost_degenerate_tri);
|
||||
return mean_radius_ratio;
|
||||
}
|
||||
|
||||
double mean_edge_ratio(const Mesh& mesh,
|
||||
double degenerate_threshold)
|
||||
{
|
||||
double mean_edge_ratio = 0.;
|
||||
size_t num_almost_degenerate_tri = 0;
|
||||
|
||||
for(const face_descriptor f : faces(mesh))
|
||||
{
|
||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
||||
if(is_almost_degenerate(tr, degenerate_threshold))
|
||||
{
|
||||
++num_almost_degenerate_tri;
|
||||
continue;
|
||||
}
|
||||
|
||||
FT a = std::sqrt(CGAL::squared_distance(tr[0], tr[1]));
|
||||
FT b = std::sqrt(CGAL::squared_distance(tr[1], tr[2]));
|
||||
FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0]));
|
||||
FT min_edge = std::min({a, b, c});
|
||||
FT max_edge = std::max({a, b, c});
|
||||
FT edge_ratio = max_edge / min_edge;
|
||||
|
||||
mean_edge_ratio += edge_ratio;
|
||||
}
|
||||
|
||||
mean_edge_ratio /= static_cast<double>(mesh.number_of_faces() - num_almost_degenerate_tri);
|
||||
return mean_edge_ratio;
|
||||
}
|
||||
|
||||
double mean_aspect_ratio(const Mesh& mesh,
|
||||
double degenerate_threshold)
|
||||
{
|
||||
double mean_aspect_ratio = 0.;
|
||||
size_t num_almost_degenerate_tri = 0;
|
||||
for(const face_descriptor f : faces(mesh))
|
||||
{
|
||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
||||
if(is_almost_degenerate(tr, degenerate_threshold))
|
||||
{
|
||||
++num_almost_degenerate_tri;
|
||||
continue;
|
||||
}
|
||||
|
||||
FT a = std::sqrt(CGAL::squared_distance(tr[0], tr[1]));
|
||||
FT b = std::sqrt(CGAL::squared_distance(tr[1], tr[2]));
|
||||
FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0]));
|
||||
FT s = 0.5 * (a + b + c);
|
||||
FT inscribed_radius = std::sqrt((s * (s - a) * (s - b) * (s - c)) / s);
|
||||
FT max_edge = std::max({a, b, c});
|
||||
FT aspect_ratio = max_edge / inscribed_radius;
|
||||
aspect_ratio /= (2. * std::sqrt(3.)); // normalized
|
||||
mean_aspect_ratio += aspect_ratio;
|
||||
}
|
||||
|
||||
mean_aspect_ratio /= static_cast<double>(mesh.number_of_faces() - num_almost_degenerate_tri);
|
||||
return mean_aspect_ratio;
|
||||
}
|
||||
|
||||
size_t num_almost_degenerate_tri(const Mesh& mesh,
|
||||
double degenerate_threshold)
|
||||
{
|
||||
size_t num_almost_degenerate_tri = 0;
|
||||
for(const face_descriptor f : faces(mesh))
|
||||
{
|
||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
||||
if(is_almost_degenerate(tr, degenerate_threshold))
|
||||
{
|
||||
++num_almost_degenerate_tri;
|
||||
}
|
||||
}
|
||||
return num_almost_degenerate_tri;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int argc_check = argc - 1;
|
||||
char *entry_name_ptr = nullptr;
|
||||
double relative_alpha_ratio = 20.;
|
||||
double relative_offset_ratio = 600.;
|
||||
|
||||
for(int i=1; i<argc; ++i)
|
||||
{
|
||||
if(!strcmp("-i", argv[i]) && i < argc_check) {
|
||||
entry_name_ptr = argv[++i];
|
||||
} else if(!strcmp("-a", argv[i]) && i < argc_check) {
|
||||
relative_alpha_ratio = std::stod(argv[++i]);
|
||||
} else if(!strcmp("-d", argv[i]) && i < argc_check) {
|
||||
relative_offset_ratio = std::stod(argv[++i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(argc < 3 || relative_alpha_ratio <= 0.)
|
||||
{
|
||||
std::cerr << "Error: bad input parameters." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Mesh input_mesh;
|
||||
if(!PMP::IO::read_polygon_mesh(entry_name_ptr, input_mesh) ||
|
||||
is_empty(input_mesh) ||
|
||||
!is_triangle_mesh(input_mesh))
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
CGAL::Bbox_3 bbox = PMP::bbox(input_mesh);
|
||||
const double diag_length = std::sqrt(CGAL::square(bbox.xmax() - bbox.xmin()) +
|
||||
CGAL::square(bbox.ymax() - bbox.ymin()) +
|
||||
CGAL::square(bbox.zmax() - bbox.zmin()));
|
||||
const double alpha = diag_length / relative_alpha_ratio;
|
||||
const double offset = diag_length / relative_offset_ratio;
|
||||
|
||||
Mesh wrap;
|
||||
CGAL::alpha_wrap_3(input_mesh, alpha, offset, wrap);
|
||||
|
||||
double degenerate_threshold = 0.;
|
||||
for(const face_descriptor f : faces(wrap))
|
||||
{
|
||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, wrap);
|
||||
degenerate_threshold += CGAL::sqrt(CGAL::to_double(tr.squared_area()));
|
||||
}
|
||||
|
||||
degenerate_threshold /= wrap.number_of_faces();
|
||||
degenerate_threshold /= 1000;
|
||||
|
||||
std::cout << mean_min_angle(wrap) << "\n";
|
||||
std::cout << mean_max_angle(wrap) << "\n";
|
||||
std::cout << mean_radius_ratio(wrap, degenerate_threshold) << "\n";
|
||||
std::cout << mean_edge_ratio(wrap, degenerate_threshold) << "\n";
|
||||
std::cout << mean_aspect_ratio(wrap, degenerate_threshold) << "\n";
|
||||
std::cout << wrap.number_of_faces() << "\n";
|
||||
std::cout << num_almost_degenerate_tri(wrap, degenerate_threshold) << "\n";
|
||||
std::cout << 100. * approximate_distance_relative_to_bbox(wrap, input_mesh, Aw3i::HAUSDORFF) << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
# Copyright (c) 2019-2023 Google LLC (USA).
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of CGAL (www.cgal.org).
|
||||
#
|
||||
# $URL$
|
||||
# $Id$
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
#
|
||||
# Author(s) : Pierre Alliez
|
||||
# Michael Hemmer
|
||||
# Cedric Portaneri
|
||||
#
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, sys, subprocess, datetime, time, signal, getopt
|
||||
|
||||
def signal_handler(signum, frame):
|
||||
raise Exception("Timed out!")
|
||||
|
||||
def compute_robustness_benchmark_data(execname, filename, alpha, max_time):
|
||||
|
||||
exit_codes = {
|
||||
0 : "VALID_SOLID_OUTPUT",
|
||||
1 : "INPUT_IS_INVALID",
|
||||
2 : "OUTPUT_IS_NOT_TRIANGLE_MESH",
|
||||
3 : "OUTPUT_IS_COMBINATORIAL_NON_MANIFOLD",
|
||||
4 : "OUTPUT_HAS_BORDERS",
|
||||
5 : "OUTPUT_HAS_DEGENERATED_FACES",
|
||||
6 : "OUTPUT_HAS_GEOMETRIC_SELF_INTERSECTIONS",
|
||||
7 : "OUTPUT_DOES_NOT_BOUND_VOLUME",
|
||||
8 : "OUTPUT_DOES_NOT_CONTAIN_INPUT",
|
||||
9 : "OUTPUT_DISTANCE_IS_TOO_LARGE",
|
||||
10 : "SIGSEGV",
|
||||
11 : "SIGABRT",
|
||||
12 : "SIGFPE",
|
||||
13 : "TIMEOUT"
|
||||
}
|
||||
|
||||
exit_code = 0
|
||||
output = ""
|
||||
cmd = ("/usr/bin/time", "-v",
|
||||
execname, "-i",
|
||||
filename, "-a", alpha)
|
||||
proc = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
start_new_session=True)
|
||||
|
||||
try:
|
||||
outs, errs = proc.communicate(timeout=int(max_time))
|
||||
exit_code = proc.returncode
|
||||
output = outs.decode("utf-8") + errs.decode("utf-8")
|
||||
|
||||
for output_line in output.split("\n"):
|
||||
if output_line == "Command terminated by signal 11":
|
||||
exit_code = 10
|
||||
continue
|
||||
elif output_line == "Command terminated by signal 6":
|
||||
exit_code = 11
|
||||
continue
|
||||
elif output_line == "Command terminated by signal 8":
|
||||
exit_code = 12
|
||||
continue
|
||||
|
||||
except subprocess.TimeoutExpired:
|
||||
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
|
||||
exit_code = 13
|
||||
output = "process ran too long"
|
||||
|
||||
print(exit_codes[exit_code])
|
||||
|
||||
def main(argv):
|
||||
execname=""
|
||||
filename=""
|
||||
alpha=""
|
||||
max_time=""
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'e:i:a:t:')
|
||||
except getopt.GetoptError:
|
||||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
if opt == "-e":
|
||||
execname = arg
|
||||
elif opt == "-i":
|
||||
filename = arg
|
||||
elif opt == "-a":
|
||||
alpha = arg
|
||||
elif opt == "-t":
|
||||
max_time = arg
|
||||
|
||||
compute_robustness_benchmark_data(execname, filename, alpha, max_time)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
# Copyright (c) 2019-2023 Google LLC (USA).
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of CGAL (www.cgal.org).
|
||||
#
|
||||
# $URL$
|
||||
# $Id$
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
#
|
||||
# Author(s) : Pierre Alliez
|
||||
# Michael Hemmer
|
||||
# Cedric Portaneri
|
||||
#
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, sys, subprocess, datetime, time, signal, getopt
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def main(argv):
|
||||
|
||||
inputdir=""
|
||||
outputdir=""
|
||||
commit_hash=""
|
||||
alpha=""
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'i:a:o:c:')
|
||||
except getopt.GetoptError:
|
||||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
if opt == "-i":
|
||||
inputdir = arg
|
||||
elif opt == "-a":
|
||||
alpha = arg
|
||||
elif opt == "-o":
|
||||
outputdir = arg
|
||||
elif opt == "-c":
|
||||
commit_hash = arg
|
||||
|
||||
exit_codes = {
|
||||
0 : "VALID_SOLID_OUTPUT",
|
||||
1 : "INPUT_IS_INVALID",
|
||||
2 : "OUTPUT_IS_NOT_TRIANGLE_MESH",
|
||||
3 : "OUTPUT_IS_COMBINATORIAL_NON_MANIFOLD",
|
||||
4 : "OUTPUT_HAS_BORDERS",
|
||||
5 : "OUTPUT_HAS_DEGENERATED_FACES",
|
||||
6 : "OUTPUT_HAS_GEOMETRIC_SELF_INTERSECTIONS",
|
||||
7 : "OUTPUT_DOES_NOT_BOUND_VOLUME",
|
||||
8 : "OUTPUT_DOES_NOT_CONTAIN_INPUT",
|
||||
9 : "OUTPUT_DISTANCE_IS_TOO_LARGE",
|
||||
10 : "SIGSEGV",
|
||||
11 : "SIGABRT",
|
||||
12 : "SIGFPE",
|
||||
13 : "TIMEOUT"
|
||||
}
|
||||
|
||||
current_run_data = {
|
||||
"VALID_SOLID_OUTPUT" : 0,
|
||||
"INPUT_IS_INVALID" : 0,
|
||||
"OUTPUT_IS_NOT_TRIANGLE_MESH" : 0,
|
||||
"OUTPUT_IS_COMBINATORIAL_NON_MANIFOLD" : 0,
|
||||
"OUTPUT_HAS_BORDERS" : 0,
|
||||
"OUTPUT_HAS_DEGENERATED_FACES" : 0,
|
||||
"OUTPUT_HAS_GEOMETRIC_SELF_INTERSECTIONS" : 0,
|
||||
"OUTPUT_DOES_NOT_BOUND_VOLUME" : 0,
|
||||
"OUTPUT_DOES_NOT_CONTAIN_INPUT" : 0,
|
||||
"OUTPUT_DISTANCE_IS_TOO_LARGE" : 0,
|
||||
"SIGSEGV" : 0,
|
||||
"SIGABRT" : 0,
|
||||
"SIGFPE" : 0,
|
||||
"TIMEOUT" : 0
|
||||
}
|
||||
|
||||
filenames_per_codes = {}
|
||||
for key in current_run_data :
|
||||
filenames_per_codes[key] = []
|
||||
|
||||
print("inputdir = ", inputdir)
|
||||
|
||||
num_input = 0
|
||||
for filename in os.listdir(inputdir) :
|
||||
print("filename = ", filename)
|
||||
|
||||
f = open(os.path.join(inputdir,filename))
|
||||
status = f.readline().rstrip('\n');
|
||||
current_run_data[status] += 1
|
||||
filenames_per_codes[status].append(filename.rstrip('.log'))
|
||||
num_input = num_input+1
|
||||
|
||||
# sort current_run_data by value
|
||||
current_run_data = {k: v for k, v in sorted(current_run_data.items(), key=lambda item: item[1], reverse=True)}
|
||||
|
||||
# update chart data files
|
||||
date_now = datetime.datetime.now()
|
||||
date = str(date_now.year) +"-"+ str(date_now.month) +"-"+ str(date_now.day) +" "+ str(date_now.hour) +"h"+ str(date_now.minute) +"mn"
|
||||
|
||||
for key_filename in current_run_data:
|
||||
f = open(os.path.join(outputdir+"/charts_data", key_filename+".txt"), "a+")
|
||||
f.write(str(current_run_data[key_filename]) + " " + commit_hash + " " + date + "\n")
|
||||
|
||||
print("chart data updated")
|
||||
|
||||
# update .pdf chart
|
||||
chart = plt.figure(figsize=(10, 7))
|
||||
colormap = ["tab:blue","tab:orange","tab:green","tab:red","tab:purple","tab:brown","tab:pink","tab:gray","tab:olive","tab:cyan","b","palegreen", "peachpuff"]
|
||||
plt.gca().set_prop_cycle('color', colormap)
|
||||
plt.style.use('tableau-colorblind10')
|
||||
for key_filename in current_run_data:
|
||||
|
||||
f = open(os.path.join(outputdir+"/charts_data", key_filename+".txt"), "r")
|
||||
lines = f.readlines()
|
||||
x_number_values = []
|
||||
y_number_values = []
|
||||
i = 0
|
||||
for line in lines :
|
||||
if i < (len(lines) - 10) :
|
||||
i=i+1
|
||||
continue
|
||||
|
||||
i=i+1
|
||||
words = line.strip().split()
|
||||
x_number_values.append(words[1]+"\n"+words[2]+"\n"+words[3])
|
||||
y_number_values.append(int(words[0]))
|
||||
plt.plot(x_number_values, y_number_values, marker='o', label=key_filename+": "+str(current_run_data[key_filename]))
|
||||
|
||||
plt.xlabel("Version", fontsize=14)
|
||||
plt.ylabel("# of mesh", fontsize=14)
|
||||
plt.tick_params(axis="both", labelsize=9)
|
||||
plt.title("Benchmarking on " + str(num_input) + " meshes from Thingi10K\nAlpha = Bbox diag length / " + alpha, fontsize=15)
|
||||
plt.legend(loc='lower left', bbox_to_anchor= (1.01, 0.58), ncol=1,
|
||||
borderaxespad=0, frameon=False)
|
||||
|
||||
date_for_filename = str(date_now.year) +"-"+ str(date_now.month) +"-"+ str(date_now.day) +"-"+ str(date_now.hour) +"h"+ str(date_now.minute) +"mn"
|
||||
chart_filename = os.path.join(outputdir+"/charts","benchmarking_version_"+commit_hash+"-"+date_for_filename+".pdf")
|
||||
if os.path.isfile(chart_filename) :
|
||||
os.remove(chart_filename)
|
||||
chart.savefig(chart_filename, bbox_inches="tight")
|
||||
plt.close(chart)
|
||||
|
||||
print("pdf updated")
|
||||
|
||||
# dump filenames per codes
|
||||
log_dirname = os.path.join(outputdir, "log/"+commit_hash+"-"+date_for_filename)
|
||||
if not os.path.exists(log_dirname):
|
||||
os.mkdir(log_dirname)
|
||||
for key in filenames_per_codes :
|
||||
file = open(os.path.join(log_dirname, key+".txt"), "w+")
|
||||
for filename in filenames_per_codes[key] :
|
||||
file.write(filename + "\n")
|
||||
file.close()
|
||||
|
||||
sys.exit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
#include <CGAL/Alpha_wrap_3/internal/validation.h>
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
|
||||
|
||||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Point_3 = Kernel::Point_3;
|
||||
using Mesh = CGAL::Surface_mesh<Point_3>;
|
||||
|
||||
namespace CGAL {
|
||||
namespace Alpha_wraps_3 {
|
||||
namespace internal {
|
||||
namespace {
|
||||
|
||||
enum Robustness_benchmark_exit_code
|
||||
{
|
||||
// Success
|
||||
VALID_SOLID_OUTPUT = 0,
|
||||
|
||||
// Failure
|
||||
INPUT_IS_INVALID = 1,
|
||||
OUTPUT_IS_NOT_TRIANGLE_MESH = 2,
|
||||
OUTPUT_IS_COMBINATORIAL_NON_MANIFOLD = 3,
|
||||
OUTPUT_HAS_BORDERS = 4,
|
||||
OUTPUT_HAS_DEGENERATED_FACES = 5,
|
||||
OUTPUT_HAS_GEOMETRIC_SELF_INTERSECTIONS = 6,
|
||||
OUTPUT_DOES_NOT_BOUND_VOLUME = 7,
|
||||
OUTPUT_DOES_NOT_CONTAIN_INPUT = 8,
|
||||
OUTPUT_DISTANCE_IS_TOO_LARGE = 9,
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace internal
|
||||
} // namespace Alpha_wraps_3
|
||||
} // namespace CGAL
|
||||
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
namespace AW3i = CGAL::Alpha_wraps_3::internal;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int argc_check = argc - 1;
|
||||
char* entry_name_ptr = nullptr;
|
||||
double relative_alpha_ratio = 20.;
|
||||
double relative_offset_ratio = 600.;
|
||||
|
||||
for(int i=1; i<argc; ++i)
|
||||
{
|
||||
if(!strcmp("-i", argv[i]) && i < argc_check) {
|
||||
entry_name_ptr = argv[++i];
|
||||
} else if(!strcmp("-a", argv[i]) && i < argc_check) {
|
||||
relative_alpha_ratio = std::stod(argv[++i]);
|
||||
} else if(!strcmp("-d", argv[i]) && i < argc_check) {
|
||||
relative_offset_ratio = std::stod(argv[++i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(argc < 3 || relative_alpha_ratio <= 0.)
|
||||
return AW3i::INPUT_IS_INVALID;
|
||||
|
||||
Mesh input_mesh;
|
||||
if(!PMP::IO::read_polygon_mesh(entry_name_ptr, input_mesh) ||
|
||||
is_empty(input_mesh) ||
|
||||
!is_triangle_mesh(input_mesh)
|
||||
#ifndef CGAL_ALPHA_WRAP_3_TOLERATE_DEGENERACIES
|
||||
|| AW3i::has_degenerated_faces(input_mesh)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return AW3i::INPUT_IS_INVALID;
|
||||
}
|
||||
|
||||
const CGAL::Bbox_3 bbox = PMP::bbox(input_mesh);
|
||||
const double diag_length = std::sqrt(CGAL::square(bbox.xmax() - bbox.xmin()) +
|
||||
CGAL::square(bbox.ymax() - bbox.ymin()) +
|
||||
CGAL::square(bbox.zmax() - bbox.zmin()));
|
||||
const double alpha = diag_length / relative_alpha_ratio;
|
||||
const double offset = diag_length / relative_offset_ratio;
|
||||
|
||||
Mesh wrap;
|
||||
alpha_wrap_3(input_mesh, alpha, offset, wrap);
|
||||
|
||||
if(!is_triangle_mesh(wrap))
|
||||
return AW3i::OUTPUT_IS_NOT_TRIANGLE_MESH;
|
||||
|
||||
if(!is_closed(wrap))
|
||||
return AW3i::OUTPUT_HAS_BORDERS;
|
||||
|
||||
if(AW3i::has_degenerated_faces(wrap))
|
||||
return AW3i::OUTPUT_HAS_DEGENERATED_FACES;
|
||||
|
||||
if(AW3i::is_combinatorially_non_manifold(wrap))
|
||||
return AW3i::OUTPUT_IS_COMBINATORIAL_NON_MANIFOLD;
|
||||
|
||||
if(PMP::does_self_intersect(wrap))
|
||||
return AW3i::OUTPUT_HAS_GEOMETRIC_SELF_INTERSECTIONS;
|
||||
|
||||
if(!PMP::does_bound_a_volume(wrap))
|
||||
return AW3i::OUTPUT_DOES_NOT_BOUND_VOLUME;
|
||||
|
||||
if(!AW3i::is_outer_wrap_of_triangle_mesh(wrap, input_mesh))
|
||||
return AW3i::OUTPUT_DOES_NOT_CONTAIN_INPUT;
|
||||
|
||||
if(!AW3i::has_expected_Hausdorff_distance(wrap, input_mesh, alpha, offset))
|
||||
return AW3i::OUTPUT_DISTANCE_IS_TOO_LARGE;
|
||||
|
||||
return AW3i::VALID_SOLID_OUTPUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
# Copyright (c) 2019-2023 Google LLC (USA).
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of the 3D Alpha Wrapping package, which is being prepared for
|
||||
# submission to CGAL (www.cgal.org).
|
||||
#
|
||||
# $URL$
|
||||
# $Id$
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
#
|
||||
# Author(s) : Pierre Alliez
|
||||
# Michael Hemmer
|
||||
# Cedric Portaneri
|
||||
# Mael Rouxel-Labbé
|
||||
#
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# $1: directory containing the alpha wrap project
|
||||
# $2: directory containing the output results
|
||||
# $3: alpha value
|
||||
# $4: timeout value in seconds
|
||||
# $5: hash of the latest commit
|
||||
# $6: the input file path
|
||||
function compute_benchmark_data() {
|
||||
filename=$(basename -- "$6")
|
||||
filename="${filename%.*}"
|
||||
|
||||
python3 $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/Robustness/compute_robustness_benchmark_data.py \
|
||||
-e $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/build-release/robustness_benchmark -i $6 -a $3 -t $4 \
|
||||
> $2/Robustness/results/$5/$filename.log
|
||||
|
||||
python3 $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/Performance/compute_performance_benchmark_data.py \
|
||||
-e $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/build-release/performance_benchmark -i $6 -a $3 \
|
||||
> $2/Performance/results/$5/$filename.log
|
||||
|
||||
python3 $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/compute_quality_benchmark_data.py \
|
||||
-e $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/build-release/quality_benchmark -i $6 -a $3 \
|
||||
> $2/Quality/results/$5/$filename.log
|
||||
}
|
||||
export -f compute_benchmark_data
|
||||
|
||||
# $1: directory containing the alpha wrap project
|
||||
# $2: directory containing the input data folder
|
||||
# $3: directory containing the output results
|
||||
# $4: alpha value
|
||||
# $5: timeout value for robustness benchmark in seconds
|
||||
# $6: number of virtual thread used
|
||||
# $7: hash of the latest commit
|
||||
# $8: hash of a commit to perform the diff with latest
|
||||
cd $1
|
||||
|
||||
mkdir -p $3/Robustness/results/$7
|
||||
mkdir -p $3/Performance/results/$7
|
||||
mkdir -p $3/Quality/results/$7
|
||||
mkdir -p $3/Robustness/charts_data
|
||||
mkdir -p $3/Performance/charts_data
|
||||
mkdir -p $3/Quality/charts_data
|
||||
mkdir -p $3/Robustness/charts
|
||||
mkdir -p $3/Performance/charts
|
||||
mkdir -p $3/Quality/charts
|
||||
mkdir -p $3/Robustness/log
|
||||
mkdir -p $3/Performance/log
|
||||
mkdir -p $3/Quality/log
|
||||
mkdir -p $3/charts
|
||||
|
||||
find $2 -mindepth 1 | parallel -j$6 compute_benchmark_data $1 $3 $4 $5 $7 :::
|
||||
|
||||
python3 $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/Robustness/generate_robustness_benchmark_charts.py -i $3/Robustness/results/$7 -o $3/Robustness -a $4 -c $7
|
||||
|
||||
if [ -z "$8" ]; then
|
||||
python3 $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/Performance/generate_performance_benchmark_charts.py -i $3/Performance/results/$7 -o $3/Performance -a $4 -c $7;
|
||||
else
|
||||
python3 $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/Performance/generate_performance_benchmark_charts.py -i $3/Performance/results/$7 -o $3/Performance -a $4 -c $7 -p $3/Performance/results/$8 -d $8;
|
||||
fi
|
||||
|
||||
if [ -z "$8" ]; then
|
||||
python3 $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/generate_quality_benchmark_charts.py -i $3/Quality/results/$7 -o $3/Quality -a $4 -c $7;
|
||||
else
|
||||
python3 $1/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/generate_quality_benchmark_charts.py -i $3/Quality/results/$7 -o $3/Quality -a $4 -c $7 -p $3/Quality/results/$8 -d $8;
|
||||
fi
|
||||
|
||||
charts_path="$(ls "$3/Robustness/charts"/* -dArt | tail -n 1) $(ls "$3/Performance/charts"/* -dArt | tail -n 2) $(ls "$3/Quality/charts"/* -dArt | tail -n 9)"
|
||||
|
||||
pdfjam --nup 2x6 $charts_path --outfile $3/charts/results_$7_$8_alpha_$4_$(date '+%Y-%m-%d_%H:%M:%S').pdf
|
||||
|
|
@ -13,3 +13,5 @@ create_single_source_cgal_program("point_set_wrap.cpp")
|
|||
create_single_source_cgal_program("wrap_from_cavity.cpp")
|
||||
create_single_source_cgal_program("mixed_inputs_wrap.cpp")
|
||||
create_single_source_cgal_program("volumetric_wrap.cpp")
|
||||
create_single_source_cgal_program("successive_wraps.cpp")
|
||||
create_single_source_cgal_program("pause_and_resume_wrapping.cpp")
|
||||
|
|
|
|||
|
|
@ -103,10 +103,10 @@ int main(int argc, char** argv)
|
|||
oracle.add_segment_soup(segments, CGAL::parameters::default_values());
|
||||
oracle.add_point_set(ps_points, CGAL::parameters::default_values());
|
||||
|
||||
CGAL::Alpha_wraps_3::internal::Alpha_wrap_3<Oracle> aw3(oracle);
|
||||
CGAL::Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle> aw3(oracle);
|
||||
|
||||
Mesh output_mesh;
|
||||
aw3(alpha, offset, output_mesh);
|
||||
Mesh wrap;
|
||||
aw3(alpha, offset, wrap);
|
||||
|
||||
t.stop();
|
||||
std::cout << "Took " << t.time() << std::endl;
|
||||
|
|
@ -120,10 +120,11 @@ int main(int argc, char** argv)
|
|||
std::string ps_name = std::string(ps_filename);
|
||||
ps_name = ps_name.substr(ps_name.find_last_of("/") + 1, ps_name.length() - 1);
|
||||
ps_name = ps_name.substr(0, ps_name.find_last_of("."));
|
||||
std::string output_name = ts_name + "_" + ss_name + "_" + ps_name + "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
std::string output_name = ts_name + "_" + ss_name + "_" + ps_name + "_"
|
||||
+ std::to_string(static_cast<int>(relative_alpha)) + "_"
|
||||
+ std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, output_mesh, CGAL::parameters::stream_precision(17));
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef CGAL_ALPHA_WRAP_3_EXAMPLES_OUTPUT_HELPER_H
|
||||
#define CGAL_ALPHA_WRAP_3_EXAMPLES_OUTPUT_HELPER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string generate_output_name(std::string input_name,
|
||||
const double alpha,
|
||||
const double offset)
|
||||
{
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(offset)) + ".off";
|
||||
|
||||
return output_name;
|
||||
}
|
||||
|
||||
#endif // CGAL_ALPHA_WRAP_3_EXAMPLES_OUTPUT_HELPER_H
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
// This example demonstrates how to interrupt the wrapping process before it has terminated,
|
||||
// and how to resume afterwards.
|
||||
//
|
||||
// -------------------------------- !! Warning !! --------------------------------------------------
|
||||
// By default, the wrapper uses an unsorted LIFO queue of faces to refine. This means that
|
||||
// the intermediate result is not very useful because the algorithm carves deep and not wide
|
||||
// (somewhat like a DFS vs a BFS).
|
||||
//
|
||||
// The sorted queue option is enabled with the macro below to make the refinement algorithm
|
||||
// more uniform. The downside is that it is slower.
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
#define CGAL_AW3_USE_SORTED_PRIORITY_QUEUE
|
||||
|
||||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
#include <CGAL/IO/polygon_soup_io.h>
|
||||
#include <CGAL/Polygon_mesh_processing/measure.h>
|
||||
#include <CGAL/Random.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace AW3 = CGAL::Alpha_wraps_3;
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Point_3 = K::Point_3;
|
||||
|
||||
using Points = std::vector<Point_3>;
|
||||
using Face = std::array<std::size_t, 3>;
|
||||
using Faces = std::vector<Face>;
|
||||
|
||||
using Mesh = CGAL::Surface_mesh<Point_3>;
|
||||
using face_descriptor = boost::graph_traits<Mesh>::face_descriptor;
|
||||
|
||||
struct Interrupter_visitor
|
||||
: public AW3::internal::Wrapping_default_visitor
|
||||
{
|
||||
using Base = AW3::internal::Wrapping_default_visitor;
|
||||
|
||||
CGAL::Real_timer timer;
|
||||
double max_time = -1; // in seconds
|
||||
|
||||
public:
|
||||
void set_max_time(double t) { max_time = t; }
|
||||
|
||||
public:
|
||||
template <typename AlphaWrapper>
|
||||
void on_flood_fill_begin(const AlphaWrapper&)
|
||||
{
|
||||
std::cout << "Starting timer..." << std::endl;
|
||||
timer.start();
|
||||
}
|
||||
|
||||
template <typename Wrapper>
|
||||
bool go_further(const Wrapper&)
|
||||
{
|
||||
if(timer.time() > max_time)
|
||||
{
|
||||
timer.stop();
|
||||
std::cout << "Paused after " << timer.time() << " s." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::cout.precision(17);
|
||||
std::cerr.precision(17);
|
||||
|
||||
CGAL::Random rng;
|
||||
std::cout << "Random seed = " << rng.get_seed() << std::endl;
|
||||
|
||||
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off");
|
||||
|
||||
// = read the soup
|
||||
Points points;
|
||||
Faces faces;
|
||||
if(!CGAL::IO::read_polygon_soup(filename, points, faces) || faces.empty())
|
||||
{
|
||||
std::cerr << "Invalid soup input: " << filename << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::cout << "Input: " << points.size() << " points, " << faces.size() << " faces" << std::endl;
|
||||
|
||||
// Compute the alpha and offset values
|
||||
const double relative_alpha = (argc > 2) ? std::stod(argv[2]) : rng.get_double(150., 200.);
|
||||
const double relative_offset = (argc > 3) ? std::stod(argv[3]) : 600.;
|
||||
std::cout << "relative_alpha = " << relative_alpha << std::endl;
|
||||
|
||||
CGAL::Bbox_3 bbox;
|
||||
for(const Point_3& p : points)
|
||||
bbox += p.bbox();
|
||||
|
||||
const double diag_length = std::sqrt(CGAL::square(bbox.xmax() - bbox.xmin()) +
|
||||
CGAL::square(bbox.ymax() - bbox.ymin()) +
|
||||
CGAL::square(bbox.zmax() - bbox.zmin()));
|
||||
|
||||
const double alpha = diag_length / relative_alpha;
|
||||
const double offset = diag_length / relative_offset;
|
||||
|
||||
// Build the wrapper
|
||||
using Oracle = CGAL::Alpha_wraps_3::internal::Triangle_soup_oracle<K>;
|
||||
Oracle oracle(alpha);
|
||||
oracle.add_triangle_soup(points, faces, CGAL::parameters::default_values());
|
||||
CGAL::Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle> aw3(oracle);
|
||||
|
||||
// --- Launch the wrapping, and pause when the algorithm has spent 1s flooding
|
||||
Interrupter_visitor interrupter;
|
||||
interrupter.set_max_time(1.);
|
||||
|
||||
Mesh wrap;
|
||||
aw3(alpha, offset, wrap, CGAL::parameters::visitor(interrupter));
|
||||
std::cout << ">>> The current wrap has " << num_vertices(wrap) << " vertices" << std::endl;
|
||||
CGAL::IO::write_polygon_mesh("stopped_1.off", wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
// --- Restart from the previous state, and pause a bit further
|
||||
interrupter.set_max_time(2.);
|
||||
aw3(alpha, offset, wrap, CGAL::parameters::visitor(interrupter)
|
||||
.refine_triangulation(true));
|
||||
std::cout << ">>> The current wrap has " << num_vertices(wrap) << " vertices" << std::endl;
|
||||
CGAL::IO::write_polygon_mesh("stopped_2.off", wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
// --- Restart from the previous state, and let it finish
|
||||
aw3(alpha, offset, wrap, CGAL::parameters::refine_triangulation(true));
|
||||
std::cout << ">>> The final (resumed) wrap has " << num_vertices(wrap) << " vertices" << std::endl;
|
||||
std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << "resumed_" + output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh("resumed_" + output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
// --- Get the final wrap, in one go:
|
||||
Mesh single_pass_wrap;
|
||||
CGAL::alpha_wrap_3(points, faces, alpha, offset, single_pass_wrap);
|
||||
std::cout << ">>> The final (from scratch) wrap has " << num_vertices(single_pass_wrap) << " vertices" << std::endl;
|
||||
|
||||
output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, single_pass_wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
// --- Compare the results to ensure both approaches yield identical meshes
|
||||
std::vector<std::pair<face_descriptor, face_descriptor> > common;
|
||||
std::vector<face_descriptor> m1_only;
|
||||
std::vector<face_descriptor> m2_only;
|
||||
PMP::match_faces(wrap, single_pass_wrap,
|
||||
std::back_inserter(common),
|
||||
std::back_inserter(m1_only),
|
||||
std::back_inserter(m2_only));
|
||||
if(!m1_only.empty() || !m2_only.empty())
|
||||
{
|
||||
std::cerr << "Error: The two wraps should have been identical!" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -23,7 +25,7 @@ int main(int argc, char** argv)
|
|||
Point_container points;
|
||||
if(!CGAL::IO::read_points(filename, std::back_inserter(points)) || points.empty())
|
||||
{
|
||||
std::cerr << "Invalid input." << std::endl;
|
||||
std::cerr << "Invalid input:" << filename << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -53,11 +55,7 @@ int main(int argc, char** argv)
|
|||
std::cout << "Took " << t.time() << " s." << std::endl;
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name + "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,135 @@
|
|||
// In this example, we reuse the underlying triangulation of the previous state, and carve using
|
||||
// a new (smaller) alpha value. This enables considerable speed-up: the cumulated time taken
|
||||
// to run `n` successive instances of `{alpha_wrap(alpha_i)}_(i=1...n)` will be roughly equal
|
||||
// to the time taken to the single instance of alpha_wrap(alpha_n) from scratch.
|
||||
//
|
||||
// The speed-up increases with the number of intermediate results, and on the gap between
|
||||
// alpha values: if alpha_2 is close to alpha_1, practically no new computation are required,
|
||||
// and the speed-up is almost 100%.
|
||||
//
|
||||
// -------------------------------- !! Warning !! --------------------------------------------------
|
||||
// The result of:
|
||||
// > alpha_wrap(alpha_1, ...)
|
||||
// > alpha_wrap(alpha_2, ..., reuse)
|
||||
// is not exactly identical to calling directly:
|
||||
// > alpha_wrap(alpha_2, ..., do_not_reuse)
|
||||
// because the queues are sorted slightly differently and the AABB tree is rebuilt differently
|
||||
// to optimize the runtime.
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
#include <CGAL/Polygon_mesh_processing/bbox.h>
|
||||
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
|
||||
#include <CGAL/Real_timer.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using FT = K::FT;
|
||||
using Point_3 = K::Point_3;
|
||||
|
||||
using Mesh = CGAL::Surface_mesh<Point_3>;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::cout.precision(17);
|
||||
std::cerr.precision(17);
|
||||
|
||||
// Read the input
|
||||
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cube.off");
|
||||
std::cout << "Reading " << filename << "..." << std::endl;
|
||||
|
||||
Mesh mesh;
|
||||
if(!PMP::IO::read_polygon_mesh(filename, mesh) || is_empty(mesh) || !is_triangle_mesh(mesh))
|
||||
{
|
||||
std::cerr << "Invalid input:" << filename << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::cout << "Input: " << num_vertices(mesh) << " vertices, " << num_faces(mesh) << " faces" << std::endl;
|
||||
|
||||
const CGAL::Bbox_3 bbox = CGAL::Polygon_mesh_processing::bbox(mesh);
|
||||
const double diag_length = std::sqrt(CGAL::square(bbox.xmax() - bbox.xmin()) +
|
||||
CGAL::square(bbox.ymax() - bbox.ymin()) +
|
||||
CGAL::square(bbox.zmax() - bbox.zmin()));
|
||||
|
||||
// We want decreasing alphas, and these are relative ratios, so they need to be increasing
|
||||
const std::vector<FT> relative_alphas = { 1, 50, 100, 150, 200, 250 };
|
||||
const FT relative_offset = 600;
|
||||
|
||||
// ===============================================================================================
|
||||
// Naive approach:
|
||||
|
||||
CGAL::Real_timer t;
|
||||
double total_time = 0.;
|
||||
|
||||
for(std::size_t i=0; i<relative_alphas.size(); ++i)
|
||||
{
|
||||
t.reset();
|
||||
t.start();
|
||||
|
||||
const double alpha = diag_length / relative_alphas[i];
|
||||
const double offset = diag_length / relative_offset;
|
||||
std::cout << ">>> [" << i << "] alpha: " << alpha << " offset: " << offset << std::endl;
|
||||
|
||||
Mesh wrap;
|
||||
CGAL::alpha_wrap_3(mesh, alpha, offset, wrap);
|
||||
|
||||
t.stop();
|
||||
std::cout << " Result: " << num_vertices(wrap) << " vertices, " << num_faces(wrap) << " faces" << std::endl;
|
||||
std::cout << " Elapsed time: " << t.time() << " s." << std::endl;
|
||||
|
||||
total_time += t.time();
|
||||
}
|
||||
|
||||
std::cout << "Total elapsed time (naive): " << total_time << " s.\n" << std::endl;
|
||||
|
||||
// ===============================================================================================
|
||||
// Re-use approach
|
||||
|
||||
total_time = 0.;
|
||||
t.reset();
|
||||
|
||||
using Oracle = CGAL::Alpha_wraps_3::internal::Triangle_mesh_oracle<K>;
|
||||
using Wrapper = CGAL::Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle>;
|
||||
Wrapper wrapper; // contains the triangulation that is being refined iteratively
|
||||
|
||||
for(std::size_t i=0; i<relative_alphas.size(); ++i)
|
||||
{
|
||||
t.reset();
|
||||
t.start();
|
||||
|
||||
const double alpha = diag_length / relative_alphas[i];
|
||||
const double offset = diag_length / relative_offset;
|
||||
std::cout << ">>> [" << i << "] alpha: " << alpha << " offset: " << offset << std::endl;
|
||||
|
||||
// The triangle mesh oracle should be initialized with alpha to internally perform a split
|
||||
// of too-big facets while building the AABB Tree. This split in fact yields a significant
|
||||
// speed-up for meshes with elements that are large compared to alpha. This speed-up makes it
|
||||
// faster to re-build the AABB tree for every value of alpha than to use a non-optimized tree.
|
||||
Oracle oracle(alpha);
|
||||
oracle.add_triangle_mesh(mesh, CGAL::parameters::default_values());
|
||||
wrapper.oracle() = oracle;
|
||||
|
||||
Mesh wrap;
|
||||
wrapper(alpha, offset, wrap, CGAL::parameters::refine_triangulation((i != 0)));
|
||||
|
||||
t.stop();
|
||||
std::cout << " Result: " << num_vertices(wrap) << " vertices, " << num_faces(wrap) << " faces" << std::endl;
|
||||
std::cout << " Elapsed time: " << t.time() << " s." << std::endl;
|
||||
|
||||
total_time += t.time();
|
||||
}
|
||||
|
||||
std::cout << "Total elapsed time (successive): " << total_time << " s." << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -25,7 +27,7 @@ int main(int argc, char** argv)
|
|||
Mesh mesh;
|
||||
if(!PMP::IO::read_polygon_mesh(filename, mesh) || is_empty(mesh) || !is_triangle_mesh(mesh))
|
||||
{
|
||||
std::cerr << "Invalid input." << std::endl;
|
||||
std::cerr << "Invalid input:" << filename << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -56,12 +58,7 @@ int main(int argc, char** argv)
|
|||
std::cout << "Took " << t.time() << " s." << std::endl;
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -30,7 +32,7 @@ int main(int argc, char** argv)
|
|||
std::vector<std::array<std::size_t, 3> > faces;
|
||||
if(!CGAL::IO::read_polygon_soup(filename, points, faces) || faces.empty())
|
||||
{
|
||||
std::cerr << "Invalid input." << std::endl;
|
||||
std::cerr << "Invalid input:" << filename << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -63,12 +65,7 @@ int main(int argc, char** argv)
|
|||
std::cout << "Took " << t.time() << " s." << std::endl;
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -70,7 +72,7 @@ int main(int argc, char** argv)
|
|||
Faces faces;
|
||||
if(!CGAL::IO::read_polygon_soup(filename, points, faces) || faces.empty())
|
||||
{
|
||||
std::cerr << "Invalid input." << std::endl;
|
||||
std::cerr << "Invalid input:" << filename << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +103,7 @@ int main(int argc, char** argv)
|
|||
Oracle oracle(K{});
|
||||
oracle.add_triangle_soup(points, faces, CGAL::parameters::default_values());
|
||||
|
||||
CGAL::Alpha_wraps_3::internal::Alpha_wrap_3<Oracle, Delaunay_triangulation> aw3(oracle);
|
||||
CGAL::Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle, Delaunay_triangulation> aw3(oracle);
|
||||
Mesh wrap;
|
||||
aw3(alpha, offset, wrap);
|
||||
|
||||
|
|
@ -113,12 +115,7 @@ int main(int argc, char** argv)
|
|||
auto dt = aw3.triangulation();
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -25,13 +27,13 @@ int main(int argc, char** argv)
|
|||
if(!PMP::IO::read_polygon_mesh(filename, input) ||
|
||||
is_empty(input) || !is_triangle_mesh(input))
|
||||
{
|
||||
std::cerr << "Invalid input." << std::endl;
|
||||
std::cerr << "Invalid input:" << filename << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::cout << "Input: " << num_vertices(input) << " vertices, " << num_faces(input) << " faces" << std::endl;
|
||||
|
||||
const double relative_alpha = (argc > 2) ? std::stod(argv[2]) : 30.;
|
||||
const double relative_alpha = (argc > 2) ? std::stod(argv[2]) : 40.;
|
||||
const double relative_offset = (argc > 3) ? std::stod(argv[3]) : 600.;
|
||||
|
||||
// Compute the alpha and offset values
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -20,18 +20,26 @@ namespace CGAL {
|
|||
namespace Alpha_wraps_3 {
|
||||
namespace internal {
|
||||
|
||||
enum class Cell_label
|
||||
{
|
||||
// Cells that have been carved
|
||||
OUTSIDE,
|
||||
// Cells that have not yet been carved
|
||||
INSIDE,
|
||||
// OUTSIDE cells that have been labeled "inside" again as to make the result manifold
|
||||
MANIFOLD
|
||||
};
|
||||
|
||||
template < typename GT,
|
||||
typename Cb = CGAL::Delaunay_triangulation_cell_base_with_circumcenter_3<GT> >
|
||||
class Alpha_wrap_triangulation_cell_base_3
|
||||
: public Cb
|
||||
{
|
||||
private:
|
||||
bool outside = false;
|
||||
|
||||
public:
|
||||
typedef typename Cb::Vertex_handle Vertex_handle;
|
||||
typedef typename Cb::Cell_handle Cell_handle;
|
||||
|
||||
public:
|
||||
template < typename TDS2 >
|
||||
struct Rebind_TDS
|
||||
{
|
||||
|
|
@ -39,6 +47,14 @@ public:
|
|||
using Other = Alpha_wrap_triangulation_cell_base_3<GT, Cb2>;
|
||||
};
|
||||
|
||||
private:
|
||||
Cell_label m_label = Cell_label::INSIDE;
|
||||
|
||||
#ifndef CGAL_AW3_USE_SORTED_PRIORITY_QUEUE
|
||||
unsigned int m_erase_counter;
|
||||
#endif
|
||||
|
||||
public:
|
||||
Alpha_wrap_triangulation_cell_base_3()
|
||||
: Cb()
|
||||
{}
|
||||
|
|
@ -55,8 +71,26 @@ public:
|
|||
: Cb(v0, v1, v2, v3, n0, n1, n2, n3)
|
||||
{}
|
||||
|
||||
bool is_outside() const { return outside; }
|
||||
bool& is_outside() { return outside; }
|
||||
public:
|
||||
Cell_label label() const { return m_label; }
|
||||
void set_label(const Cell_label label) { m_label = label; }
|
||||
bool is_inside() const { return m_label == Cell_label::INSIDE; }
|
||||
bool is_outside() const { return m_label == Cell_label::OUTSIDE; }
|
||||
|
||||
#ifndef CGAL_AW3_USE_SORTED_PRIORITY_QUEUE
|
||||
unsigned int erase_counter() const
|
||||
{
|
||||
return m_erase_counter;
|
||||
}
|
||||
void set_erase_counter(unsigned int c)
|
||||
{
|
||||
m_erase_counter = c;
|
||||
}
|
||||
void increment_erase_counter()
|
||||
{
|
||||
++m_erase_counter;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename Cb>
|
||||
|
|
|
|||
|
|
@ -321,7 +321,6 @@ public:
|
|||
typename AABB_tree::Bounding_box bbox() const
|
||||
{
|
||||
CGAL_precondition(!empty());
|
||||
|
||||
return tree().bbox();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -41,6 +42,7 @@ struct PS_oracle_traits
|
|||
using Geom_traits = Alpha_wrap_AABB_geom_traits<GT_>; // Wrap the kernel to add Ball_3 + custom Do_intersect_3
|
||||
|
||||
using Points = std::vector<typename GT_::Point_3>;
|
||||
using Points_ptr = std::shared_ptr<Points>;
|
||||
using PR_iterator = typename Points::const_iterator;
|
||||
|
||||
using Primitive = AABB_primitive<PR_iterator,
|
||||
|
|
@ -69,26 +71,29 @@ public:
|
|||
|
||||
private:
|
||||
using Points = typename PSOT::Points;
|
||||
using Points_ptr = typename PSOT::Points_ptr;
|
||||
using AABB_tree = typename PSOT::AABB_tree;
|
||||
using Oracle_base = AABB_tree_oracle<Geom_traits, AABB_tree, CGAL::Default, BaseOracle>;
|
||||
|
||||
private:
|
||||
Points m_points;
|
||||
Points_ptr m_points_ptr;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
Point_set_oracle()
|
||||
: Oracle_base(BaseOracle(), Base_GT())
|
||||
{ }
|
||||
|
||||
Point_set_oracle(const BaseOracle& base_oracle,
|
||||
const Base_GT& gt = Base_GT())
|
||||
: Oracle_base(base_oracle, gt)
|
||||
{ }
|
||||
{
|
||||
m_points_ptr = std::make_shared<Points>();
|
||||
}
|
||||
|
||||
Point_set_oracle(const Base_GT& gt,
|
||||
const BaseOracle& base_oracle = BaseOracle())
|
||||
: Oracle_base(base_oracle, gt)
|
||||
: Point_set_oracle(base_oracle, gt)
|
||||
{ }
|
||||
|
||||
Point_set_oracle()
|
||||
: Point_set_oracle(BaseOracle(), Base_GT())
|
||||
{ }
|
||||
|
||||
public:
|
||||
|
|
@ -101,21 +106,27 @@ public:
|
|||
if(points.empty())
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Warning: Input is empty " << std::endl;
|
||||
std::cout << "Warning: Input is empty (PS)" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
const std::size_t old_size = m_points.size();
|
||||
m_points.insert(std::cend(m_points), std::cbegin(points), std::cend(points));
|
||||
const std::size_t old_size = m_points_ptr->size();
|
||||
m_points_ptr->insert(std::cend(*m_points_ptr), std::cbegin(points), std::cend(points));
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Insert into AABB tree (points)..." << std::endl;
|
||||
#endif
|
||||
|
||||
this->tree().insert(std::next(std::cbegin(m_points), old_size), std::cend(m_points));
|
||||
this->tree().insert(std::next(std::cbegin(*m_points_ptr), old_size), std::cend(*m_points_ptr));
|
||||
|
||||
CGAL_postcondition(this->tree().size() == m_points.size());
|
||||
// Manually constructing it here purely for profiling reasons: if we keep the lazy approach,
|
||||
// it will be done at the first treatment of a facet that needs a Steiner point.
|
||||
// So if one wanted to bench the flood fill runtime, it would be skewed by the time it takes
|
||||
// to accelerate the tree.
|
||||
this->tree().accelerate_distance_queries();
|
||||
|
||||
CGAL_postcondition(this->tree().size() == m_points_ptr->size());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -40,7 +41,9 @@ struct SS_oracle_traits
|
|||
{
|
||||
using Geom_traits = Alpha_wrap_AABB_geom_traits<GT_>; // Wrap the kernel to add Ball_3 + custom Do_intersect_3
|
||||
|
||||
using Segments = std::vector<typename GT_::Segment_3>;
|
||||
using Segment = typename GT_::Segment_3;
|
||||
using Segments = std::vector<Segment>;
|
||||
using Segments_ptr = std::shared_ptr<Segments>;
|
||||
using SR_iterator = typename Segments::const_iterator;
|
||||
|
||||
using Primitive = AABB_primitive<SR_iterator,
|
||||
|
|
@ -68,27 +71,31 @@ public:
|
|||
using Geom_traits = typename SSOT::Geom_traits;
|
||||
|
||||
private:
|
||||
using Segment = typename SSOT::Segment;
|
||||
using Segments = typename SSOT::Segments;
|
||||
using Segments_ptr = typename SSOT::Segments_ptr;
|
||||
using AABB_tree = typename SSOT::AABB_tree;
|
||||
using Oracle_base = AABB_tree_oracle<Geom_traits, AABB_tree, CGAL::Default, BaseOracle>;
|
||||
|
||||
private:
|
||||
Segments m_segments;
|
||||
Segments_ptr m_segments_ptr;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
Segment_soup_oracle()
|
||||
: Oracle_base(BaseOracle(), Base_GT())
|
||||
{ }
|
||||
|
||||
Segment_soup_oracle(const BaseOracle& base_oracle,
|
||||
const Base_GT& gt = Base_GT())
|
||||
: Oracle_base(base_oracle, gt)
|
||||
{ }
|
||||
{
|
||||
m_segments_ptr = std::make_shared<Segments>();
|
||||
}
|
||||
|
||||
Segment_soup_oracle(const Base_GT& gt,
|
||||
const BaseOracle& base_oracle = BaseOracle())
|
||||
: Oracle_base(base_oracle, gt)
|
||||
: Segment_soup_oracle(base_oracle, gt)
|
||||
{ }
|
||||
|
||||
Segment_soup_oracle()
|
||||
: Segment_soup_oracle(BaseOracle(), Base_GT())
|
||||
{ }
|
||||
|
||||
public:
|
||||
|
|
@ -100,20 +107,40 @@ public:
|
|||
if(segments.empty())
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Warning: Input is empty " << std::endl;
|
||||
std::cout << "Warning: Input is empty (SS)" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
const std::size_t old_size = m_segments.size();
|
||||
m_segments.insert(std::cend(m_segments), std::cbegin(segments), std::cend(segments));
|
||||
typename Geom_traits::Is_degenerate_3 is_degenerate = this->geom_traits().is_degenerate_3_object();
|
||||
|
||||
const std::size_t old_size = m_segments_ptr->size();
|
||||
|
||||
for(const Segment& s : segments)
|
||||
{
|
||||
if(is_degenerate(s))
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cerr << "Warning: ignoring degenerate segment " << s << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
m_segments_ptr->push_back(s);
|
||||
}
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Insert into AABB tree (segments)..." << std::endl;
|
||||
#endif
|
||||
this->tree().insert(std::next(std::cbegin(m_segments), old_size), std::cend(m_segments));
|
||||
this->tree().insert(std::next(std::cbegin(*m_segments_ptr), old_size), std::cend(*m_segments_ptr));
|
||||
|
||||
CGAL_postcondition(this->tree().size() == m_segments.size());
|
||||
// Manually constructing it here purely for profiling reasons: if we keep the lazy approach,
|
||||
// it will be done at the first treatment of a facet that needs a Steiner point.
|
||||
// So if one wanted to bench the flood fill runtime, it would be skewed by the time it takes
|
||||
// to accelerate the tree.
|
||||
this->tree().accelerate_distance_queries();
|
||||
|
||||
CGAL_postcondition(this->tree().size() == m_segments_ptr->size());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public:
|
|||
if(is_empty(tmesh))
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Warning: Input is empty " << std::endl;
|
||||
std::cout << "Warning: Input is empty (TM)" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
@ -153,7 +153,12 @@ public:
|
|||
for(face_descriptor f : faces(tmesh))
|
||||
{
|
||||
if(Polygon_mesh_processing::is_degenerate_triangle_face(f, tmesh, np))
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cerr << "Warning: ignoring degenerate face " << f << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
const Point_ref p0 = get(vpm, source(halfedge(f, tmesh), tmesh));
|
||||
const Point_ref p1 = get(vpm, target(halfedge(f, tmesh), tmesh));
|
||||
|
|
@ -164,6 +169,12 @@ public:
|
|||
Splitter_base::split_and_insert_datum(tr, this->tree(), this->geom_traits());
|
||||
}
|
||||
|
||||
// Manually constructing it here purely for profiling reasons: if we keep the lazy approach,
|
||||
// it will be done at the first treatment of a facet that needs a Steiner point.
|
||||
// So if one wanted to bench the flood fill runtime, it would be skewed by the time it takes
|
||||
// to accelerate the tree.
|
||||
this->tree().accelerate_distance_queries();
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Tree: " << this->tree().size() << " primitives (" << num_faces(tmesh) << " faces in input)" << std::endl;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public:
|
|||
if(points.empty() || faces.empty())
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Warning: Input is empty " << std::endl;
|
||||
std::cout << "Warning: Input is empty (TS)" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
@ -164,11 +164,22 @@ public:
|
|||
|
||||
const Triangle_3 tr = triangle(p0, p1, p2);
|
||||
if(is_degenerate(tr))
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cerr << "Warning: ignoring degenerate face " << tr << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
Splitter_base::split_and_insert_datum(tr, this->tree(), this->geom_traits());
|
||||
}
|
||||
|
||||
// Manually constructing it here purely for profiling reasons: if we keep the lazy approach,
|
||||
// it will be done at the first treatment of a facet that needs a Steiner point.
|
||||
// So if one wanted to bench the flood fill runtime, it would be skewed by the time it takes
|
||||
// to accelerate the tree.
|
||||
this->tree().accelerate_distance_queries();
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Tree: " << this->tree().size() << " primitives (" << faces.size() << " faces in input)" << std::endl;
|
||||
#endif
|
||||
|
|
@ -179,12 +190,31 @@ public:
|
|||
void add_triangle_soup(const TriangleRange& triangles,
|
||||
const CGAL_NP_CLASS& /*np*/ = CGAL::parameters::default_values())
|
||||
{
|
||||
if(triangles.empty())
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Warning: Input is empty (TS)" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cout << "Insert into AABB Tree (triangles)..." << std::endl;
|
||||
#endif
|
||||
|
||||
typename Geom_traits::Is_degenerate_3 is_degenerate = this->geom_traits().is_degenerate_3_object();
|
||||
|
||||
Splitter_base::reserve(triangles.size());
|
||||
|
||||
for(const Triangle_3& tr : triangles)
|
||||
{
|
||||
if(is_degenerate(tr))
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG
|
||||
std::cerr << "Warning: ignoring degenerate triangle " << tr << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
Splitter_base::split_and_insert_datum(tr, this->tree(), this->geom_traits());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,27 +27,29 @@ namespace CGAL {
|
|||
namespace Alpha_wraps_3 {
|
||||
namespace internal {
|
||||
|
||||
#ifdef CGAL_AW3_USE_SORTED_PRIORITY_QUEUE
|
||||
|
||||
// Represents an alpha-traversable facet in the mutable priority queue
|
||||
template <typename DT3>
|
||||
template <typename Tr>
|
||||
class Gate
|
||||
{
|
||||
using Facet = typename DT3::Facet;
|
||||
using FT = typename DT3::Geom_traits::FT;
|
||||
using Facet = typename Tr::Facet;
|
||||
using FT = typename Tr::Geom_traits::FT;
|
||||
|
||||
private:
|
||||
Facet m_facet;
|
||||
FT m_priority; // circumsphere sq_radius
|
||||
bool m_is_artificial_facet;
|
||||
bool m_is_permissive_facet;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
Gate(const Facet& facet,
|
||||
const FT& priority,
|
||||
const bool is_artificial_facet)
|
||||
const bool is_permissive_facet)
|
||||
:
|
||||
m_facet(facet),
|
||||
m_priority(priority),
|
||||
m_is_artificial_facet(is_artificial_facet)
|
||||
m_is_permissive_facet(is_permissive_facet)
|
||||
{
|
||||
CGAL_assertion(priority >= 0);
|
||||
}
|
||||
|
|
@ -60,34 +62,85 @@ public:
|
|||
public:
|
||||
const Facet& facet() const { return m_facet; }
|
||||
const FT& priority() const { return m_priority; }
|
||||
bool is_artificial_facet() const { return m_is_artificial_facet; }
|
||||
bool is_permissive_facet() const { return m_is_permissive_facet; }
|
||||
};
|
||||
|
||||
struct Less_gate
|
||||
{
|
||||
template <typename DT3>
|
||||
bool operator()(const Gate<DT3>& a, const Gate<DT3>& b) const
|
||||
template <typename Tr>
|
||||
bool operator()(const Gate<Tr>& a, const Gate<Tr>& b) const
|
||||
{
|
||||
// @fixme? make it a total order by comparing addresses if both gates are bbox facets
|
||||
if(a.is_artificial_facet())
|
||||
return true;
|
||||
else if(b.is_artificial_facet())
|
||||
return false;
|
||||
// If one is permissive and the other is not, give priority to the permissive facet.
|
||||
//
|
||||
// The permissive facet are given highest priority because they need to be treated
|
||||
// regardless of their circumradius. Treating them first allow the part that depends
|
||||
// on alpha to be treated uniformly in a way: whatever the alpha, all permissive faces
|
||||
// will first be treated.
|
||||
if(a.is_permissive_facet() != b.is_permissive_facet())
|
||||
return a.is_permissive_facet();
|
||||
|
||||
if(a.priority() == b.priority())
|
||||
{
|
||||
// arbitrary, the sole purpose is to make it a total order for determinism
|
||||
if(a.facet().first->time_stamp() == b.facet().first->time_stamp())
|
||||
return a.facet().second < b.facet().second;
|
||||
|
||||
return a.facet().first->time_stamp() < b.facet().first->time_stamp();
|
||||
}
|
||||
|
||||
return a.priority() > b.priority();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename DT3>
|
||||
#else // CGAL_AW3_USE_SORTED_PRIORITY_QUEUE
|
||||
|
||||
// Represents an alpha-traversable facet in the mutable priority queue
|
||||
template <typename Tr>
|
||||
class Gate
|
||||
{
|
||||
using Facet = typename Tr::Facet;
|
||||
using FT = typename Tr::Geom_traits::FT;
|
||||
|
||||
private:
|
||||
Facet m_facet, m_mirror_facet;
|
||||
const unsigned int m_erase_counter_mem;
|
||||
const unsigned int m_mirror_erase_counter_mem;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
Gate(const Facet& facet,
|
||||
const Tr& tr)
|
||||
:
|
||||
m_facet(facet),
|
||||
m_mirror_facet(tr.mirror_facet(facet)),
|
||||
m_erase_counter_mem(m_facet.first->erase_counter()),
|
||||
m_mirror_erase_counter_mem(m_mirror_facet.first->erase_counter())
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
const Facet& facet() const { return m_facet; }
|
||||
|
||||
bool is_zombie() const
|
||||
{
|
||||
return (m_facet.first->erase_counter() != m_erase_counter_mem) ||
|
||||
(m_mirror_facet.first->erase_counter() != m_mirror_erase_counter_mem);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CGAL_AW3_USE_SORTED_PRIORITY_QUEUE
|
||||
|
||||
template <typename Tr>
|
||||
struct Gate_ID_PM
|
||||
{
|
||||
using key_type = Gate<DT3>;
|
||||
using key_type = Gate<Tr>;
|
||||
using value_type = std::size_t;
|
||||
using reference = std::size_t;
|
||||
using category = boost::readable_property_map_tag;
|
||||
|
||||
inline friend value_type get(Gate_ID_PM, const key_type& k)
|
||||
{
|
||||
using Facet = typename DT3::Facet;
|
||||
using Facet = typename Tr::Facet;
|
||||
|
||||
const Facet& f = k.facet();
|
||||
return (4 * f.first->time_stamp() + f.second);
|
||||
|
|
|
|||
|
|
@ -40,16 +40,16 @@ struct Orientation_of_circumcenter
|
|||
}
|
||||
};
|
||||
|
||||
template <typename Dt>
|
||||
template <typename Tr>
|
||||
bool
|
||||
less_squared_radius_of_min_empty_sphere(typename Dt::Geom_traits::FT sq_alpha,
|
||||
const typename Dt::Facet& fh,
|
||||
const Dt& dt)
|
||||
less_squared_radius_of_min_empty_sphere(typename Tr::Geom_traits::FT sq_alpha,
|
||||
const typename Tr::Facet& fh,
|
||||
const Tr& tr)
|
||||
{
|
||||
using Cell_handle = typename Dt::Cell_handle;
|
||||
using Point = typename Dt::Point;
|
||||
using Cell_handle = typename Tr::Cell_handle;
|
||||
using Point = typename Tr::Point;
|
||||
|
||||
using CK = typename Dt::Geom_traits;
|
||||
using CK = typename Tr::Geom_traits;
|
||||
using Exact_kernel = typename Exact_kernel_selector<CK>::Exact_kernel;
|
||||
using Approximate_kernel = Simple_cartesian<Interval_nt_advanced>;
|
||||
using C2A = Cartesian_converter<CK, Approximate_kernel>;
|
||||
|
|
@ -61,21 +61,30 @@ less_squared_radius_of_min_empty_sphere(typename Dt::Geom_traits::FT sq_alpha,
|
|||
|
||||
Orientation_of_circumcenter orientation_of_circumcenter;
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "Checking for traversability of facet" << std::endl;
|
||||
#endif
|
||||
|
||||
const Cell_handle c = fh.first;
|
||||
const int ic = fh.second;
|
||||
const Cell_handle n = c->neighbor(ic);
|
||||
|
||||
const Point& p1 = dt.point(c, Dt::vertex_triple_index(ic,0));
|
||||
const Point& p2 = dt.point(c, Dt::vertex_triple_index(ic,1));
|
||||
const Point& p3 = dt.point(c, Dt::vertex_triple_index(ic,2));
|
||||
const Point& p1 = tr.point(c, Tr::vertex_triple_index(ic,0));
|
||||
const Point& p2 = tr.point(c, Tr::vertex_triple_index(ic,1));
|
||||
const Point& p3 = tr.point(c, Tr::vertex_triple_index(ic,2));
|
||||
|
||||
// This is not actually possible in the context of alpha wrapping, but keeping it for genericity
|
||||
// and because it does not cost anything.
|
||||
if(dt.is_infinite(n))
|
||||
if(tr.is_infinite(n))
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cerr << "Warning: computing less_squared_radius_of_min_empty_sphere() with an infinite neighbor?" << std::endl;
|
||||
#endif
|
||||
CGAL_assertion(!tr.is_infinite(c));
|
||||
|
||||
Orientation ori = orientation_of_circumcenter(p1, p2, p3,
|
||||
dt.point(c, 0), dt.point(c, 1),
|
||||
dt.point(c, 2), dt.point(c, 3));
|
||||
tr.point(c, 0), tr.point(c, 1),
|
||||
tr.point(c, 2), tr.point(c, 3));
|
||||
|
||||
if(ori == POSITIVE)
|
||||
{
|
||||
|
|
@ -84,18 +93,22 @@ less_squared_radius_of_min_empty_sphere(typename Dt::Geom_traits::FT sq_alpha,
|
|||
}
|
||||
else
|
||||
{
|
||||
Comparison_result cr = compare_squared_radius(dt.point(c, 0), dt.point(c, 1),
|
||||
dt.point(c, 2), dt.point(c, 3),
|
||||
Comparison_result cr = compare_squared_radius(tr.point(c, 0), tr.point(c, 1),
|
||||
tr.point(c, 2), tr.point(c, 3),
|
||||
sq_alpha);
|
||||
return cr == LARGER;
|
||||
}
|
||||
}
|
||||
|
||||
if(dt.is_infinite(c))
|
||||
if(tr.is_infinite(c))
|
||||
{
|
||||
Orientation ori = orientation_of_circumcenter(p1, p2, p3,
|
||||
dt.point(n, 0), dt.point(n, 1),
|
||||
dt.point(n, 2), dt.point(n, 3));
|
||||
tr.point(n, 0), tr.point(n, 1),
|
||||
tr.point(n, 2), tr.point(n, 3));
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "Cell 'c' is infinite; Orientation: " << ori << std::endl;
|
||||
#endif
|
||||
|
||||
if(ori == NEGATIVE)
|
||||
{
|
||||
|
|
@ -104,8 +117,8 @@ less_squared_radius_of_min_empty_sphere(typename Dt::Geom_traits::FT sq_alpha,
|
|||
}
|
||||
else
|
||||
{
|
||||
Comparison_result cr = compare_squared_radius(dt.point(n, 0), dt.point(n, 1),
|
||||
dt.point(n, 2), dt.point(n, 3),
|
||||
Comparison_result cr = compare_squared_radius(tr.point(n, 0), tr.point(n, 1),
|
||||
tr.point(n, 2), tr.point(n, 3),
|
||||
sq_alpha);
|
||||
return cr == LARGER;
|
||||
}
|
||||
|
|
@ -113,40 +126,40 @@ less_squared_radius_of_min_empty_sphere(typename Dt::Geom_traits::FT sq_alpha,
|
|||
|
||||
// both c and n are finite
|
||||
if(orientation_of_circumcenter(p1, p2, p3,
|
||||
dt.point(c, 0), dt.point(c, 1), dt.point(c, 2), dt.point(c, 3)) !=
|
||||
tr.point(c, 0), tr.point(c, 1), tr.point(c, 2), tr.point(c, 3)) !=
|
||||
orientation_of_circumcenter(p1, p2, p3,
|
||||
dt.point(n, 0), dt.point(n, 1), dt.point(n, 2), dt.point(n, 3)))
|
||||
tr.point(n, 0), tr.point(n, 1), tr.point(n, 2), tr.point(n, 3)))
|
||||
{
|
||||
Comparison_result cr = compare_squared_radius(p1, p2, p3, sq_alpha);
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "dual crosses the face; CR: "
|
||||
<< typename Dt::Geom_traits().compute_squared_radius_3_object()(p1, p2, p3)
|
||||
<< typename Tr::Geom_traits().compute_squared_radius_3_object()(p1, p2, p3)
|
||||
<< " sq alpha " << sq_alpha << std::endl;
|
||||
#endif
|
||||
return cr == LARGER;
|
||||
}
|
||||
else
|
||||
{
|
||||
Comparison_result cr = compare_squared_radius(dt.point(c, 0), dt.point(c, 1),
|
||||
dt.point(c, 2), dt.point(c, 3),
|
||||
Comparison_result cr = compare_squared_radius(tr.point(c, 0), tr.point(c, 1),
|
||||
tr.point(c, 2), tr.point(c, 3),
|
||||
sq_alpha);
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "dual does not cross the face; CR(c): "
|
||||
<< typename Dt::Geom_traits().compute_squared_radius_3_object()(dt.point(c, 0), dt.point(c, 1),
|
||||
dt.point(c, 2), dt.point(c, 3))
|
||||
<< typename Tr::Geom_traits().compute_squared_radius_3_object()(tr.point(c, 0), tr.point(c, 1),
|
||||
tr.point(c, 2), tr.point(c, 3))
|
||||
<< " sq alpha " << sq_alpha << std::endl;
|
||||
#endif
|
||||
|
||||
if(cr != LARGER)
|
||||
return false;
|
||||
|
||||
cr = compare_squared_radius(dt.point(n, 0), dt.point(n, 1),
|
||||
dt.point(n, 2), dt.point(n, 3),
|
||||
cr = compare_squared_radius(tr.point(n, 0), tr.point(n, 1),
|
||||
tr.point(n, 2), tr.point(n, 3),
|
||||
sq_alpha);
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "dual does not cross the face; CR(n): "
|
||||
<< typename Dt::Geom_traits().compute_squared_radius_3_object()(dt.point(n, 0), dt.point(n, 1),
|
||||
dt.point(n, 2), dt.point(n, 3))
|
||||
<< typename Tr::Geom_traits().compute_squared_radius_3_object()(tr.point(n, 0), tr.point(n, 1),
|
||||
tr.point(n, 2), tr.point(n, 3))
|
||||
<< " sq alpha " << sq_alpha << std::endl;
|
||||
#endif
|
||||
|
||||
|
|
@ -154,6 +167,100 @@ less_squared_radius_of_min_empty_sphere(typename Dt::Geom_traits::FT sq_alpha,
|
|||
}
|
||||
}
|
||||
|
||||
template <typename Tr>
|
||||
typename Tr::Geom_traits::FT
|
||||
smallest_squared_radius_3(const typename Tr::Facet& fh,
|
||||
const Tr& tr)
|
||||
{
|
||||
using Cell_handle = typename Tr::Cell_handle;
|
||||
using Point = typename Tr::Point;
|
||||
using FT = typename Tr::Geom_traits::FT;
|
||||
|
||||
using CK = typename Tr::Geom_traits;
|
||||
using Exact_kernel = typename Exact_kernel_selector<CK>::Exact_kernel;
|
||||
using Approximate_kernel = Simple_cartesian<Interval_nt_advanced>;
|
||||
using C2A = Cartesian_converter<CK, Approximate_kernel>;
|
||||
using C2E = typename Exact_kernel_selector<CK>::C2E;
|
||||
|
||||
using Orientation_of_circumcenter = Filtered_predicate<Orientation_of_circumcenter<Exact_kernel>,
|
||||
Orientation_of_circumcenter<Approximate_kernel>,
|
||||
C2E, C2A>;
|
||||
|
||||
Orientation_of_circumcenter orientation_of_circumcenter;
|
||||
|
||||
auto squared_radius = tr.geom_traits().compute_squared_radius_3_object();
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "Computing circumradius of facet" << std::endl;
|
||||
#endif
|
||||
|
||||
CGAL_precondition(!tr.is_infinite(fh));
|
||||
|
||||
const Cell_handle c = fh.first;
|
||||
const int ic = fh.second;
|
||||
const Cell_handle n = c->neighbor(ic);
|
||||
|
||||
const Point& p1 = tr.point(c, Tr::vertex_triple_index(ic,0));
|
||||
const Point& p2 = tr.point(c, Tr::vertex_triple_index(ic,1));
|
||||
const Point& p3 = tr.point(c, Tr::vertex_triple_index(ic,2));
|
||||
|
||||
// This is not actually possible in the context of alpha wrapping, but keeping it for genericity
|
||||
// and because it does not cost anything.
|
||||
if(tr.is_infinite(n))
|
||||
{
|
||||
CGAL_assertion(!tr.is_infinite(c));
|
||||
|
||||
Orientation ori = orientation_of_circumcenter(p1, p2, p3,
|
||||
tr.point(c, 0), tr.point(c, 1),
|
||||
tr.point(c, 2), tr.point(c, 3));
|
||||
if(ori == POSITIVE)
|
||||
return squared_radius(p1, p2, p3);
|
||||
else
|
||||
return squared_radius(tr.point(c, 0), tr.point(c, 1), tr.point(c, 2), tr.point(c, 3));
|
||||
}
|
||||
|
||||
if(tr.is_infinite(c))
|
||||
{
|
||||
Orientation ori = orientation_of_circumcenter(p1, p2, p3,
|
||||
tr.point(n, 0), tr.point(n, 1),
|
||||
tr.point(n, 2), tr.point(n, 3));
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "Cell 'c' is infinite; Orientation: " << ori << std::endl;
|
||||
#endif
|
||||
|
||||
if(ori == NEGATIVE)
|
||||
return squared_radius(p1, p2, p3);
|
||||
else
|
||||
return squared_radius(tr.point(n, 0), tr.point(n, 1), tr.point(n, 2), tr.point(n, 3));
|
||||
}
|
||||
|
||||
// both c and n are finite
|
||||
if(orientation_of_circumcenter(p1, p2, p3,
|
||||
tr.point(c, 0), tr.point(c, 1), tr.point(c, 2), tr.point(c, 3)) !=
|
||||
orientation_of_circumcenter(p1, p2, p3,
|
||||
tr.point(n, 0), tr.point(n, 1), tr.point(n, 2), tr.point(n, 3)))
|
||||
{
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "dual crosses the face; CR: " << squared_radius(p1, p2, p3) << std::endl;
|
||||
#endif
|
||||
|
||||
return squared_radius(p1, p2, p3);
|
||||
}
|
||||
else
|
||||
{
|
||||
const FT cr = squared_radius(tr.point(c, 0), tr.point(c, 1), tr.point(c, 2), tr.point(c, 3));
|
||||
const FT cnr = squared_radius(tr.point(n, 0), tr.point(n, 1), tr.point(n, 2), tr.point(n, 3));
|
||||
|
||||
#ifdef CGAL_AW3_DEBUG_TRAVERSABILITY
|
||||
std::cout << "dual does not cross the face; CR(c): " << cr << " CRn: " << cnr << std::endl;
|
||||
#endif
|
||||
|
||||
return (CGAL::min)(cr, cnr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Alpha_wraps_3
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ bool has_expected_Hausdorff_distance(const TriangleMesh& wrap,
|
|||
|
||||
template <typename TriangleMesh, typename NamedParameters = parameters::Default_named_parameters>
|
||||
bool is_valid_wrap(const TriangleMesh& wrap,
|
||||
const bool check_manifoldness = true,
|
||||
const bool check_manifoldness,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
|
@ -203,6 +203,13 @@ bool is_valid_wrap(const TriangleMesh& wrap,
|
|||
return true;
|
||||
}
|
||||
|
||||
template <typename TriangleMesh, typename NamedParameters = parameters::Default_named_parameters>
|
||||
bool is_valid_wrap(const TriangleMesh& wrap,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
return is_valid_wrap(wrap, true /*consider manifoldness*/, np);
|
||||
}
|
||||
|
||||
template <typename InputTriangleMesh, typename OutputTriangleMesh,
|
||||
typename InputNamedParameters = parameters::Default_named_parameters,
|
||||
typename OutputNamedParameters = parameters::Default_named_parameters>
|
||||
|
|
@ -105,7 +105,7 @@ void alpha_wrap_3(const PointRange& points,
|
|||
using NP_helper = Point_set_processing_3_np_helper<PointRange, InputNamedParameters>;
|
||||
using Geom_traits = typename NP_helper::Geom_traits;
|
||||
using Oracle = Alpha_wraps_3::internal::Triangle_soup_oracle<Geom_traits>;
|
||||
using AW3 = Alpha_wraps_3::internal::Alpha_wrap_3<Oracle>;
|
||||
using AW3 = Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle>;
|
||||
|
||||
Geom_traits gt = choose_parameter<Geom_traits>(get_parameter(in_np, internal_np::geom_traits));
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ void alpha_wrap_3(const TriangleMesh& tmesh,
|
|||
|
||||
using Geom_traits = typename GetGeomTraits<TriangleMesh, InputNamedParameters>::type;
|
||||
using Oracle = Alpha_wraps_3::internal::Triangle_mesh_oracle<Geom_traits>;
|
||||
using AW3 = Alpha_wraps_3::internal::Alpha_wrap_3<Oracle>;
|
||||
using AW3 = Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle>;
|
||||
|
||||
Geom_traits gt = choose_parameter<Geom_traits>(get_parameter(in_np, internal_np::geom_traits));
|
||||
|
||||
|
|
@ -350,7 +350,7 @@ void alpha_wrap_3(const PointRange& points,
|
|||
using NP_helper = Point_set_processing_3_np_helper<PointRange, InputNamedParameters>;
|
||||
using Geom_traits = typename NP_helper::Geom_traits;
|
||||
using Oracle = Alpha_wraps_3::internal::Point_set_oracle<Geom_traits>;
|
||||
using AW3 = Alpha_wraps_3::internal::Alpha_wrap_3<Oracle>;
|
||||
using AW3 = Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle>;
|
||||
|
||||
Geom_traits gt = choose_parameter<Geom_traits>(get_parameter(in_np, internal_np::geom_traits));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
#define CGAL_AW3_TIMER
|
||||
#define CGAL_AW3_DEBUG
|
||||
#define CGAL_AW3_DEBUG_MANIFOLDNESS
|
||||
// #define CGAL_AW3_DEBUG_INITIALIZATION
|
||||
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
#include "alpha_wrap_validation.h"
|
||||
#include <CGAL/Alpha_wrap_3/internal/validation.h>
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ void generate_random_seeds(const Oracle& oracle,
|
|||
Seeds& seeds,
|
||||
CGAL::Random& r)
|
||||
{
|
||||
const auto bbox = CGAL::Alpha_wraps_3::internal::Alpha_wrap_3<Oracle>(oracle).construct_bbox(offset);
|
||||
const auto bbox = CGAL::Alpha_wraps_3::internal::Alpha_wrapper_3<Oracle>(oracle).construct_bbox(offset);
|
||||
const double sq_offset = CGAL::square(offset);
|
||||
|
||||
while(seeds.size() < 3)
|
||||
|
|
@ -69,7 +70,7 @@ void alpha_wrap_triangle_mesh(Mesh& input_mesh,
|
|||
|
||||
Oracle oracle;
|
||||
oracle.add_triangle_mesh(input_mesh);
|
||||
AW3::internal::Alpha_wrap_3<Oracle> aw3(oracle);
|
||||
AW3::internal::Alpha_wrapper_3<Oracle> aw3(oracle);
|
||||
|
||||
if(seeds.empty())
|
||||
generate_random_seeds(oracle, offset, seeds, r);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#define CGAL_AW3_TIMER
|
||||
#define CGAL_AW3_DEBUG
|
||||
#define CGAL_AW3_DEBUG_MANIFOLDNESS
|
||||
//#define CGAL_AW3_DEBUG_STEINER_COMPUTATION
|
||||
//#define CGAL_AW3_DEBUG_INITIALIZATION
|
||||
//#define CGAL_AW3_DEBUG_QUEUE
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
#include "alpha_wrap_validation.h"
|
||||
#include <CGAL/Alpha_wrap_3/internal/validation.h>
|
||||
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
#define CGAL_AW3_TIMER
|
||||
#define CGAL_AW3_DEBUG
|
||||
#define CGAL_AW3_DEBUG_MANIFOLDNESS
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
#include "alpha_wrap_validation.h"
|
||||
#include <CGAL/Alpha_wrap_3/internal/validation.h>
|
||||
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/IO/polygon_soup_io.h>
|
||||
|
|
@ -52,7 +53,7 @@ void alpha_wrap_triangle_soup(Points& pr,
|
|||
// AW3
|
||||
Oracle oracle;
|
||||
oracle.add_triangle_soup(pr, fr);
|
||||
AW3::internal::Alpha_wrap_3<Oracle> aw3(oracle);
|
||||
AW3::internal::Alpha_wrapper_3<Oracle> aw3(oracle);
|
||||
|
||||
Mesh wrap;
|
||||
aw3(alpha, offset, wrap, CGAL::parameters::do_enforce_manifoldness(false));
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#define CGAL_AW3_TIMER
|
||||
//#define CGAL_AW3_DEBUG
|
||||
//#define CGAL_AW3_DEBUG_MANIFOLDNESS
|
||||
#define CGAL_AW3_DEBUG_MANIFOLDNESS
|
||||
//#define CGAL_AW3_DEBUG_STEINER_COMPUTATION
|
||||
//#define CGAL_AW3_DEBUG_INITIALIZATION
|
||||
//#define CGAL_AW3_DEBUG_QUEUE
|
||||
|
||||
#include <CGAL/alpha_wrap_3.h>
|
||||
#include "alpha_wrap_validation.h"
|
||||
#include <CGAL/Alpha_wrap_3/internal/validation.h>
|
||||
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
|
|
|||
|
|
@ -2,98 +2,95 @@
|
|||
\input{header}
|
||||
\pagestyle{empty}
|
||||
\begin{document}
|
||||
\psscalebox{1.8}{\arrset{0.8}
|
||||
\pspicture[](-0.2,-0.2)(12.2,12.2)
|
||||
%\psgrid(0,0)(12,12)
|
||||
\arrMainVertex( 1, 3){a}
|
||||
\arrMainVertex( 2, 4){b}
|
||||
\arrMainVertex( 0, 6){c}
|
||||
\arrv[90](5,11){1}
|
||||
\arrMainVertex(9,11){f}
|
||||
\arrMainVertex(12, 8){g}
|
||||
\arrv[-60](8,8){2}
|
||||
\arrMainVertex( 8, 4){i}
|
||||
\arrMainVertex( 6, 4){j}
|
||||
\arrMainVertex( 6, 2){k}
|
||||
\arrMainVertex( 4, 0){m}
|
||||
\arrMainVertex( 9, 0){n}
|
||||
\arrMainVertex(11, 2){o}
|
||||
\arrMainVertex(12, 4){p}
|
||||
\arrMainVertex(12, 0){q}
|
||||
\arrMainVertex( 4, 2){r}
|
||||
\arrMainVertex( 3, 3){s}
|
||||
\arrMainVertex( 5, 3){t}
|
||||
\begin{tikzpicture}[scale=1.0,thick]
|
||||
\node[point] at ( 1, 3) (a) {};
|
||||
\node[point] at ( 2, 4) (b) {};
|
||||
\node[point] at ( 0, 6) (c) {};
|
||||
\node [point,label={[label distance=0pt]90:{$v_1$}}] at ( 5,11) (1) {};
|
||||
\node[point] at ( 9,11) (f) {};
|
||||
\node[point] at (12, 8) (g) {};
|
||||
\node [point,label={[label distance=0pt]-45:{$v_2$}}] at ( 8, 8) (2) {};
|
||||
\node[point] at ( 8, 4) (i) {};
|
||||
\node[point] at ( 6, 4) (j) {};
|
||||
\node[point] at ( 6, 2) (k) {};
|
||||
\node[point] at ( 4, 0) (m) {};
|
||||
\node[point] at ( 9, 0) (n) {};
|
||||
\node[point] at (11, 2) (o) {};
|
||||
\node[point] at (12, 4) (p) {};
|
||||
\node[point] at (12, 0) (q) {};
|
||||
\node[point] at ( 4, 2) (r) {};
|
||||
\node[point] at ( 3, 3) (s) {};
|
||||
\node[point] at ( 5, 3) (t) {};
|
||||
%
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{a}{b}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{c}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{c}{1}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{1}{f}
|
||||
\ncline[linewidth=0.5pt,offset=3pt,nodesepB=6pt]{->}{f}{1}\Aput[1pt]{$e_{\mathrm{prev}}$}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{f}{g}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{g}{2}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{g}{2}
|
||||
\ncline[linewidth=0.5pt,offset=3pt,nodesepB=4pt]{->}{2}{g}\Aput[1pt]{$e_{\mathrm{next}}$}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{2}{i}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{i}{j}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{j}{k}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{k}{m}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{m}{a}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{1}{2}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{g}{i}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{m}{n}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{n}{i}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{g}{n}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{n}{o}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{o}{p}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{p}{q}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{q}{o}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{r}{s}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{r}{s}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{s}{r}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{r}{t}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{r}{t}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{t}{r}
|
||||
\draw[blue] (a)--(b);
|
||||
\draw[blue] (b)--(c);
|
||||
\draw[blue] (c)--(1);
|
||||
\draw[blue] (1)--(f);
|
||||
\draw [halfedge,shorten >=4pt] (f) to node[sloped,below]{$e_{\mathrm{prev}}$} (1);
|
||||
\draw[blue] (f)--(g);
|
||||
\draw[blue] (g)--(2);
|
||||
\draw [halfedge,shorten >=4pt] (2) to node[sloped,above]{$e_{\mathrm{next}}$} (g);
|
||||
\draw[blue] (2)--(i);
|
||||
\draw[blue] (i)--(j);
|
||||
\draw[blue] (j)--(k);
|
||||
\draw[blue] (k)--(m);
|
||||
\draw[blue] (m)--(a);
|
||||
\draw[blue] (1)--(2);
|
||||
\draw[blue] (g)--(i);
|
||||
\draw[blue] (m)--(n);
|
||||
\draw[blue] (n)--(i);
|
||||
\draw[blue] (g)--(n);
|
||||
\draw[blue] (n)--(o);
|
||||
\draw[blue] (o)--(p);
|
||||
\draw[blue] (p)--(q);
|
||||
\draw[blue] (q)--(o);
|
||||
\draw[blue] (r)--(s);
|
||||
%
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{b}{a}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{c}{b}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{1}{c}
|
||||
\ncline[linewidth=0.5pt,offset=3pt,nodesepA=4pt]{->}{g}{f}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{i}{2}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{j}{i}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{k}{j}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{m}{k}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{a}{m}
|
||||
\ncline[linewidth=0.5pt,offset=3pt,nodesepA=6pt]{->}{1}{2}\Aput[1pt]{$e$}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{2}{1}\Aput[1pt]{$e'$}
|
||||
\path [halfedge] (r) edge (s);
|
||||
\path [halfedge] (s) edge (r);
|
||||
\draw [blue] (r)--(t);
|
||||
\path [halfedge] (r) edge (t);
|
||||
\path [halfedge] (t) edge (r);
|
||||
%
|
||||
\rput(2,10){$f_0$}
|
||||
\rput(3,4){$f_1$}
|
||||
\rput(8.5,9.5){$f_2$}
|
||||
\rput(5,7){$f_3$}
|
||||
\rput(4.5,5.6){$f_4$}
|
||||
\path [halfedge] (b) edge (a);
|
||||
\path [halfedge] (c) edge (b);
|
||||
\path [halfedge] (1) edge (c);
|
||||
\path [halfedge,shorten <=4pt] (g) edge (f);
|
||||
\path [halfedge] (i) edge (2);
|
||||
\path [halfedge] (j) edge (i);
|
||||
\path [halfedge] (k) edge (j);
|
||||
\path [halfedge] (m) edge (k);
|
||||
\path [halfedge] (a) edge (m);
|
||||
\draw [halfedge,shorten <=4pt] (1) to node[sloped,above=-1pt]{$e$} (2);
|
||||
\draw [halfedge] (2) to node[sloped,below=-1pt]{$e'$} (1);
|
||||
%
|
||||
\arru[90](2,6){1}
|
||||
\arru[90](5,9){2}
|
||||
\node at (2,10){$f_0$};
|
||||
\node at (3,4){$f_1$};
|
||||
\node at (8.5,9.5){$f_2$};
|
||||
\node at (5,7){$f_3$};
|
||||
\node at (4.5,5.6){$f_4$};
|
||||
%
|
||||
\arrMainVertex(4,5){a}
|
||||
\arrMainVertex(4,7){b}
|
||||
\arrMainVertex(5,8){c}
|
||||
\arrMainVertex(5,4){f}
|
||||
\arrMainVertex(5,6){e}
|
||||
\arrMainVertex(6,7){d}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{a}{b}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{c}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{c}{d}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{d}{e}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{e}{f}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{f}{a}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{e}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{a}{b}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{b}{c}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{c}{d}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{d}{e}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{e}{f}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{f}{a}
|
||||
\endpspicture
|
||||
}
|
||||
\node [point,label={[label distance=0pt]90:{$u_1$}}] at (2,6) (1) {};
|
||||
\node [point,label={[label distance=0pt]90:{$u_2$}}] at (5,9) (1) {};
|
||||
%
|
||||
\node[point] at (4,5) (a) {};
|
||||
\node[point] at (4,7) (b) {};
|
||||
\node[point] at (5,8) (c) {};
|
||||
\node[point] at (5,4) (f) {};
|
||||
\node[point] at (5,6) (e) {};
|
||||
\node[point] at (6,7) (d) {};
|
||||
\draw[blue] (a)--(b);
|
||||
\draw[blue] (b)--(c);
|
||||
\draw[blue] (c)--(d);
|
||||
\draw[blue] (d)--(e);
|
||||
\draw[blue] (e)--(f);
|
||||
\draw[blue] (f)--(a);
|
||||
\draw[blue] (b)--(e);
|
||||
\path [halfedge] (a) edge (b);
|
||||
\path [halfedge] (b) edge (c);
|
||||
\path [halfedge] (c) edge (d);
|
||||
\path [halfedge] (d) edge (e);
|
||||
\path [halfedge] (e) edge (f);
|
||||
\path [halfedge] (f) edge (a);
|
||||
\end{tikzpicture}%
|
||||
\end{document}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
\input{header}
|
||||
\pagestyle{empty}
|
||||
\begin{document}
|
||||
\psscalebox{1.8}{\arrset{1}%
|
||||
\psscalebox{1}{\arrset{1}%
|
||||
\def\bodyBezier{
|
||||
\psline[linecolor=blue](2295,5175)(2492.01,5062.83)(2677.89,4983.16)(2854.44,4929.86)(3023.31,4897.62)(3185.98,4881.79)(3343.77,4878.41)(3497.83,4884.1)(3649.2,4896.04)(3798.76,4911.9)(3947.28,4929.78)(4095.39,4948.19)(4243.63,4965.94)(4392.4,4982.15)(4542.04,4996.13)(4692.77,5007.39)(4844.74,5015.54)(4998.01,5020.26)(5152.6,5021.23)(5308.42,5018.09)(5465.37,5010.38)(5623.29,4997.49)(5781.96,4978.58)(5941.15,4952.58)(6100.6,4918.08)(6260.03,4873.33)(6419.14,4816.11)(6577.65,4743.77)(6735.25,4653.1)(6891.68,4540.32)(7046.68,4400.99)(7200,4230)
|
||||
\psline[linecolor=blue](8460,6165)(8622.25,6003.86)(8725.83,5853.19)(8782.58,5711.47)(8802.7,5577.35)(8794.88,5449.63)(8766.41,5327.29)(8723.29,5209.44)(8670.37,5095.32)(8611.44,4984.3)(8549.35,4875.84)(8486.17,4769.53)(8423.24,4665.02)(8361.36,4562.04)(8300.84,4460.4)(8241.66,4359.96)(8183.58,4260.61)(8126.25,4162.29)(8069.34,4064.94)(8012.64,3968.53)(7956.2,3873.02)(7900.41,3778.35)(7846.17,3684.44)(7794.97,3591.19)(7749.02,3498.44)(7711.36,3405.97)(7685.99,3313.49)(7677.98,3220.65)(7693.59,3127)(7740.38,3031.97)(7827.34,2934.9)(7965,2835)
|
||||
|
|
|
|||
|
|
@ -43,10 +43,25 @@
|
|||
\usepackage{tikz}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage{mathptmx}
|
||||
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,matrix,fit,decorations.pathreplacing,arrows,automata,positioning,shapes,chains,spy}
|
||||
%\usetikzlibrary{quotes,angles,graph}
|
||||
\usetikzlibrary{intersections,through,backgrounds}
|
||||
\usetikzlibrary{calc}
|
||||
\usetikzlibrary{backgrounds}
|
||||
\usetikzlibrary{decorations.pathmorphing}
|
||||
\usetikzlibrary{decorations.markings}
|
||||
\usetikzlibrary{decorations.pathreplacing}
|
||||
\usetikzlibrary{patterns}
|
||||
\usetikzlibrary{matrix}
|
||||
\usetikzlibrary{fit}
|
||||
\usetikzlibrary{arrows,arrows.meta}
|
||||
\usetikzlibrary{automata}
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{shapes}
|
||||
\usetikzlibrary{chains}
|
||||
\usetikzlibrary{spy}
|
||||
\usetikzlibrary{intersections}
|
||||
\usetikzlibrary{through}
|
||||
\usetikzlibrary{cd}
|
||||
\usepackage{tikz-3dplot}
|
||||
%\usetikzlibrary{quotes,angles,graph}
|
||||
\tikzset{%
|
||||
invisible/.style={opacity=0},
|
||||
only/.code args={<#1>#2}{\only<#1>{\pgfkeysalso{#2}}},
|
||||
|
|
@ -54,8 +69,49 @@
|
|||
temporal/.code args={<#1>#2#3#4}{%
|
||||
\temporal<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}{\pgfkeysalso{#4}}},
|
||||
point/.style={circle,inner sep=1.5pt,minimum size=1.5pt,draw,fill=#1},
|
||||
point/.default=red
|
||||
point/.default=red,
|
||||
halfedge/.style={-{Stealth[left,scale=1.5]},commutative diagrams/shift left=#1},
|
||||
halfedge/.default=3pt
|
||||
}
|
||||
% ------------------------------------------------------------------------------
|
||||
% #1 half length of tick
|
||||
% #2 min x
|
||||
% #3 min y
|
||||
% #4 max x
|
||||
% #5 max y
|
||||
\NewDocumentCommand{\myAxes}{O{4pt}mmmmO{0.001}}{%
|
||||
%axis
|
||||
\draw[-{Stealth[scale=1.5]}] (#2,0)--(#4,0);
|
||||
\draw[-{Stealth[scale=1.5]}] (0,#3)--(0,#5);
|
||||
%ticks
|
||||
\pgfmathtruncatemacro{\xs}{int(#2)};
|
||||
\pgfmathtruncatemacro{\xe}{int(#4-#6)};
|
||||
\pgfmathtruncatemacro{\ys}{int(#3)};
|
||||
\pgfmathtruncatemacro{\ye}{int(#5-#6)};
|
||||
\foreach \x in {\xs,...,\xe} \draw (\x,#1)--(\x,-#1);
|
||||
\foreach \y in {\ys,...,\ye} \draw (#1,\y)--(-#1,\y);%
|
||||
}
|
||||
% ------------------------------------------------------------------------------
|
||||
%Syntax: [draw options] (center) (initial angle:final angle:radius)
|
||||
\def\centerarc[#1](#2)(#3:#4:#5){\draw[#1]([shift=(#3:#5)]#2) arc (#3:#4:#5)}
|
||||
% ------------------------------------------------------------------------------
|
||||
\def\arrCrossVertexZ(#1)#2#3{\node[cross=#3] at (#1) (#2) {};}
|
||||
\def\arrQueryVertexZ(#1)#2{\arrCrossVertexZ(#1){#2}{red}}
|
||||
\def\arrCrossLabeledVertexZ[#1](#2)#3#4#5{\node [cross=#5,label={[label distance=-3pt]#1:{#4}}] at (#2) (#3) {};}
|
||||
\def\arrQueryLabeledVertexZ[#1](#2)#3#4{\arrCrossLabeledVertexZ[#1](#2){#3}{#4}{red}}
|
||||
%
|
||||
\def\arrColorVertexZ(#1)#2#3{\node[point=#3] at (#1) (#2) {};}
|
||||
\def\arrMinorVertexZ(#1)#2{\arrColorVertexZ(#1){#2}{cyan}}
|
||||
\def\arrMainVertexZ(#1)#2{\arrColorVertexZ(#1){#2}{red}}
|
||||
\def\arrIntersectionVertexZ(#1)#2{\arrColorVertexZ(#1){#2}{white}}
|
||||
\def\arrColoredLabeledVertexZ[#1](#2)#3#4#5{\node [point=#5,label={[label distance=-3pt]#1:{#4}}] at (#2) (#3) {};}
|
||||
\def\arrMainLabeledVertexZ[#1](#2)#3#4{\arrColoredLabeledVertexZ[#1](#2){#3}{#4}{red}}
|
||||
\def\arrMinorLabeledVertexZ[#1](#2)#3#4{\arrColoredLabeledVertexZ[#1](#2){#3}{#4}{cyan}}
|
||||
% ------------------------------------------------------------------------------
|
||||
\def\arrvZ[#1](#2)#3{\arrColoredLabeledVertexZ[#1](#2){#3}{$v_{#3}$}{red}}
|
||||
\def\arruZ[#1](#2)#3{\arrColoredLabeledVertexZ[#1](#2){#3}{$u_{#3}$}{red}}
|
||||
\def\arrpZ[#1](#2)#3{\arrColoredLabeledVertexZ[#1](#2){#3}{$p_{#3}$}{red}}
|
||||
% ==============================================================================
|
||||
\makeatletter
|
||||
\def\nodesDef{\@ifnextchar[{\@nodesDefWith}{\@nodesDefWithout}}
|
||||
\def\@nodesDefWith[#1]#2{\foreach \c in #2 { \node[point=#1] (n\c) at (\c) {}; }}
|
||||
|
|
@ -81,6 +137,7 @@
|
|||
% \usepackage{picins}
|
||||
\usepackage[absolute,overlay]{textpos}
|
||||
\usepackage{ifthen}
|
||||
\usepackage{xparse}
|
||||
\usepackage{etoolbox}
|
||||
%
|
||||
|
||||
|
|
|
|||
|
|
@ -2,96 +2,92 @@
|
|||
\input{header}
|
||||
\pagestyle{empty}
|
||||
\begin{document}
|
||||
\psscalebox{1.8}{\arrset{0.5}%
|
||||
\begin{tabular}{ccc}
|
||||
\pspicture[](0.5,0)(10,7)
|
||||
\arrMainVertex(1,4){a}
|
||||
\arrMainVertex(5,6){b}
|
||||
\arrMainVertex(9,4){c}
|
||||
\arrMainVertex(7,2){d}
|
||||
\arrMainVertex(3,1){e}
|
||||
\arrMainVertex(3,2){f}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{a}{b}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{c}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{c}{d}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{d}{e}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{e}{f}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{f}{a}
|
||||
\arrMinorVertex(3,3){1}\uput[135]{0}(3,3){$v_1$}
|
||||
\arrMinorVertex(6,4){2}\uput[-45]{0}(6,4){$v_2$}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,linecolor=blue]{1}{2}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{1}{2}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{2}{1}
|
||||
\rput(5,5){$f$}
|
||||
\psframe[linewidth=0.5pt](0.5,0)(10,7)
|
||||
\endpspicture &
|
||||
%
|
||||
\pspicture[](0.5,0)(10,7)
|
||||
\arrMainVertex(1,3){a}
|
||||
\arrMainVertex(2,5){b}
|
||||
\arrMainVertex(5,6){c}
|
||||
\arrMainVertex(7,3){u}
|
||||
\uput[180]{0}(7,3){$u$}
|
||||
\arrMainVertex(5,1){e}
|
||||
\arrMainVertex(3,2){f}
|
||||
\arrMainVertex(2,1){g}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{a}{b}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{c}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{c}{u}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{u}{e}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{e}{f}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{f}{g}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{g}{a}
|
||||
\arrMinorVertex(9,4){v}
|
||||
\uput[90]{0}(9,4){$v$}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,linecolor=blue]{u}{v}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,offset=3pt]{->}{c}{u}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,offset=3pt]{->}{u}{e}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{u}{v}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{v}{u}
|
||||
\psframe[linewidth=0.5pt](0.5,0)(10,7)
|
||||
\endpspicture &
|
||||
%
|
||||
\pspicture[](0.5,0)(10,7)
|
||||
\arrMainVertex(1,3){a}
|
||||
\arrMainVertex(2,6){b}
|
||||
\arru[45](5,6){1}
|
||||
\arru[-45](7,1){2}
|
||||
\arrMainVertex(4,2){e}
|
||||
\arrMainVertex(2,1){f}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{a}{b}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{1}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,offset=3pt]{->}{b}{1}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,offset=3pt]{->}{1}{b}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,linecolor=blue]{1}{2}
|
||||
\ncline[linewidth=0.5pt,offset=3pt]{->}{1}{2}
|
||||
\ncline[linewidth=0.5pt,offset=3pt,nodesepA=6pt]{->}{2}{1}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{2}{e}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,offset=3pt]{->}{2}{e}
|
||||
\ncline[linestyle=dashed,linewidth=0.5pt,offset=3pt,nodesepB=4pt]{->}{e}{2}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{e}{f}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{f}{a}
|
||||
\arrMainVertex(2.5,4){a}
|
||||
\arrMainVertex(3.5,5){b}
|
||||
\arrMainVertex(4.5,4){c}
|
||||
\arrMainVertex(3.5,3){d}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{a}{b}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{c}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{c}{d}\Aput[1pt]{$h_1$}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{d}{a}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{a}{c}
|
||||
\rput(1,5){$f$}
|
||||
\rput(2.5,5){$f'$}
|
||||
\arrMainVertex(7,4){a}
|
||||
\arrMainVertex(8,4){b}
|
||||
\arrMainVertex(8,5){c}
|
||||
\arrMainVertex(9,3){d}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{a}{b}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{c}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{c}{a}
|
||||
\ncline[linewidth=0.5pt,linecolor=blue]{b}{d}\Aput[1pt]{$h_2$}
|
||||
\psframe[linewidth=0.5pt](0.5,0)(10,7)
|
||||
\endpspicture
|
||||
\end{tabular}
|
||||
}
|
||||
\begin{tabular}{ccc}
|
||||
\begin{tikzpicture}
|
||||
\node[point] at (1,4) (a) {};
|
||||
\node[point] at (5,6) (b) {};
|
||||
\node[point] at (9,4) (c) {};
|
||||
\node[point] at (7,2) (d) {};
|
||||
\node[point] at (3,1) (e) {};
|
||||
\node[point] at (3,2) (f) {};
|
||||
\draw[blue,very thick](a)--(b);
|
||||
\draw[blue,very thick](b)--(c);
|
||||
\draw[blue,very thick](c)--(d);
|
||||
\draw[blue,very thick](d)--(e);
|
||||
\draw[blue,very thick](e)--(f);
|
||||
\draw[blue,very thick](f)--(a);
|
||||
\node[point=cyan,label={[label distance=0pt]135:{$v_1$}}] at (3,3) (1) {};
|
||||
\node[point=cyan,label={[label distance=0pt]135:{$v_2$}}] at (6,4) (2) {};
|
||||
\draw[dashed,blue,very thick] (1)--(2);
|
||||
\draw[halfedge] (1) to (2);
|
||||
\draw[halfedge] (2) to (1);
|
||||
\node at (5,5) {$f$};
|
||||
\draw[thin](0.5,0) rectangle (10,7);
|
||||
\end{tikzpicture} &
|
||||
%
|
||||
\begin{tikzpicture}
|
||||
\node[point] at (1,3) (a) {};
|
||||
\node[point] at (2,5) (b) {};
|
||||
\node[point] at (5,6) (c) {};
|
||||
\node[point,label={[label distance=0pt]180:{$u$}}] at (7,3) (u) {};
|
||||
\node[point] at (5,1) (e) {};
|
||||
\node[point] at (3,2) (f) {};
|
||||
\node[point] at (2,1) (g) {};
|
||||
\draw[blue,very thick](a)--(b);
|
||||
\draw[blue,very thick](b)--(c);
|
||||
\draw[blue,very thick](c)--(u);
|
||||
\draw[blue,very thick](u)--(e);
|
||||
\draw[blue,very thick](e)--(f);
|
||||
\draw[blue,very thick](f)--(g);
|
||||
\draw[blue,very thick](g)--(a);
|
||||
\node[point=cyan,label={[label distance=0pt]90:{$v$}}] at (9,4) (v) {};
|
||||
\draw[dashed,blue,very thick] (u)--(v);
|
||||
\draw[dashed,halfedge] (c) to (u);
|
||||
\draw[dashed,halfedge] (u) to (e);
|
||||
\draw[halfedge] (u) to (v);
|
||||
\draw[halfedge] (v) to (u);
|
||||
\draw[thin] (0.5,0) rectangle (10,7);
|
||||
\end{tikzpicture} &
|
||||
%
|
||||
\begin{tikzpicture}
|
||||
\node[point] at (1,3) (a) {};
|
||||
\node[point] at (2,6) (b) {};
|
||||
\node[point,label={[label distance=0pt]45:{$u_1$}}] at (5,6) (1) {};
|
||||
\node[point,label={[label distance=0pt]45:{$u_2$}}] at (7,1) (2) {};
|
||||
\node[point] at (4,2) (e) {};
|
||||
\node[point] at (2,1) (f) {};
|
||||
\draw[blue,very thick](a)--(b);
|
||||
\draw[blue,very thick](b)--(1);
|
||||
\draw[dashed,thick,halfedge] (b) to (1);
|
||||
\draw[dashed,thick,halfedge] (1) to (b);
|
||||
\draw[dashed,blue,very thick](1)--(2);
|
||||
\draw[thick,halfedge] (1) to (2);
|
||||
\draw[thick,halfedge,shorten <=4pt] (2) to (1);
|
||||
\draw[blue,very thick] (2)--(e);
|
||||
\draw[dashed,halfedge] (2) to (e);
|
||||
\draw[dashed,halfedge,shorten >=4pt] (e) to (2);
|
||||
\draw[blue,very thick] (e)--(f);
|
||||
\draw[blue,very thick] (f)--(a);
|
||||
\node[point] at (2.5,4) (a) {};
|
||||
\node[point] at (3.5,5) (b) {};
|
||||
\node[point] at (4.5,4) (c) {};
|
||||
\node[point] at (3.5,3) (d) {};
|
||||
\draw[blue,very thick](a)--(b);
|
||||
\draw[blue,very thick](b)--(c);
|
||||
\draw[blue,very thick](c)-- node[midway,below,sloped] {$h_1$} (d);
|
||||
\draw[blue,very thick](d)--(a);
|
||||
\draw[blue,very thick](a)--(c);
|
||||
\node at (1,5) {$f$};
|
||||
\node at (2.5,5) {$f'$};
|
||||
\node[point] at (7,4) (a) {};
|
||||
\node[point] at (8,4) (b) {};
|
||||
\node[point] at (8,5) (c) {};
|
||||
\node[point] at (9,3) (d) {};
|
||||
\draw[blue,very thick] (a)--(b);
|
||||
\draw[blue,very thick] (b)--(c);
|
||||
\draw[blue,very thick] (c)--(a);
|
||||
\draw[blue,very thick] (b)-- node[midway,below,sloped] {$h_2$} (d);
|
||||
\draw[thin] (0.5,0) rectangle (10,7);
|
||||
\end{tikzpicture}
|
||||
\end{tabular}
|
||||
\end{document}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
\documentclass[tikz, border=5mm]{standalone}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{patterns.meta}
|
||||
\usetikzlibrary{shapes.geometric}
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\draw[line width=0.2pt,draw=black,
|
||||
pattern={Hatch[angle=45,distance={6pt},line width=0.4pt]},
|
||||
pattern color=black](0,0) rectangle (10,6);
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
|
|
@ -49,7 +49,9 @@ TARGETS = \
|
|||
overlay_color.pdf \
|
||||
bgl_primal_adapter.pdf \
|
||||
bgl_dual_adapter.pdf \
|
||||
unb_asymptote.pdf
|
||||
unb_asymptote.pdf \
|
||||
min_area_tri.pdf \
|
||||
jeep.pdf
|
||||
|
||||
.DEFAULT_GOAL = all
|
||||
.PHONY: all clean
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
\documentclass[11pt]{report}
|
||||
\input{header}
|
||||
\pagestyle{empty}
|
||||
\begin{document}
|
||||
\begin{tikzpicture}[scale=1.0,thick]
|
||||
\myAxes[4pt]{-2.5}{-1.5}{2.5}{2.5}
|
||||
\foreach \x in {-2,...,2} \node[label={[label distance=-6pt]-45:{\scriptsize $\x$}}] at (\x,0) {};
|
||||
\foreach \y in {-1,...,2} \node[label={[label distance=-6pt]135:{\scriptsize $\y$}}] at (0,\y) {};
|
||||
\draw[step=1.0,dotted](-2,-1)grid(2,2);
|
||||
\filldraw[fill=lightred,draw=darkred](-1,0)--(-0.5,1)--( 1,1)--cycle;
|
||||
\arrpZ[45](-2,2.25){1}
|
||||
\arrpZ[135](-1,0){2}
|
||||
\arrpZ[135](-0.5,1){3}
|
||||
\arrpZ[45]( 0.5,-1){4}
|
||||
\arrpZ[45]( 1,1){5}
|
||||
\end{tikzpicture}%
|
||||
\end{document}
|
||||
|
|
@ -4,15 +4,15 @@
|
|||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef Kernel::FT Number_type;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Number_type = Kernel::FT;
|
||||
|
||||
template <typename Arrangement> struct Edge_length {
|
||||
// Boost property-type definitions.
|
||||
typedef boost::readable_property_map_tag category;
|
||||
typedef Number_type value_type;
|
||||
typedef value_type reference;
|
||||
typedef typename Arrangement::Halfedge_handle key_type;
|
||||
using category = boost::readable_property_map_tag;
|
||||
using value_type = Number_type;
|
||||
using reference = value_type;
|
||||
using key_type = typename Arrangement::Halfedge_handle;
|
||||
|
||||
value_type operator()(typename Arrangement::Halfedge_handle e) const {
|
||||
const auto diff_x = e->target()->point().x() - e->source()->point().x();
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
// A property map that reads/writes the information to/from the extended face.
|
||||
template <typename Arrangement, class Type> class Extended_face_property_map {
|
||||
public:
|
||||
typedef typename Arrangement::Face_handle Face_handle;
|
||||
using Face_handle = typename Arrangement::Face_handle;
|
||||
|
||||
// Boost property type definitions.
|
||||
typedef boost::read_write_property_map_tag category;
|
||||
typedef Type value_type;
|
||||
typedef value_type& reference;
|
||||
typedef Face_handle key_type;
|
||||
using category = boost::read_write_property_map_tag;
|
||||
using value_type = Type;
|
||||
using reference = value_type&;
|
||||
using key_type = Face_handle;
|
||||
|
||||
// The get function is required by the property map concept.
|
||||
friend reference get(const Extended_face_property_map& /* map */, key_type key)
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#define OVERLAY_COLOR_TRAITS_H
|
||||
|
||||
template <typename Arrangement> struct Overlay_color_traits {
|
||||
typedef unsigned int Color;
|
||||
typedef typename Arrangement::Vertex_const_handle V_const_handle;
|
||||
typedef typename Arrangement::Halfedge_const_handle H_const_handle;
|
||||
typedef typename Arrangement::Face_const_handle F_const_handle;
|
||||
typedef typename Arrangement::Vertex_handle V_handle;
|
||||
typedef typename Arrangement::Halfedge_handle H_handle;
|
||||
typedef typename Arrangement::Face_handle F_handle;
|
||||
using Color = unsigned int;
|
||||
using V_const_handle = typename Arrangement::Vertex_const_handle;
|
||||
using H_const_handle = typename Arrangement::Halfedge_const_handle;
|
||||
using F_const_handle = typename Arrangement::Face_const_handle;
|
||||
using V_handle = typename Arrangement::Vertex_handle;
|
||||
using H_handle = typename Arrangement::Halfedge_handle;
|
||||
using F_handle = typename Arrangement::Face_handle;
|
||||
|
||||
// Compute the average of the red, green, and blue components separately.
|
||||
Color blend(Color color1, Color color2) const
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ int main ()
|
|||
#include "integer_type.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arr_algebraic_segment_traits_2<Integer> Traits;
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
typedef Traits::Curve_2 Curve;
|
||||
typedef Traits::Polynomial_2 Polynomial;
|
||||
using Traits = CGAL::Arr_algebraic_segment_traits_2<Integer>;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
using Curve = Traits::Curve_2;
|
||||
using Polynomial = Traits::Polynomial_2;
|
||||
|
||||
int main() {
|
||||
CGAL::IO::set_pretty_mode(std::cout); // for nice printouts.
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ int main ()
|
|||
#include "integer_type.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arr_algebraic_segment_traits_2<Integer> Traits;
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
typedef Traits::Curve_2 Curve;
|
||||
typedef Traits::Polynomial_2 Polynomial;
|
||||
typedef Traits::Algebraic_real_1 Algebraic_real;
|
||||
typedef Traits::X_monotone_curve_2 X_monotone_curve;
|
||||
typedef Traits::Point_2 Point;
|
||||
using Traits = CGAL::Arr_algebraic_segment_traits_2<Integer>;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
using Curve = Traits::Curve_2;
|
||||
using Polynomial = Traits::Polynomial_2;
|
||||
using Algebraic_real = Traits::Algebraic_real_1;
|
||||
using X_monotone_curve = Traits::X_monotone_curve_2;
|
||||
using Point = Traits::Point_2;
|
||||
|
||||
typedef std::variant<Point, X_monotone_curve> Make_x_monotone_result;
|
||||
using Make_x_monotone_result = std::variant<Point, X_monotone_curve>;
|
||||
|
||||
int main() {
|
||||
Traits traits;
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@
|
|||
#include <CGAL/Arr_Bezier_curve_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
typedef CGAL::CORE_algebraic_number_traits Nt_traits;
|
||||
typedef Nt_traits::Rational NT;
|
||||
typedef Nt_traits::Rational Rational;
|
||||
typedef Nt_traits::Algebraic Algebraic;
|
||||
typedef CGAL::Cartesian<Rational> Rat_kernel;
|
||||
typedef CGAL::Cartesian<Algebraic> Alg_kernel;
|
||||
typedef Rat_kernel::Point_2 Rat_point;
|
||||
typedef CGAL::Arr_Bezier_curve_traits_2<Rat_kernel, Alg_kernel, Nt_traits>
|
||||
Traits;
|
||||
typedef Traits::X_monotone_curve_2 Bezier_x_monotone_curve;
|
||||
typedef Traits::Curve_2 Bezier_curve;
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
using Nt_traits = CGAL::CORE_algebraic_number_traits;
|
||||
using NT = Nt_traits::Rational;
|
||||
using Rational = Nt_traits::Rational;
|
||||
using Algebraic = Nt_traits::Algebraic;
|
||||
using Rat_kernel = CGAL::Cartesian<Rational>;
|
||||
using Alg_kernel = CGAL::Cartesian<Algebraic>;
|
||||
using Rat_point = Rat_kernel::Point_2;
|
||||
using Traits =
|
||||
CGAL::Arr_Bezier_curve_traits_2<Rat_kernel, Alg_kernel, Nt_traits>;
|
||||
using Bezier_x_monotone_curve = Traits::X_monotone_curve_2;
|
||||
using Bezier_curve = Traits::Curve_2;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,16 +5,16 @@
|
|||
#include <CGAL/Arr_circle_segment_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef Kernel::FT Number_type;
|
||||
typedef CGAL::Arr_circle_segment_traits_2<Kernel> Traits;
|
||||
typedef Traits::CoordNT CoordNT;
|
||||
typedef Traits::Point_2 Point;
|
||||
typedef Traits::Curve_2 Curve;
|
||||
typedef Traits::X_monotone_curve_2 X_monotone_curve;
|
||||
typedef Traits::Rational_point_2 Rational_point;
|
||||
typedef Traits::Rational_segment_2 Segment;
|
||||
typedef Traits::Rational_circle_2 Circle;
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Number_type = Kernel::FT;
|
||||
using Traits = CGAL::Arr_circle_segment_traits_2<Kernel>;
|
||||
using CoordNT = Traits::CoordNT;
|
||||
using Point = Traits::Point_2;
|
||||
using Curve = Traits::Curve_2;
|
||||
using X_monotone_curve = Traits::X_monotone_curve_2;
|
||||
using Rational_point = Traits::Rational_point_2;
|
||||
using Segment = Traits::Rational_segment_2;
|
||||
using Circle = Traits::Rational_circle_2;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@
|
|||
#include <CGAL/Arr_segment_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef Kernel::FT Number_type;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Number_type = Kernel::FT;
|
||||
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Traits;
|
||||
typedef Traits::Point_2 Point;
|
||||
typedef Traits::X_monotone_curve_2 Segment;
|
||||
using Traits = CGAL::Arr_segment_traits_2<Kernel>;
|
||||
using Point = Traits::Point_2;
|
||||
using Segment = Traits::X_monotone_curve_2;
|
||||
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
typedef Arrangement::Vertex_handle Vertex_handle;
|
||||
typedef Arrangement::Halfedge_handle Halfedge_handle;
|
||||
typedef Arrangement::Face_handle Face_handle;
|
||||
typedef Arrangement::Vertex_const_handle Vertex_const_handle;
|
||||
typedef Arrangement::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef Arrangement::Face_const_handle Face_const_handle;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
using Vertex_handle = Arrangement::Vertex_handle;
|
||||
using Halfedge_handle = Arrangement::Halfedge_handle;
|
||||
using Face_handle = Arrangement::Face_handle;
|
||||
using Vertex_const_handle = Arrangement::Vertex_const_handle;
|
||||
using Halfedge_const_handle = Arrangement::Halfedge_const_handle;
|
||||
using Face_const_handle = Arrangement::Face_const_handle;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,21 +6,20 @@
|
|||
#include <CGAL/Arr_geodesic_arc_on_sphere_traits_2.h>
|
||||
#include <CGAL/Arr_spherical_topology_traits_2.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef Kernel::FT Number_type;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Number_type = Kernel::FT;
|
||||
|
||||
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel> Geom_traits;
|
||||
typedef Geom_traits::Point_2 Point;
|
||||
typedef Geom_traits::X_monotone_curve_2 X_monotone_curve;
|
||||
typedef CGAL::Arr_spherical_topology_traits_2<Geom_traits> Topol_traits;
|
||||
typedef CGAL::Arrangement_on_surface_2<Geom_traits, Topol_traits>
|
||||
Arrangement;
|
||||
using Geom_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel>;
|
||||
using Point = Geom_traits::Point_2;
|
||||
using X_monotone_curve = Geom_traits::X_monotone_curve_2;
|
||||
using Topol_traits = CGAL::Arr_spherical_topology_traits_2<Geom_traits>;
|
||||
using Arrangement = CGAL::Arrangement_on_surface_2<Geom_traits, Topol_traits>;
|
||||
|
||||
typedef Arrangement::Vertex_handle Vertex_handle;
|
||||
typedef Arrangement::Halfedge_handle Halfedge_handle;
|
||||
typedef Arrangement::Face_handle Face_handle;
|
||||
typedef Arrangement::Vertex_const_handle Vertex_const_handle;
|
||||
typedef Arrangement::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef Arrangement::Face_const_handle Face_const_handle;
|
||||
using Vertex_handle = Arrangement::Vertex_handle;
|
||||
using Halfedge_handle = Arrangement::Halfedge_handle;
|
||||
using Face_handle = Arrangement::Face_handle;
|
||||
using Vertex_const_handle = Arrangement::Vertex_const_handle;
|
||||
using Halfedge_const_handle = Arrangement::Halfedge_const_handle;
|
||||
using Face_const_handle = Arrangement::Face_const_handle;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,16 +5,16 @@
|
|||
#include <CGAL/Arr_non_caching_segment_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef Kernel::FT Number_type;
|
||||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Number_type = Kernel::FT;
|
||||
|
||||
typedef CGAL::Arr_non_caching_segment_traits_2<Kernel> Traits;
|
||||
typedef Traits::Point_2 Point;
|
||||
typedef Traits::X_monotone_curve_2 Segment;
|
||||
using Traits = CGAL::Arr_non_caching_segment_traits_2<Kernel>;
|
||||
using Point = Traits::Point_2;
|
||||
using Segment = Traits::X_monotone_curve_2;
|
||||
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
typedef Arrangement::Vertex_handle Vertex_handle;
|
||||
typedef Arrangement::Halfedge_handle Halfedge_handle;
|
||||
typedef Arrangement::Face_handle Face_handle;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
using Vertex_handle = Arrangement::Vertex_handle;
|
||||
using Halfedge_handle = Arrangement::Halfedge_handle;
|
||||
using Face_handle = Arrangement::Face_handle;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,22 +5,22 @@
|
|||
#include <CGAL/Arr_linear_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef Kernel::FT Number_type;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Number_type = Kernel::FT;
|
||||
|
||||
typedef CGAL::Arr_linear_traits_2<Kernel> Traits;
|
||||
typedef Traits::Point_2 Point;
|
||||
typedef Traits::Segment_2 Segment;
|
||||
typedef Traits::Ray_2 Ray;
|
||||
typedef Traits::Line_2 Line;
|
||||
typedef Traits::X_monotone_curve_2 X_monotone_curve;
|
||||
using Traits = CGAL::Arr_linear_traits_2<Kernel>;
|
||||
using Point = Traits::Point_2;
|
||||
using Segment = Traits::Segment_2;
|
||||
using Ray = Traits::Ray_2;
|
||||
using Line = Traits::Line_2;
|
||||
using X_monotone_curve = Traits::X_monotone_curve_2;
|
||||
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
typedef Arrangement::Vertex_handle Vertex_handle;
|
||||
typedef Arrangement::Halfedge_handle Halfedge_handle;
|
||||
typedef Arrangement::Face_handle Face_handle;
|
||||
typedef Arrangement::Vertex_const_handle Vertex_const_handle;
|
||||
typedef Arrangement::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef Arrangement::Face_const_handle Face_const_handle;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
using Vertex_handle = Arrangement::Vertex_handle;
|
||||
using Halfedge_handle = Arrangement::Halfedge_handle;
|
||||
using Face_handle = Arrangement::Face_handle;
|
||||
using Vertex_const_handle = Arrangement::Vertex_const_handle;
|
||||
using Halfedge_const_handle = Arrangement::Halfedge_const_handle;
|
||||
using Face_const_handle = Arrangement::Face_const_handle;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@
|
|||
#include <CGAL/Arr_polyline_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef Kernel::FT Number_type;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Number_type = Kernel::FT;
|
||||
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Segment_traits;
|
||||
typedef CGAL::Arr_polyline_traits_2<Segment_traits> Traits;
|
||||
typedef Traits::Point_2 Point;
|
||||
typedef Traits::Segment_2 Segment;
|
||||
typedef Traits::Curve_2 My_polyline;
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
using Segment_traits = CGAL::Arr_segment_traits_2<Kernel>;
|
||||
using Traits = CGAL::Arr_polyline_traits_2<Segment_traits>;
|
||||
using Point = Traits::Point_2;
|
||||
using Segment = Traits::Segment_2;
|
||||
using My_polyline = Traits::Curve_2;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
#include <CGAL/Arr_rational_function_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
|
||||
typedef CORE::BigInt Number_type;
|
||||
typedef CGAL::Algebraic_kernel_d_1<Number_type> AK1;
|
||||
typedef CGAL::Arr_rational_function_traits_2<AK1> Traits;
|
||||
using Number_type = CORE::BigInt;
|
||||
using AK1 = CGAL::Algebraic_kernel_d_1<Number_type>;
|
||||
using Traits = CGAL::Arr_rational_function_traits_2<AK1>;
|
||||
|
||||
typedef Traits::Polynomial_1 Polynomial;
|
||||
typedef Traits::Algebraic_real_1 Alg_real;
|
||||
typedef Traits::Bound Bound;
|
||||
using Polynomial = Traits::Polynomial_1;
|
||||
using Alg_real = Traits::Algebraic_real_1;
|
||||
using Bound = Traits::Bound;
|
||||
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
#include "arr_inexact_construction_segments.h"
|
||||
#include "point_location_utils.h"
|
||||
|
||||
typedef CGAL::Arr_point_location_result<Arrangement> Point_location_result;
|
||||
typedef std::pair<Point, Point_location_result::Type> Query_result;
|
||||
using Point_location_result = CGAL::Arr_point_location_result<Arrangement>;
|
||||
using Query_result = std::pair<Point, Point_location_result::Type>;
|
||||
|
||||
int main() {
|
||||
// Construct the arrangement.
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arr_face_extended_dcel<Traits, unsigned int> Dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
|
||||
typedef CGAL::Dual<Ex_arrangement> Dual_arrangement;
|
||||
typedef CGAL::Arr_face_index_map<Ex_arrangement> Face_index_map;
|
||||
typedef Extended_face_property_map<Ex_arrangement,unsigned int>
|
||||
Face_property_map;
|
||||
using Dcel = CGAL::Arr_face_extended_dcel<Traits, unsigned int>;
|
||||
using Ex_arrangement = CGAL::Arrangement_2<Traits, Dcel>;
|
||||
using Dual_arrangement = CGAL::Dual<Ex_arrangement>;
|
||||
using Face_index_map = CGAL::Arr_face_index_map<Ex_arrangement>;
|
||||
using Face_property_map =
|
||||
Extended_face_property_map<Ex_arrangement,unsigned int>;
|
||||
|
||||
int main() {
|
||||
// Construct an arrangement of seven intersecting line segments.
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "Edge_length.h"
|
||||
|
||||
typedef CGAL::Arr_vertex_index_map<Arrangement> Vertex_index_map;
|
||||
typedef Edge_length<Arrangement> My_edge_length;
|
||||
using Vertex_index_map = CGAL::Arr_vertex_index_map<Arrangement>;
|
||||
using My_edge_length = Edge_length<Arrangement>;
|
||||
|
||||
int main() {
|
||||
// Construct an arrangement of seven intersecting line segments.
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
#include "arr_exact_construction_segments.h"
|
||||
|
||||
typedef std::pair<CGAL::Object, CGAL::Object> Object_pair;
|
||||
typedef std::pair<Vertex_const_handle, Object_pair> Vert_decomp_entry;
|
||||
typedef std::list<Vert_decomp_entry> Vert_decomp_list;
|
||||
using Object_pair = std::pair<CGAL::Object, CGAL::Object>;
|
||||
using Vert_decomp_entry = std::pair<Vertex_const_handle, Object_pair>;
|
||||
using Vert_decomp_list = std::list<Vert_decomp_entry>;
|
||||
|
||||
int main() {
|
||||
// Construct the arrangement.
|
||||
|
|
|
|||
|
|
@ -15,23 +15,23 @@
|
|||
#include <CGAL/Random.h>
|
||||
|
||||
|
||||
typedef CGAL::Quotient<CGAL::MP_Float> NT;
|
||||
typedef CGAL::Cartesian<NT> Linear_k;
|
||||
typedef CGAL::Algebraic_kernel_for_circles_2_2<NT> Algebraic_k;
|
||||
typedef CGAL::Circular_kernel_2<Linear_k,Algebraic_k> Circular_k;
|
||||
using NT = CGAL::Quotient<CGAL::MP_Float>;
|
||||
using Linear_k = CGAL::Cartesian<NT>;
|
||||
using Algebraic_k = CGAL::Algebraic_kernel_for_circles_2_2<NT>;
|
||||
using Circular_k = CGAL::Circular_kernel_2<Linear_k,Algebraic_k>;
|
||||
|
||||
typedef Circular_k::Point_2 Point_2;
|
||||
typedef Circular_k::Circle_2 Circle_2;
|
||||
typedef Circular_k::Circular_arc_2 Circular_arc_2;
|
||||
typedef Circular_k::Line_arc_2 Line_arc_2;
|
||||
using Point_2 = Circular_k::Point_2;
|
||||
using Circle_2 = Circular_k::Circle_2;
|
||||
using Circular_arc_2 = Circular_k::Circular_arc_2;
|
||||
using Line_arc_2 = Circular_k::Line_arc_2;
|
||||
|
||||
typedef std::variant< Circular_arc_2, Line_arc_2> Arc_2;
|
||||
typedef std::vector< Arc_2> ArcContainer;
|
||||
using Arc_2 = std::variant< Circular_arc_2, Line_arc_2>;
|
||||
using ArcContainer = std::vector< Arc_2>;
|
||||
|
||||
typedef CGAL::Arr_circular_line_arc_traits_2<Circular_k> Traits;
|
||||
using Traits = CGAL::Arr_circular_line_arc_traits_2<Circular_k>;
|
||||
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
typedef CGAL::Arr_naive_point_location<Arrangement> Point_location;
|
||||
using Arrangement = CGAL::Arrangement_2<Traits>;
|
||||
using Point_location = CGAL::Arr_naive_point_location<Arrangement>;
|
||||
|
||||
int main() {
|
||||
CGAL::Random generatorOfgenerator;
|
||||
|
|
@ -46,7 +46,7 @@ int main() {
|
|||
for (int i = 0; i < 10; i++) {
|
||||
x1 = theRandom.get_int(random_min,random_max);
|
||||
y1 = theRandom.get_int(random_min,random_max);
|
||||
do{
|
||||
do {
|
||||
x2 = theRandom.get_int(random_min,random_max);
|
||||
y2 = theRandom.get_int(random_min,random_max);
|
||||
} while((x1 == x2) && (y1 == y2));
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "arr_conics.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
|
||||
using Naive_pl = CGAL::Arr_naive_point_location<Arrangement>;
|
||||
|
||||
int main() {
|
||||
Traits traits;
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
enum Segment_color {RED, BLUE};
|
||||
|
||||
typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, Segment_color>
|
||||
Data_traits;
|
||||
typedef Data_traits::Curve_2 Colored_segment;
|
||||
typedef CGAL::Arrangement_2<Data_traits> Colored_arr;
|
||||
using Data_traits =
|
||||
CGAL::Arr_consolidated_curve_data_traits_2<Traits, Segment_color>;
|
||||
using Colored_segment = Data_traits::Curve_2;
|
||||
using Colored_arr = CGAL::Arrangement_2<Data_traits>;
|
||||
|
||||
int main() {
|
||||
Colored_arr arr;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "point_location_utils.h"
|
||||
|
||||
typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
|
||||
typedef Arr_with_hist::Curve_handle Curve_handle;
|
||||
typedef CGAL::Arr_trapezoid_ric_point_location<Arr_with_hist> Point_location;
|
||||
using Arr_with_hist = CGAL::Arrangement_with_history_2<Traits>;
|
||||
using Curve_handle = Arr_with_hist::Curve_handle;
|
||||
using Point_location = CGAL::Arr_trapezoid_ric_point_location<Arr_with_hist>;
|
||||
|
||||
int main() {
|
||||
// Insert 3 curves incrementally.
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
enum Color {BLUE, RED, WHITE};
|
||||
|
||||
typedef CGAL::Arr_extended_dcel<Traits, Color, bool, size_t> Dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
|
||||
using Dcel = CGAL::Arr_extended_dcel<Traits, Color, bool, size_t>;
|
||||
using Ex_arrangement = CGAL::Arrangement_2<Traits, Dcel>;
|
||||
|
||||
int main() {
|
||||
// Construct the arrangement containing two intersecting triangles.
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ std::istream& operator>>(std::istream& is, Color& color) {
|
|||
return is;
|
||||
}
|
||||
|
||||
typedef CGAL::Arr_extended_dcel<Traits, Color, bool, int> Ext_dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Ext_dcel> Ext_arrangement;
|
||||
typedef CGAL::Arr_extended_dcel_text_formatter<Ext_arrangement> Formatter;
|
||||
using Ext_dcel = CGAL::Arr_extended_dcel<Traits, Color, bool, int>;
|
||||
using Ext_arrangement = CGAL::Arrangement_2<Traits, Ext_dcel>;
|
||||
using Formatter = CGAL::Arr_extended_dcel_text_formatter<Ext_arrangement>;
|
||||
|
||||
int main() {
|
||||
// Construct the arrangement containing two intersecting triangles.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
#include <CGAL/Arr_segment_traits_2.h>
|
||||
#include <CGAL/draw_arrangement_2.h>
|
||||
|
||||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Traits = CGAL::Arr_segment_traits_2<Kernel>;
|
||||
using Point = Traits::Point_2;
|
||||
using Arrangement_2 = CGAL::Arrangement_2<Traits>;
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
#include "arr_linear.h"
|
||||
#include "read_objects.h"
|
||||
|
||||
typedef CGAL::Arr_curve_data_traits_2<Traits, size_t> Data_traits;
|
||||
typedef Data_traits::X_monotone_curve_2 Data_x_monotone_curve_2;
|
||||
typedef CGAL::Arrangement_2<Data_traits> Data_arrangement;
|
||||
using Data_traits = CGAL::Arr_curve_data_traits_2<Traits, size_t>;
|
||||
using Data_x_monotone_curve_2 = Data_traits::X_monotone_curve_2;
|
||||
using Data_arrangement = CGAL::Arrangement_2<Data_traits>;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Get the name of the input file from the command line, or use the default
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
#include "arr_circular.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
|
||||
typedef Arr_with_hist::Curve_handle Curve_handle;
|
||||
typedef CGAL::Arr_walk_along_line_point_location<Arr_with_hist> Point_location;
|
||||
using Arr_with_hist = CGAL::Arrangement_with_history_2<Traits>;
|
||||
using Curve_handle = Arr_with_hist::Curve_handle;
|
||||
using Point_location = CGAL::Arr_walk_along_line_point_location<Arr_with_hist>;
|
||||
|
||||
int main() {
|
||||
// Construct an arrangement containing nine circles: C[0] of radius 2 and
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
#include "arr_exact_construction_segments.h"
|
||||
|
||||
typedef CGAL::Arr_face_extended_dcel<Traits, size_t> Dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
|
||||
using Dcel = CGAL::Arr_face_extended_dcel<Traits, size_t>;
|
||||
using Ex_arrangement = CGAL::Arrangement_2<Traits, Dcel>;
|
||||
|
||||
// An arrangement observer, used to receive notifications of face splits and
|
||||
// to update the indices of the newly created faces.
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@
|
|||
|
||||
#include "arr_exact_construction_segments.h"
|
||||
|
||||
typedef CGAL::Arr_face_extended_dcel<Traits, bool> Dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
|
||||
typedef CGAL::Arr_face_overlay_traits<Ex_arrangement, Ex_arrangement,
|
||||
Ex_arrangement,
|
||||
std::logical_and<bool> >
|
||||
Overlay_traits;
|
||||
using Dcel = CGAL::Arr_face_extended_dcel<Traits, bool>;
|
||||
using Ex_arrangement = CGAL::Arrangement_2<Traits, Dcel>;
|
||||
using Overlay_traits =
|
||||
CGAL::Arr_face_overlay_traits<Ex_arrangement, Ex_arrangement,
|
||||
Ex_arrangement, std::logical_and<bool>>;
|
||||
|
||||
int main() {
|
||||
// Construct the first arrangement, containing a square-shaped face.
|
||||
|
|
|
|||
|
|
@ -7,18 +7,18 @@
|
|||
|
||||
#include "arr_polylines.h"
|
||||
|
||||
typedef std::string Name; // The name-field type.
|
||||
using Name = std::string; // The name-field type.
|
||||
|
||||
struct Merge_names {
|
||||
Name operator() (const Name& s1, const Name& s2) const
|
||||
{ return (s1 + " " + s2); }
|
||||
};
|
||||
|
||||
typedef CGAL::Arr_curve_data_traits_2<Traits, Name, Merge_names>
|
||||
Ex_traits;
|
||||
typedef Ex_traits::Curve_2 Ex_polyline;
|
||||
typedef Ex_traits::X_monotone_curve_2 Ex_x_monotone_polyline;
|
||||
typedef CGAL::Arrangement_2<Ex_traits> Ex_arrangement;
|
||||
using Ex_traits = CGAL::Arr_curve_data_traits_2<Traits, Name, Merge_names>;
|
||||
|
||||
using Ex_polyline = Ex_traits::Curve_2;
|
||||
using Ex_x_monotone_polyline = Ex_traits::X_monotone_curve_2;
|
||||
using Ex_arrangement = CGAL::Arrangement_2<Ex_traits>;
|
||||
|
||||
int main() {
|
||||
// Construct an arrangement of four polylines named A--D.
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
|
||||
typedef CGAL::Arr_point_location_result<Arrangement>::Type Pl_result_type;
|
||||
using Naive_pl = CGAL::Arr_naive_point_location<Arrangement>;
|
||||
using Pl_result_type = CGAL::Arr_point_location_result<Arrangement>::Type;
|
||||
|
||||
int main() {
|
||||
// Construct the arrangement of five intersecting segments.
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
#if CGAL_USE_GMP && CGAL_USE_MPFI
|
||||
#include <CGAL/Gmpz.h>
|
||||
typedef CGAL::Gmpz Integer;
|
||||
using Integer = CGAL::Gmpz;
|
||||
#elif CGAL_USE_CORE
|
||||
#include <CGAL/CORE_BigInt.h>
|
||||
typedef CORE::BigInt Integer;
|
||||
using Integer = CORE::BigInt;
|
||||
#else
|
||||
#include <CGAL/leda_integer.h>
|
||||
typedef LEDA::integer Integer;
|
||||
using Integer = LEDA::integer;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arrangement_with_history_2<Traits> Arr_with_hist;
|
||||
using Arr_with_hist = CGAL::Arrangement_with_history_2<Traits>;
|
||||
|
||||
int main() {
|
||||
// Insert six additional segments aggregately:
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
#include "arr_exact_construction_segments.h"
|
||||
#include "Overlay_color_traits.h"
|
||||
|
||||
typedef unsigned int Color;
|
||||
typedef CGAL::Arr_extended_dcel<Traits, Color, Color, Color> Dcel;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel> Ex_arrangement;
|
||||
using Color = unsigned int;
|
||||
using Dcel = CGAL::Arr_extended_dcel<Traits, Color, Color, Color>;
|
||||
using Ex_arrangement = CGAL::Arrangement_2<Traits, Dcel>;
|
||||
|
||||
int main() {
|
||||
const Color vcol1(0x00000080), hcol1(0x000000ff), fcol1(0x00ccccff);
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@ struct Overlay_label {
|
|||
{ return c + std::to_string(i); }
|
||||
};
|
||||
|
||||
typedef CGAL::Arr_face_extended_dcel<Traits, char> Dcel_dlue;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel_dlue> Arrangement_blue;
|
||||
typedef CGAL::Arr_face_extended_dcel<Traits, unsigned int> Dcel_red;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel_red> Arrangement_red;
|
||||
typedef CGAL::Arr_face_extended_dcel<Traits, std::string> Dcel_res;
|
||||
typedef CGAL::Arrangement_2<Traits, Dcel_res> Arrangement_res;
|
||||
typedef CGAL::Arr_face_overlay_traits<Arrangement_blue, Arrangement_red,
|
||||
Arrangement_res, Overlay_label>
|
||||
Overlay_traits;
|
||||
using Dcel_dlue = CGAL::Arr_face_extended_dcel<Traits, char>;
|
||||
using Arrangement_blue = CGAL::Arrangement_2<Traits, Dcel_dlue>;
|
||||
using Dcel_red = CGAL::Arr_face_extended_dcel<Traits, unsigned int>;
|
||||
using Arrangement_red = CGAL::Arrangement_2<Traits, Dcel_red>;
|
||||
using Dcel_res = CGAL::Arr_face_extended_dcel<Traits, std::string>;
|
||||
using Arrangement_res = CGAL::Arrangement_2<Traits, Dcel_res>;
|
||||
using Overlay_traits =
|
||||
CGAL::Arr_face_overlay_traits<Arrangement_blue, Arrangement_red,
|
||||
Arrangement_res, Overlay_label>;
|
||||
|
||||
int main() {
|
||||
// Construct the first arrangement, induced by two lines y = x and y = -x.
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
#include "arr_inexact_construction_segments.h"
|
||||
#include "point_location_utils.h"
|
||||
|
||||
typedef CGAL::Arr_naive_point_location<Arrangement> Naive_pl;
|
||||
typedef CGAL::Arr_landmarks_point_location<Arrangement> Landmarks_pl;
|
||||
using Naive_pl = CGAL::Arr_naive_point_location<Arrangement>;
|
||||
using Landmarks_pl = CGAL::Arr_landmarks_point_location<Arrangement>;
|
||||
|
||||
int main() {
|
||||
// Construct the arrangement.
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ void print_point_location
|
|||
(const typename Arrangement_::Point_2& q,
|
||||
typename CGAL::Arr_point_location_result<Arrangement_>::Type obj)
|
||||
{
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
using Arrangement_2 = Arrangement_;
|
||||
using Vertex_const_handle = typename Arrangement_2::Vertex_const_handle;
|
||||
using Halfedge_const_handle = typename Arrangement_2::Halfedge_const_handle;
|
||||
using Face_const_handle = typename Arrangement_2::Face_const_handle;
|
||||
|
||||
const Vertex_const_handle* v;
|
||||
const Halfedge_const_handle* e;
|
||||
|
|
@ -39,8 +39,8 @@ void locate_point(const PointLocation& pl,
|
|||
const typename PointLocation::Arrangement_2::Point_2& q)
|
||||
{
|
||||
// Perform the point-location query.
|
||||
typedef PointLocation Point_location;
|
||||
typedef typename Point_location::Arrangement_2 Arrangement_2;
|
||||
using Point_location = PointLocation;
|
||||
using Arrangement_2 = typename Point_location::Arrangement_2;
|
||||
typename CGAL::Arr_point_location_result<Arrangement_2>::Type obj =
|
||||
pl.locate(q);
|
||||
|
||||
|
|
@ -56,16 +56,16 @@ void shoot_vertical_ray(const VerticalRayShooting& vrs,
|
|||
const typename
|
||||
VerticalRayShooting::Arrangement_2::Point_2& q)
|
||||
{
|
||||
typedef VerticalRayShooting Vertical_ray_shooting;
|
||||
using Vertical_ray_shooting = VerticalRayShooting;
|
||||
|
||||
// Perform the point-location query.
|
||||
typename Vertical_ray_shooting::result_type obj = vrs.ray_shoot_up(q);
|
||||
|
||||
// Print the result.
|
||||
typedef typename Vertical_ray_shooting::Arrangement_2 Arrangement_2;
|
||||
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
using Arrangement_2 = typename Vertical_ray_shooting::Arrangement_2;
|
||||
using Vertex_const_handle = typename Arrangement_2::Vertex_const_handle;
|
||||
using Halfedge_const_handle = typename Arrangement_2::Halfedge_const_handle;
|
||||
using Face_const_handle = typename Arrangement_2::Face_const_handle;
|
||||
|
||||
const Vertex_const_handle* v;
|
||||
const Halfedge_const_handle* e;
|
||||
|
|
@ -94,10 +94,10 @@ void shoot_vertical_ray(const VerticalRayShooting& vrs,
|
|||
template <typename Arrangement_>
|
||||
void construct_segments_arr(Arrangement_& arr)
|
||||
{
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef typename Arrangement_2::Point_2 Point_2;
|
||||
typedef typename Arrangement_2::X_monotone_curve_2 Segment_2;
|
||||
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
|
||||
using Arrangement_2 = Arrangement_;
|
||||
using Point_2 = typename Arrangement_2::Point_2;
|
||||
using Segment_2 = typename Arrangement_2::X_monotone_curve_2;
|
||||
using Halfedge_handle = typename Arrangement_2::Halfedge_handle;
|
||||
|
||||
Point_2 p0(3,2), p1(0,3), p2(2,5), p3(4,5), p4(6,3), p5(3,0);
|
||||
Segment_2 s1(p1, p2), s2(p2, p3), s3(p3, p4), s4(p4, p5), s5(p5, p1);
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ int main() {
|
|||
#include "arr_Bezier.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arr_polycurve_traits_2<Traits> Polycurve_bezier_traits;
|
||||
typedef Polycurve_bezier_traits::Point_2 Point;
|
||||
typedef Polycurve_bezier_traits::X_monotone_curve_2 X_mono_polycurve;
|
||||
typedef CGAL::Arrangement_2<Polycurve_bezier_traits> Arrangement_2;
|
||||
using Polycurve_bezier_traits = CGAL::Arr_polycurve_traits_2<Traits>;
|
||||
using Point = Polycurve_bezier_traits::Point_2;
|
||||
using X_mono_polycurve = Polycurve_bezier_traits::X_monotone_curve_2;
|
||||
using Arrangement_2 = CGAL::Arrangement_2<Polycurve_bezier_traits>;
|
||||
|
||||
typedef std::variant<Point, Bezier_x_monotone_curve> Make_x_monotone_result;
|
||||
using Make_x_monotone_result = std::variant<Point, Bezier_x_monotone_curve>;
|
||||
|
||||
int main() {
|
||||
Polycurve_bezier_traits pc_traits;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ int main() {
|
|||
#include "arr_circular.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arr_polycurve_traits_2<Traits> Polycurve_traits;
|
||||
typedef Polycurve_traits::X_monotone_curve_2 X_monotone_polycurve;
|
||||
typedef Polycurve_traits::Curve_2 Polycurve;
|
||||
typedef Kernel::Circle_2 Circle_2;
|
||||
typedef CGAL::Arrangement_2<Polycurve_traits> Polycurve_circ_arc_arrangment;
|
||||
using Polycurve_traits = CGAL::Arr_polycurve_traits_2<Traits>;
|
||||
using X_monotone_polycurve = Polycurve_traits::X_monotone_curve_2;
|
||||
using Polycurve = Polycurve_traits::Curve_2;
|
||||
using Circle_2 = Kernel::Circle_2;
|
||||
using Polycurve_circ_arc_arrangment = CGAL::Arrangement_2<Polycurve_traits>;
|
||||
|
||||
int main() {
|
||||
Polycurve_traits traits;
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ int main() {
|
|||
#include "arr_conics.h"
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Arr_polycurve_traits_2<Traits> Polycurve_conic_traits_2;
|
||||
typedef Polycurve_conic_traits_2::X_monotone_curve_2 X_monotone_polycurve;
|
||||
typedef Polycurve_conic_traits_2::Curve_2 Polycurve;
|
||||
typedef CGAL::Arrangement_2<Polycurve_conic_traits_2> Polycurve_conic_arrangment;
|
||||
using Polycurve_conic_traits_2 = CGAL::Arr_polycurve_traits_2<Traits>;
|
||||
using X_monotone_polycurve = Polycurve_conic_traits_2::X_monotone_curve_2;
|
||||
using Polycurve = Polycurve_conic_traits_2::Curve_2;
|
||||
using Polycurve_conic_arrangment = CGAL::Arrangement_2<Polycurve_conic_traits_2>;
|
||||
|
||||
int main() {
|
||||
Traits sub_traits;
|
||||
|
|
|
|||
|
|
@ -10,31 +10,29 @@
|
|||
#include <CGAL/Arr_polyline_traits_2.h>
|
||||
#include <CGAL/Arrangement_on_surface_2.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel> Segment_traits_2;
|
||||
typedef CGAL::Arr_polyline_traits_2<Segment_traits_2> Poly_traits_2;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Segment_traits_2 = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel>;
|
||||
using Poly_traits_2 = CGAL::Arr_polyline_traits_2<Segment_traits_2>;
|
||||
|
||||
typedef Poly_traits_2::Point_2 Point_2;
|
||||
typedef Poly_traits_2::Curve_2 Poly_curve_2;
|
||||
typedef Poly_traits_2::X_monotone_curve_2 X_poly_curve_2;
|
||||
typedef CGAL::Arr_spherical_topology_traits_2<Poly_traits_2>
|
||||
Topol_poly_traits_2;
|
||||
typedef CGAL::Arrangement_on_surface_2<Poly_traits_2, Topol_poly_traits_2>
|
||||
Poly_arr;
|
||||
using Point_2 = Poly_traits_2::Point_2;
|
||||
using Poly_curve_2 = Poly_traits_2::Curve_2;
|
||||
using X_poly_curve_2 = Poly_traits_2::X_monotone_curve_2;
|
||||
using Topol_poly_traits_2 =
|
||||
CGAL::Arr_spherical_topology_traits_2<Poly_traits_2>;
|
||||
using Poly_arr =
|
||||
CGAL::Arrangement_on_surface_2<Poly_traits_2, Topol_poly_traits_2>;
|
||||
|
||||
typedef Segment_traits_2::Curve_2 Seg_curve_2;
|
||||
typedef Segment_traits_2::X_monotone_curve_2 X_seg_curve_2;
|
||||
typedef CGAL::Arr_spherical_topology_traits_2<Segment_traits_2>
|
||||
Topol_segment_traits_2;
|
||||
typedef CGAL::Arrangement_on_surface_2<Segment_traits_2, Topol_segment_traits_2>
|
||||
Segment_arr;
|
||||
using Seg_curve_2 = Segment_traits_2::Curve_2;
|
||||
using X_seg_curve_2 = Segment_traits_2::X_monotone_curve_2;
|
||||
using Topol_segment_traits_2 =
|
||||
CGAL::Arr_spherical_topology_traits_2<Segment_traits_2>;
|
||||
using Segment_arr =
|
||||
CGAL::Arrangement_on_surface_2<Segment_traits_2, Topol_segment_traits_2>;
|
||||
|
||||
int main() {
|
||||
Segment_traits_2 seg_traits;
|
||||
Segment_traits_2::Construct_point_2 ctr_p =
|
||||
seg_traits.construct_point_2_object();
|
||||
Segment_traits_2::Construct_x_monotone_curve_2 ctr_seg =
|
||||
seg_traits.construct_x_monotone_curve_2_object();
|
||||
auto ctr_p = seg_traits.construct_point_2_object();
|
||||
auto ctr_seg = seg_traits.construct_x_monotone_curve_2_object();
|
||||
|
||||
Point_2 p1 = ctr_p(0, 1, -1);
|
||||
Point_2 p2 = ctr_p(-11, 7, -7);
|
||||
|
|
@ -62,8 +60,7 @@ int main() {
|
|||
points.push_back(p5);
|
||||
|
||||
Poly_traits_2 poly_traits;
|
||||
Poly_traits_2::Construct_x_monotone_curve_2 ctr =
|
||||
poly_traits.construct_x_monotone_curve_2_object();
|
||||
auto ctr = poly_traits.construct_x_monotone_curve_2_object();
|
||||
Poly_arr poly_arr(&poly_traits);
|
||||
insert(poly_arr, ctr(seg_cv1));
|
||||
insert(poly_arr, ctr(seg_cv2));
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef CGAL::Arr_directional_non_caching_segment_basic_traits_2<Kernel>
|
||||
Subcurve_traits;
|
||||
typedef CGAL::Arr_polycurve_basic_traits_2<Subcurve_traits> Geom_traits;
|
||||
typedef Geom_traits::Point_2 Point;
|
||||
typedef Subcurve_traits::X_monotone_curve_2 X_monotone_subcurve;
|
||||
typedef Geom_traits::X_monotone_curve_2 X_monotone_curve;
|
||||
typedef CGAL::Arrangement_2<Geom_traits> Arrangement;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Subcurve_traits =
|
||||
CGAL::Arr_directional_non_caching_segment_basic_traits_2<Kernel>;
|
||||
using Geom_traits = CGAL::Arr_polycurve_basic_traits_2<Subcurve_traits>;
|
||||
using Point = Geom_traits::Point_2;
|
||||
using X_monotone_subcurve = Subcurve_traits::X_monotone_curve_2;
|
||||
using X_monotone_curve = Geom_traits::X_monotone_curve_2;
|
||||
using Arrangement = CGAL::Arrangement_2<Geom_traits>;
|
||||
|
||||
int main() {
|
||||
Geom_traits traits;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
// predefined kernel with exact constructions and exact predicates.
|
||||
|
||||
#include <list>
|
||||
#include <chrono>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
||||
#include "arr_exact_construction_segments.h"
|
||||
#include "arr_print.h"
|
||||
|
|
@ -28,18 +28,17 @@ int main (int argc, char* argv[]) {
|
|||
|
||||
// Construct the arrangement by aggregately inserting all segments.
|
||||
Arrangement arr;
|
||||
CGAL::Timer timer;
|
||||
|
||||
std::cout << "Performing aggregated insertion of "
|
||||
<< segments.size() << " segments.\n";
|
||||
|
||||
timer.start();
|
||||
auto start = std::chrono::system_clock::now();
|
||||
insert(arr, segments.begin(), segments.end());
|
||||
timer.stop();
|
||||
std::chrono::duration<double> secs = std::chrono::system_clock::now() - start;
|
||||
|
||||
print_arrangement_size(arr);
|
||||
|
||||
std::cout << "Construction took " << timer.time() << " seconds.\n";
|
||||
std::cout << "Construction took " << secs.count() << " seconds.\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,20 @@
|
|||
// Constructing an arrangement of non-intersecting line segments using the
|
||||
// predefined kernel with exact predicates.
|
||||
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Arr_non_caching_segment_basic_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
#include <CGAL/Timer.h>
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef Kernel::FT Number_type;
|
||||
typedef CGAL::Arr_non_caching_segment_basic_traits_2<Kernel> Traits_2;
|
||||
typedef Traits_2::Point_2 Point_2;
|
||||
typedef Traits_2::X_monotone_curve_2 Segment_2;
|
||||
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
||||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Number_type = Kernel::FT;
|
||||
using Traits_2 = CGAL::Arr_non_caching_segment_basic_traits_2<Kernel>;
|
||||
using Point_2 = Traits_2::Point_2;
|
||||
using Segment_2 = Traits_2::X_monotone_curve_2;
|
||||
using Arrangement_2 = CGAL::Arrangement_2<Traits_2>;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Get the name of the input file from the command line, or use the default
|
||||
|
|
@ -39,33 +40,31 @@ int main(int argc, char* argv[]) {
|
|||
// <sx_n> <sy_n> <tx_n> <ty_n> // source and target of segment #n.
|
||||
std::list<Segment_2> segments;
|
||||
|
||||
unsigned int n;
|
||||
std::size_t n;
|
||||
in_file >> n;
|
||||
unsigned int i;
|
||||
for (i = 0; i < n; ++i) {
|
||||
for (std::size_t i = 0; i < n; ++i) {
|
||||
double sx, sy, tx, ty;
|
||||
in_file >> sx >> sy >> tx >> ty;
|
||||
segments.push_back (Segment_2 (Point_2 (Number_type(sx), Number_type(sy)),
|
||||
Point_2 (Number_type(tx), Number_type(ty))));
|
||||
segments.push_back(Segment_2(Point_2 (Number_type(sx), Number_type(sy)),
|
||||
Point_2 (Number_type(tx), Number_type(ty))));
|
||||
}
|
||||
in_file.close();
|
||||
|
||||
// Construct the arrangement by aggregately inserting all segments.
|
||||
Arrangement_2 arr;
|
||||
CGAL::Timer timer;
|
||||
|
||||
std::cout << "Performing aggregated insertion of " << n << " segments.\n";
|
||||
|
||||
timer.start();
|
||||
auto start = std::chrono::system_clock::now();
|
||||
insert_non_intersecting_curves (arr, segments.begin(), segments.end());
|
||||
timer.stop();
|
||||
std::chrono::duration<double> secs = std::chrono::system_clock::now() - start;
|
||||
|
||||
// Print the arrangement dimensions.
|
||||
std::cout << "V = " << arr.number_of_vertices()
|
||||
<< ", E = " << arr.number_of_edges()
|
||||
<< ", F = " << arr.number_of_faces() << std::endl;
|
||||
<< ", E = " << arr.number_of_edges()
|
||||
<< ", F = " << arr.number_of_faces() << std::endl;
|
||||
|
||||
std::cout << "Construction took " << timer.time() << " seconds.\n";
|
||||
std::cout << "Construction took " << secs.count() << " seconds.\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,23 +18,22 @@ int main() {
|
|||
#include <CGAL/Arr_rational_function_traits_2.h> // Traits
|
||||
#include <CGAL/Arrangement_2.h> // Arrangement
|
||||
|
||||
typedef CORE::BigInt Integer;
|
||||
typedef CORE::BigRat Rational;
|
||||
typedef CGAL::Algebraic_kernel_d_1<Integer> AK1;
|
||||
typedef CGAL::Arr_rational_function_traits_2<AK1> Traits_2;
|
||||
using Integer = CORE::BigInt;
|
||||
using Rational = CORE::BigRat;
|
||||
using AK1 = CGAL::Algebraic_kernel_d_1<Integer>;
|
||||
using Traits_2 = CGAL::Arr_rational_function_traits_2<AK1>;
|
||||
|
||||
typedef std::vector<Rational> Rat_vec;
|
||||
typedef Traits_2::Algebraic_real_1 Alg_real_1;
|
||||
using Rat_vec = std::vector<Rational>;
|
||||
using Alg_real_1 = Traits_2::Algebraic_real_1;
|
||||
|
||||
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
||||
using Arrangement_2 = CGAL::Arrangement_2<Traits_2>;
|
||||
|
||||
int main () {
|
||||
CGAL::IO::set_pretty_mode(std::cout); // for nice printouts.
|
||||
|
||||
// Traits class object
|
||||
Traits_2 traits;
|
||||
Traits_2::Construct_x_monotone_curve_2 construct_arc
|
||||
= traits.construct_x_monotone_curve_2_object();
|
||||
auto construct_arc = traits.construct_x_monotone_curve_2_object();
|
||||
|
||||
// container storing all arcs
|
||||
std::vector<Traits_2::X_monotone_curve_2> arcs;
|
||||
|
|
|
|||
|
|
@ -14,36 +14,36 @@
|
|||
|
||||
#include "point_location_utils.h"
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef Kernel::Direction_3 Direction_3;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Point_3 = Kernel::Point_3;
|
||||
using Direction_3 = Kernel::Direction_3;
|
||||
|
||||
#if 0
|
||||
typedef CGAL::Arr_polyhedral_sgm_traits<Kernel, -8, 6> Gm_traits;
|
||||
using Gm_traits = CGAL::Arr_polyhedral_sgm_traits<Kernel, -8, 6>;
|
||||
#elif 0
|
||||
typedef CGAL::Arr_polyhedral_sgm_traits<Kernel, -11, 7> Gm_traits;
|
||||
using Gm_traits = CGAL::Arr_polyhedral_sgm_traits<Kernel, -11, 7>;
|
||||
#else
|
||||
typedef CGAL::Arr_polyhedral_sgm_traits<Kernel, -1, 0> Gm_traits;
|
||||
using Gm_traits = CGAL::Arr_polyhedral_sgm_traits<Kernel, -1, 0>;
|
||||
#endif
|
||||
|
||||
typedef CGAL::Arr_polyhedral_sgm<Gm_traits> Gm;
|
||||
typedef CGAL::Arr_polyhedral_sgm_polyhedron_3<Gm, Kernel> Gm_polyhedron;
|
||||
typedef CGAL::Arr_polyhedral_sgm_initializer<Gm, Gm_polyhedron> Gm_initializer;
|
||||
using Gm = CGAL::Arr_polyhedral_sgm<Gm_traits>;
|
||||
using Gm_polyhedron = CGAL::Arr_polyhedral_sgm_polyhedron_3<Gm, Kernel>;
|
||||
using Gm_initializer = CGAL::Arr_polyhedral_sgm_initializer<Gm, Gm_polyhedron>;
|
||||
|
||||
typedef CGAL::Arr_naive_point_location<Gm> Naive_pl;
|
||||
typedef CGAL::Arr_walk_along_line_point_location<Gm> Walk_pl;
|
||||
typedef CGAL::Arr_landmarks_point_location<Gm> Landmarks_pl;
|
||||
typedef CGAL::Arr_trapezoid_ric_point_location<Gm> Trap_pl;
|
||||
using Naive_pl = CGAL::Arr_naive_point_location<Gm>;
|
||||
using Walk_pl = CGAL::Arr_walk_along_line_point_location<Gm>;
|
||||
using Landmarks_pl = CGAL::Arr_landmarks_point_location<Gm>;
|
||||
using Trap_pl = CGAL::Arr_trapezoid_ric_point_location<Gm>;
|
||||
|
||||
typedef Gm::Geometry_traits_2 Geom_traits;
|
||||
typedef Geom_traits::Point_2 Point_2;
|
||||
using Geom_traits = Gm::Geometry_traits_2;
|
||||
using Point_2 = Geom_traits::Point_2;
|
||||
|
||||
typedef CGAL::Arr_point_location_result<Gm> Point_location_result;
|
||||
typedef std::pair<Point_2, Point_location_result::Type> Query_result;
|
||||
using Point_location_result = CGAL::Arr_point_location_result<Gm>;
|
||||
using Query_result = std::pair<Point_2, Point_location_result::Type>;
|
||||
|
||||
typedef Gm::Vertex_const_handle Vertex_const_handle;
|
||||
typedef Gm::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef Gm::Face_const_handle Face_const_handle;
|
||||
using Vertex_const_handle = Gm::Vertex_const_handle;
|
||||
using Halfedge_const_handle = Gm::Halfedge_const_handle;
|
||||
using Face_const_handle = Gm::Face_const_handle;
|
||||
|
||||
int main() {
|
||||
Gm_polyhedron p;
|
||||
|
|
@ -77,7 +77,7 @@ protected:
|
|||
gm_initializer(p);
|
||||
if (! gm.is_valid()) return -1;
|
||||
|
||||
Geom_traits::Construct_point_2 ctr_point = traits.construct_point_2_object();
|
||||
auto ctr_point = traits.construct_point_2_object();
|
||||
Point_2 points[] = {
|
||||
ctr_point(-1, 0, 0),
|
||||
ctr_point(0, -1, 0),
|
||||
|
|
|
|||
|
|
@ -15,31 +15,30 @@
|
|||
|
||||
#include "arr_print.h"
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
|
||||
#if 0
|
||||
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -8, 6> Geom_traits_2;
|
||||
using Geom_traits_2 = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -8, 6>;
|
||||
#elif 0
|
||||
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -11, 7> Geom_traits_2;
|
||||
using Geom_traits_2 = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -11, 7>;
|
||||
#else
|
||||
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -1, 0> Geom_traits_2;
|
||||
using Geom_traits_2 = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -1, 0>;
|
||||
#endif
|
||||
|
||||
typedef Geom_traits_2::Point_2 Point_2;
|
||||
typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef CGAL::Arr_spherical_topology_traits_2<Geom_traits_2> Topol_traits_2;
|
||||
typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
|
||||
Arrangement_2;
|
||||
typedef Arrangement_2::Vertex_handle Vertex_handle;
|
||||
using Point_2 = Geom_traits_2::Point_2;
|
||||
using X_monotone_curve_2 = Geom_traits_2::X_monotone_curve_2;
|
||||
using Topol_traits_2 = CGAL::Arr_spherical_topology_traits_2<Geom_traits_2>;
|
||||
using Arrangement_2 =
|
||||
CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>;
|
||||
using Vertex_handle = Arrangement_2::Vertex_handle;
|
||||
|
||||
int main() {
|
||||
Geom_traits_2 traits;
|
||||
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
|
||||
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =
|
||||
traits.construct_x_monotone_curve_2_object();
|
||||
auto ctr_p = traits.construct_point_2_object();
|
||||
auto ctr_xcv = traits.construct_x_monotone_curve_2_object();
|
||||
|
||||
std::vector< Point_2 > points;
|
||||
std::vector< X_monotone_curve_2 > xcvs;
|
||||
std::vector<Point_2> points;
|
||||
std::vector<X_monotone_curve_2> xcvs;
|
||||
|
||||
CGAL::IO::set_pretty_mode(std::cout);
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue