Merge pull request #2547 from lrineau/CMake-parse_CTest_XML_output-lrineau

CGAL testsuite implemented with CTest plus Python (part.1)
This commit is contained in:
Laurent Rineau 2017-11-13 11:13:54 +01:00
commit c6068691fa
2251 changed files with 433015 additions and 66523 deletions

View File

@ -11,55 +11,61 @@ env:
- PACKAGE='BGL Boolean_set_operations_2 Bounding_volumes '
- PACKAGE='Box_intersection_d CGAL_ImageIO CGAL_ipelets '
- PACKAGE='Circular_kernel_2 Circular_kernel_3 Circulator '
- PACKAGE='Combinatorial_map Cone_spanners_2 Convex_decomposition_3 '
- PACKAGE='Convex_hull_2 Convex_hull_3 Convex_hull_d '
- PACKAGE='Distance_2 Distance_3 Envelope_2 '
- PACKAGE='Envelope_3 Filtered_kernel Generalized_map '
- PACKAGE='Generator Geomview GraphicsView '
- PACKAGE='HalfedgeDS Hash_map Inscribed_areas '
- PACKAGE='Installation Interpolation Intersections_2 '
- PACKAGE='Intersections_3 Interval_skip_list Interval_support '
- PACKAGE='Inventor Jet_fitting_3 Kernel_23 '
- PACKAGE='Kernel_d Kinetic_data_structures Kinetic_framework '
- PACKAGE='Linear_cell_complex Matrix_search Mesh_2 '
- PACKAGE='Mesh_3 Minkowski_sum_2 Minkowski_sum_3 '
- PACKAGE='Modifier Modular_arithmetic Nef_2 '
- PACKAGE='Nef_3 Nef_S2 NewKernel_d '
- PACKAGE='Number_types Optimal_transportation_reconstruction_2 Partition_2 '
- PACKAGE='Periodic_2_triangulation_2 Periodic_3_triangulation_3 Point_set_2 '
- PACKAGE='Point_set_3 Point_set_processing_3 Point_set_shape_detection_3 '
- PACKAGE='Poisson_surface_reconstruction_3 Polygon Polygon_mesh_processing '
- PACKAGE='Polyhedron Polyhedron_IO Polyline_simplification_2 '
- PACKAGE='Polynomial Polytope_distance_d Principal_component_analysis '
- PACKAGE='Profiling_tools QP_solver Random_numbers '
- PACKAGE='Ridges_3 Scale_space_reconstruction_3 Segment_Delaunay_graph_2 '
- PACKAGE='Segment_Delaunay_graph_Linf_2 Skin_surface_3 Snap_rounding_2 '
- PACKAGE='Solver_interface Spatial_searching Spatial_sorting '
- PACKAGE='STL_Extension Straight_skeleton_2 Stream_lines_2 '
- PACKAGE='Stream_support Subdivision_method_3 Surface_mesh '
- PACKAGE='Surface_mesh_deformation Surface_mesher Surface_mesh_parameterization '
- PACKAGE='Surface_mesh_segmentation Surface_mesh_shortest_path Surface_mesh_simplification '
- PACKAGE='Surface_mesh_skeletonization Sweep_line_2 TDS_2 '
- PACKAGE='TDS_3 Three Triangulation '
- PACKAGE='Triangulation_2 Triangulation_3 Union_find '
- PACKAGE='Visibility_2 Voronoi_diagram_2 '
- PACKAGE='Classification Combinatorial_map Cone_spanners_2 '
- PACKAGE='Convex_decomposition_3 Convex_hull_2 Convex_hull_3 '
- PACKAGE='Convex_hull_d Distance_2 Distance_3 '
- PACKAGE='Envelope_2 Envelope_3 Filtered_kernel '
- PACKAGE='Generalized_map Generator Geomview '
- PACKAGE='GraphicsView HalfedgeDS Hash_map '
- PACKAGE='Inscribed_areas Installation Interpolation '
- PACKAGE='Intersections_2 Intersections_3 Interval_skip_list '
- PACKAGE='Interval_support Inventor Jet_fitting_3 '
- PACKAGE='Kernel_23 Kernel_d Kinetic_data_structures '
- PACKAGE='Kinetic_framework Linear_cell_complex Matrix_search '
- PACKAGE='Mesh_2 Mesh_3 Minkowski_sum_2 '
- PACKAGE='Minkowski_sum_3 Modifier Modular_arithmetic '
- PACKAGE='Nef_2 Nef_3 Nef_S2 '
- PACKAGE='NewKernel_d Number_types Optimal_transportation_reconstruction_2 '
- PACKAGE='Partition_2 Periodic_2_triangulation_2 Periodic_3_triangulation_3 '
- PACKAGE='Point_set_2 Point_set_3 Point_set_processing_3 '
- PACKAGE='Point_set_shape_detection_3 Poisson_surface_reconstruction_3 Polygon '
- PACKAGE='Polygon_mesh_processing Polyhedron Polyhedron_IO '
- PACKAGE='Polyline_simplification_2 Polynomial Polytope_distance_d '
- PACKAGE='Principal_component_analysis Profiling_tools QP_solver '
- PACKAGE='Random_numbers Ridges_3 Scale_space_reconstruction_3 '
- PACKAGE='Segment_Delaunay_graph_2 Segment_Delaunay_graph_Linf_2 Set_movable_separability_2 '
- PACKAGE='Skin_surface_3 Snap_rounding_2 Solver_interface '
- PACKAGE='Spatial_searching Spatial_sorting STL_Extension '
- PACKAGE='Straight_skeleton_2 Stream_lines_2 Stream_support '
- PACKAGE='Subdivision_method_3 Surface_mesh Surface_mesh_deformation '
- PACKAGE='Surface_mesher Surface_mesh_parameterization Surface_mesh_segmentation '
- PACKAGE='Surface_mesh_shortest_path Surface_mesh_simplification Surface_mesh_skeletonization '
- PACKAGE='Sweep_line_2 TDS_2 TDS_3 '
- PACKAGE='Three Triangulation Triangulation_2 '
- PACKAGE='Triangulation_3 Union_find Visibility_2 '
- PACKAGE='Voronoi_diagram_2 '
- PACKAGE='Polyhedron_demo'
compiler:
- clang-3.6
- gcc
install:
- if [[ "$CXX" = "clang++" ]]; then export CXX=clang++-3.6 CC=clang-3.6; fi
before_script:
- mkdir -p build
- cd build
- cmake -DCGAL_HEADER_ONLY=ON -DWITH_demos:BOOL=TRUE -DWITH_examples:BOOL=true -DWITH_tests:BOOL=TRUE -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG ..
- cmake -DCGAL_HEADER_ONLY=ON -DQt5_DIR="/opt/qt55/lib/cmake/Qt5" -DQt5Svg_DIR="/opt/qt55/lib/cmake/Qt5Svg" -DQt5OpenGL_DIR="/opt/qt55/lib/cmake/Qt5OpenGL" -DWITH_demos:BOOL=TRUE -DWITH_examples:BOOL=true -DWITH_tests:BOOL=TRUE -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG ..
- make
- cd ..
script:
- cd ./.travis
- bash -x -e ./build_package.sh $PACKAGE
compiler:
- clang
- gcc
addons:
apt:
packages:
apt:
sources:
- sourceline: 'ppa:ppsspp/cmake'
- sourceline: 'ppa:hedges/qt5.5'
packages:
- clang-3.6
- zsh
- cmake
- libboost1.55-dev
@ -70,18 +76,20 @@ addons:
- libmpfr-dev
- zlib1g-dev
- libeigen3-dev # too old
- qtbase5-dev
- qtscript5-dev
- libqt5svg5-dev
- qttools5-dev
- qttools5-dev-tools
- libqt5opengl5-dev
- libqt5gui5
- libqt5widgets5
- libqt5xml5
- qt5-qmake
- qt55base
- qt55script
- qt55svg
- qt55tools
- qt55graphicaleffects
- mesa-common-dev
- libglu1-mesa-dev
# Not allowed (yet)
# - geomview
# - libglew1.5-dev
# - libipe-dev
# - libmpfi-dev
notifications:
email:
on_success: change # default: always
on_failure: always # default: always

View File

@ -1,14 +1,66 @@
#!/bin/bash
set -e
CXX_FLAGS="-DCGAL_NDEBUG"
function build_examples {
mkdir -p build-travis
cd build-travis
cmake -DCGAL_DIR="$ROOT/build" -DCMAKE_CXX_FLAGS_RELEASE="${CXX_FLAGS}" ..
make -j2
}
function build_tests {
build_examples
}
function build_demo {
mkdir -p build-travis
cd build-travis
if [ $NEED_3D = 1 ]; then
#install libqglviewer
git clone --depth=4 -b v2.6.3 --single-branch https://github.com/GillesDebunne/libQGLViewer.git ./qglviewer
pushd ./qglviewer/QGLViewer
#use qt5 instead of qt4
# export QT_SELECT=5
qmake NO_QT_VERSION_SUFFIX=yes
make -j2
if [ ! -f libQGLViewer.so ]; then
echo "libQGLViewer.so not made"
exit 1
else
echo "QGLViewer built successfully"
fi
#end install qglviewer
popd
fi
EXTRA_CXX_FLAGS=
case "$CC" in
clang*)
EXTRA_CXX_FLAGS="-Werror=inconsistent-missing-override"
;;
esac
if [ $NEED_3D = 1 ]; then
QGLVIEWERROOT=$PWD/qglviewer
export QGLVIEWERROOT
fi
cmake -DCGAL_DIR="$ROOT/build" -DQt5_DIR="/opt/qt55/lib/cmake/Qt5" -DQt5Svg_DIR="/opt/qt55/lib/cmake/Qt5Svg" -DQt5OpenGL_DIR="/opt/qt55/lib/cmake/Qt5OpenGL" -DCGAL_DONT_OVERRIDE_CMAKE_FLAGS:BOOL=ON -DCMAKE_CXX_FLAGS_RELEASE="${CXX_FLAGS} ${EXTRA_CXX_FLAGS}" ..
make -j2
}
IFS=$' '
ROOT="$PWD/../"
ROOT="$PWD/.."
NEED_3D=0
for ARG in $(echo "$@")
do
if [ "$ARG" = "CHECK" ]
then
zsh $ROOT/Scripts/developer_scripts/test_merge_of_branch HEAD
mkdir -p build-travis
pushd build-travis
cmake -DCGAL_ENABLE_CHECK_HEADERS=ON -DQt5_DIR="/opt/qt55/lib/cmake/Qt5" ../..
make -j2 check_headers
popd
#parse current matrix and check that no package has been forgotten
old_IFS=$IFS
IFS=$'\n'
@ -38,6 +90,9 @@ do
exit 1
fi
echo "Matrix is up to date."
cd .travis
./generate_travis.sh -c
cd ..
exit 0
fi
EXAMPLES="$ARG/examples/$ARG"
@ -53,21 +108,15 @@ do
if [ -d "$ROOT/$EXAMPLES" ]
then
cd $ROOT/$EXAMPLES
mkdir -p build
cd build
cmake -DCGAL_DIR="$ROOT/build" -DCMAKE_CXX_FLAGS_RELEASE="-DCGAL_NDEBUG" ..
make -j2
build_examples
elif [ "$ARG" != Polyhedron_demo ]; then
echo "No example found for $ARG"
fi
if [ -d "$ROOT/$TEST" ]
then
cd $ROOT/$TEST
mkdir -p build
cd build
cmake -DCGAL_DIR="$ROOT/build" -DCMAKE_CXX_FLAGS_RELEASE="-DCGAL_NDEBUG" ..
make -j2
cd $ROOT/$TEST
build_tests
elif [ "$ARG" != Polyhedron_demo ]; then
echo "No test found for $ARG"
fi
@ -81,54 +130,21 @@ do
fi
if [ "$ARG" != Polyhedron ] && [ -d "$ROOT/$DEMO" ]
then
if [ $NEED_3D = 1 ]; then
cd $ROOT/$DEMO
#install libqglviewer
git clone --depth=1 https://github.com/GillesDebunne/libQGLViewer.git ./qglviewer
cd ./qglviewer/QGLViewer
#use qt5 instead of qt4
export QT_SELECT=5
qmake NO_QT_VERSION_SUFFIX=yes
make -j2
if [ ! -f libQGLViewer.so ]; then
echo "libQGLViewer.so not made"
exit 1
else
echo "QGLViewer built successfully"
fi
#end install qglviewer
fi
cd $ROOT/$DEMO
mkdir -p build
cd build
if [ $NEED_3D = 1 ]; then
cmake -DCGAL_DIR="$ROOT/build" -DQGLVIEWER_INCLUDE_DIR="$ROOT/$DEMO/qglviewer" -DQGLVIEWER_LIBRARIES="$ROOT/$DEMO/qglviewer/QGLViewer/libQGLViewer.so" -DCMAKE_CXX_FLAGS_RELEASE="-DCGAL_NDEBUG" ..
else
cmake -DCGAL_DIR="$ROOT/build" -DCMAKE_CXX_FLAGS_RELEASE="-DCGAL_NDEBUG" ..
fi
make -j2
cd $ROOT/$DEMO
build_demo
elif [ "$ARG" != Polyhedron_demo ]; then
echo "No demo found for $ARG"
fi
done
if [ "$ARG" = Polyhedron_demo ]; then
cd "$ROOT/Polyhedron/demo/Polyhedron"
#install libqglviewer
git clone --depth=1 https://github.com/GillesDebunne/libQGLViewer.git ./qglviewer
cd ./qglviewer/QGLViewer
#use qt5 instead of qt4
export QT_SELECT=5
qmake NO_QT_VERSION_SUFFIX=yes
make -j2
if [ ! -f libQGLViewer.so ]; then
echo "libQGLViewer.so not made"
exit 1
fi
#end install qglviewer
cd "$ROOT/Polyhedron/demo/Polyhedron"
mkdir -p ./build
cd ./build
cmake -DCGAL_DIR="$ROOT/build" -DQGLVIEWER_INCLUDE_DIR="$ROOT/Polyhedron/demo/Polyhedron/qglviewer" -DQGLVIEWER_LIBRARIES="$ROOT/Polyhedron/demo/Polyhedron/qglviewer/QGLViewer/libQGLViewer.so" -DCMAKE_CXX_FLAGS_RELEASE="-DCGAL_NDEBUG" ..
make -j2
DEMO=Polyhedron/demo/Polyhedron
NEED_3D=1
cd "$ROOT/$DEMO"
build_demo
fi
done
# Local Variables:
# tab-width: 2
# sh-basic-offset: 2
# End:

25
.travis/generate_travis.sh Normal file → Executable file
View File

@ -1,4 +1,10 @@
#!/bin/bash
CHECK=
case $1 in
--check) CHECK=y;;
esac
set -e
cd ../
@ -28,8 +34,7 @@ done
if [ -f ".travis.yml" ]
then
#copy the current .travis.yml for later check
cp ./.travis.yml ./.travis.old
rm .travis.yml
mv ./.travis.yml ./.travis.old
fi
#writes the first part of the file
old_IFS=$IFS
@ -56,7 +61,7 @@ echo " - PACKAGE='Polyhedron_demo' " >> .travis.yml
COPY=0
for LINE in $(cat "$PWD/.travis/template.txt")
do
if [ "$LINE" = "install: " ]
if [ "$LINE" = "compiler: " ]
then
COPY=1
fi
@ -67,11 +72,19 @@ do
done
IFS=$' '
#check if there are differences between the files
read -a DIFF <<<$(diff -q ./.travis.yml ./.travis.old)
if [ "${DIFF[0]}" != "" ]
if ! cmp -s ./.travis.yml ./.travis.old;
then
echo ".travis.yml has changed"
echo ".travis.yml has changed"
if [ -n "$CHECK" ]; then
echo "You should modify the file .travis/template.txt"
exit 1
fi
fi
#erase old travis
rm ./.travis.old
IFS=$old_IFS
# Local Variables:
# tab-width: 2
# sh-basic-offset: 2
# End:

View File

@ -19,6 +19,7 @@ CGAL_ipelets
Circular_kernel_2
Circular_kernel_3
Circulator
Classification
Combinatorial_map
Cone_spanners_2
Convex_decomposition_3
@ -86,6 +87,7 @@ Ridges_3
Scale_space_reconstruction_3
Segment_Delaunay_graph_2
Segment_Delaunay_graph_Linf_2
Set_movable_separability_2
Skin_surface_3
Snap_rounding_2
Solver_interface

View File

@ -4,22 +4,28 @@ sudo: required
env:
matrix:
PACKAGES_MATRIX
compiler:
- clang-3.6
- gcc
install:
- if [[ "$CXX" = "clang++" ]]; then export CXX=clang++-3.6 CC=clang-3.6; fi
before_script:
- mkdir -p build
- cd build
- cmake -DCGAL_HEADER_ONLY=ON -DWITH_demos:BOOL=TRUE -DWITH_examples:BOOL=true -DWITH_tests:BOOL=TRUE -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG ..
- cmake -DCGAL_HEADER_ONLY=ON -DQt5_DIR="/opt/qt55/lib/cmake/Qt5" -DQt5Svg_DIR="/opt/qt55/lib/cmake/Qt5Svg" -DQt5OpenGL_DIR="/opt/qt55/lib/cmake/Qt5OpenGL" -DWITH_demos:BOOL=TRUE -DWITH_examples:BOOL=true -DWITH_tests:BOOL=TRUE -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG ..
- make
- cd ..
script:
- cd ./.travis
- bash -x -e ./build_package.sh $PACKAGE
compiler:
- clang
- gcc
addons:
apt:
packages:
apt:
sources:
- sourceline: 'ppa:ppsspp/cmake'
- sourceline: 'ppa:hedges/qt5.5'
packages:
- clang-3.6
- zsh
- cmake
- libboost1.55-dev
@ -30,18 +36,20 @@ addons:
- libmpfr-dev
- zlib1g-dev
- libeigen3-dev # too old
- qtbase5-dev
- qtscript5-dev
- libqt5svg5-dev
- qttools5-dev
- qttools5-dev-tools
- libqt5opengl5-dev
- libqt5gui5
- libqt5widgets5
- libqt5xml5
- qt5-qmake
- qt55base
- qt55script
- qt55svg
- qt55tools
- qt55graphicaleffects
- mesa-common-dev
- libglu1-mesa-dev
# Not allowed (yet)
# - geomview
# - libglew1.5-dev
# - libipe-dev
# - libmpfi-dev
notifications:
email:
on_success: change # default: always
on_failure: always # default: always

View File

@ -7,9 +7,16 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0053)
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# Include this package's headers first
include_directories( BEFORE ./ ./include ../../include )

View File

@ -424,7 +424,12 @@ void MainWindow::on_actionCopy_snapshot_triggered()
QClipboard *qb = QApplication::clipboard();
m_pViewer->makeCurrent();
m_pViewer->raise();
#if QGLVIEWER_VERSION >= 0x020700
QImage snapshot = m_pViewer->grabFramebuffer();
#else
QImage snapshot = m_pViewer->grabFrameBuffer(true);
#endif
qb->setImage(snapshot);
QApplication::restoreOverrideCursor();
}

View File

@ -14,7 +14,7 @@
#include <CGAL/Timer.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Subdivision_method_3.h>
#include <CGAL/subdivision_method_3.h>
#include <QOpenGLShader>
#include <QDebug>

View File

@ -16,6 +16,7 @@
#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <QtCore/qglobal.h>
#include <QMap>
#include <QGLViewer/manipulatedFrame.h>
#include <QGLViewer/qglviewer.h>
#include <QOpenGLFunctions_2_1>

View File

@ -1,6 +1,6 @@
#ifndef VIEWER_H
#define VIEWER_H
#include <QMap>
#include <QGLViewer/qglviewer.h>

View File

@ -37,7 +37,7 @@ Each primitive gives access to both one input geometric object
example primitive wraps a 3D triangle as datum and a face handle of a
polyhedral surface as id. Each intersection query can return the
intersection objects (e.g., 3D points or segments for ray queries) as
well the as id (here the face handle) of the intersected
well as the id (here the face handle) of the intersected
primitives. Similarly, each distance query can return the closest
point from the point query as well as the id of the closest primitive.

View File

@ -0,0 +1,93 @@
#include <iostream>
#include <fstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/Timer.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::FT FT;
typedef K::Point_3 Point_3;
typedef CGAL::Bbox_3 Bbox_3;
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
typedef CGAL::Polyhedron_3<K> Polyhedron_3;
typedef CGAL::Timer Timer;
template <typename TriangleMesh>
void triangle_mesh(const char* fname)
{
typedef CGAL::AABB_face_graph_triangle_primitive<TriangleMesh> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
TriangleMesh tmesh;
std::ifstream in(fname);
in >> tmesh;
Timer t;
t.start();
Tree tree(faces(tmesh).first, faces(tmesh).second, tmesh);
tree.build();
std::cout << t.time() << " sec." << std::endl;
std::cout << "Closest point to ORIGIN:" << tree.closest_point(CGAL::ORIGIN) << std::endl;
}
Bbox_3 bbox(boost::graph_traits<Surface_mesh>::face_descriptor fd,
const Surface_mesh& p)
{
boost::graph_traits<Surface_mesh>::halfedge_descriptor hd = halfedge(fd,p);
Bbox_3 res = p.point(source(hd,p)).bbox();
res += p.point(target(hd,p)).bbox();
res += p.point(target(next(hd,p),p)).bbox();
return res;
}
void surface_mesh_cache_bbox(const char* fname)
{
typedef boost::graph_traits<Surface_mesh>::face_descriptor face_descriptor;
typedef Surface_mesh::Property_map<face_descriptor,Bbox_3> Bbox_pmap;
typedef CGAL::AABB_face_graph_triangle_primitive<Surface_mesh> Primitive;
typedef CGAL::AABB_traits<K, Primitive,Bbox_pmap> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
Surface_mesh tmesh;
std::ifstream in(fname);
in >> tmesh;
Timer t;
t.start();
Bbox_pmap bb = tmesh.add_property_map<face_descriptor,Bbox_3>("f:bbox",Bbox_3()).first;
BOOST_FOREACH(face_descriptor fd, faces(tmesh)){
put(bb, fd, bbox(fd,tmesh));
}
Traits traits(bb);
Tree tree(traits);
tree.insert(faces(tmesh).first, faces(tmesh).second, tmesh);
tree.build();
tmesh.remove_property_map(bb);
std::cout << t.time() << " sec."<< std::endl;
std::cout << "Closest point to ORIGIN:" << tree.closest_point(CGAL::ORIGIN) << std::endl;
}
int main(int argc, char* argv[])
{
std::cout << "Polyhedron_3" << std::endl;
triangle_mesh<Polyhedron_3>((argc>1)?argv[1]:"data/tetrahedron.off");
std::cout << "Surface_mesh" << std::endl;
triangle_mesh<Surface_mesh>((argc>1)?argv[1]:"data/tetrahedron.off");
std::cout << "Surface_mesh with cached Bbox_3" << std::endl;
surface_mesh_cache_bbox((argc>1)?argv[1]:"data/tetrahedron.off");
return EXIT_SUCCESS;
}

View File

@ -6,7 +6,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;

View File

@ -6,7 +6,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/AABB_halfedge_graph_segment_primitive.h>
typedef CGAL::Simple_cartesian<double> K;

View File

@ -4,7 +4,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>

View File

@ -6,7 +6,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/AABB_halfedge_graph_segment_primitive.h>
typedef CGAL::Simple_cartesian<double> K;

View File

@ -7,7 +7,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;

View File

@ -7,7 +7,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;

View File

@ -47,10 +47,9 @@ namespace CGAL {
* The default is `typename boost::property_map< FaceGraph,vertex_point_t>::%type`.
*\tparam OneFaceGraphPerTree is either `CGAL::Tag_true` or `CGAL::Tag_false`.
* In the former case, we guarantee that all the primitives will be from a
* common polyhedron and some data will be factorized so that the size of
* common `FaceGraph` and some data will be factorized so that the size of
* the primitive is reduced. In the latter case, the primitives can be from
* different polyhedra and extra storage is required in the primitives. The default is `CGAL::Tag_true`.
* This parameter is useless for the moment and will be useful in an upcoming release of \cgal.
* different graphs and extra storage is required in the primitives. The default is `CGAL::Tag_true`.
*\tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, the datum is stored
* in the primitive, while in the latter it is constructed on the fly to reduce the memory footprint.
* The default is `CGAL::Tag_false` (datum is not stored).

View File

@ -24,8 +24,8 @@
#include <CGAL/license/AABB_tree.h>
#include <CGAL/Bbox_3.h>
#include <CGAL/Default.h>
#include <CGAL/intersections.h>
#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
#include <CGAL/internal/AABB_tree/Is_ray_intersection_geomtraits.h>
@ -188,7 +188,12 @@ struct AABB_traits_base_2<GeomTraits,true>{
/// \tparam Primitive provide the type of primitives stored in the AABB_tree.
/// It is a model of the concept `AABBPrimitive` or `AABBPrimitiveWithSharedData`.
///
/// If the argument GeomTraits is a model of the concept \ref
/// \tparam BboxMap must be a model of `ReadablePropertyMap` that has as key type a primitive id,
/// and as value type a `Bounding_box`.
/// If the type is `Default` the `Datum` must have the
/// member function `bbox()` that returns the bounding box of the primitive.
///
/// If the argument `GeomTraits` is a model of the concept \ref
/// AABBRayIntersectionGeomTraits, this class is also a model of \ref
/// AABBRayIntersectionTraits.
///
@ -196,7 +201,8 @@ struct AABB_traits_base_2<GeomTraits,true>{
/// \sa `AABB_tree`
/// \sa `AABBPrimitive`
/// \sa `AABBPrimitiveWithSharedData`
template<typename GeomTraits, typename AABBPrimitive>
template<typename GeomTraits, typename AABBPrimitive, typename BboxMap = Default>
class AABB_traits:
public internal::AABB_tree::AABB_traits_base<AABBPrimitive>,
public internal::AABB_tree::AABB_traits_base_2<GeomTraits>
@ -205,7 +211,7 @@ class AABB_traits:
public:
typedef GeomTraits Geom_traits;
typedef AABB_traits<GeomTraits, AABBPrimitive> AT;
typedef AABB_traits<GeomTraits, AABBPrimitive, BboxMap> AT;
// AABBTraits concept types
typedef typename GeomTraits::FT FT;
typedef AABBPrimitive Primitive;
@ -254,8 +260,14 @@ public:
typedef typename GeomTraits::Construct_max_vertex_3 Construct_max_vertex_3;
typedef typename GeomTraits::Construct_iso_cuboid_3 Construct_iso_cuboid_3;
BboxMap bbm;
/// Default constructor.
AABB_traits() { };
AABB_traits() { }
AABB_traits(BboxMap bbm)
: bbm(bbm)
{}
typedef typename GeomTraits::Compute_squared_distance_3 Squared_distance;
@ -276,9 +288,9 @@ public:
*/
class Sort_primitives
{
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& m_traits;
public:
Sort_primitives(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
Sort_primitives(const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& traits)
: m_traits(traits) {}
template<typename PrimitiveIterator>
@ -314,31 +326,32 @@ public:
* @return the bounding box of the primitives of the iterator range
*/
class Compute_bbox {
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& m_traits;
public:
Compute_bbox(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
Compute_bbox(const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& traits)
:m_traits (traits) {}
template<typename ConstPrimitiveIterator>
typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond) const
{
typename AT::Bounding_box bbox = compute_bbox(*first,m_traits);
for(++first; first != beyond; ++first)
{
typename AT::Bounding_box bbox = m_traits.compute_bbox(*first,m_traits.bbm);
for(++first; first != beyond; ++first)
{
bbox = bbox + compute_bbox(*first,m_traits);
bbox = bbox + m_traits.compute_bbox(*first,m_traits.bbm);
}
return bbox;
}
return bbox;
}
};
Compute_bbox compute_bbox_object() const {return Compute_bbox(*this);}
class Do_intersect {
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& m_traits;
public:
Do_intersect(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
Do_intersect(const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& traits)
:m_traits(traits) {}
template<typename Query>
@ -357,9 +370,9 @@ public:
Do_intersect do_intersect_object() const {return Do_intersect(*this);}
class Intersection {
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& m_traits;
public:
Intersection(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
Intersection(const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& traits)
:m_traits(traits) {}
#if CGAL_INTERSECTION_VERSION < 2
template<typename Query>
@ -394,9 +407,9 @@ public:
class Closest_point {
typedef typename AT::Point_3 Point;
typedef typename AT::Primitive Primitive;
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& m_traits;
public:
Closest_point(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
Closest_point(const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& traits)
: m_traits(traits) {}
@ -450,12 +463,18 @@ private:
* @param pr the primitive
* @return the bounding box of the primitive \c pr
*/
static Bounding_box compute_bbox (const Primitive& pr,
const AABB_traits<GeomTraits,AABBPrimitive>& traits)
template <typename PM>
Bounding_box compute_bbox(const Primitive& pr, const PM&)const
{
return internal::Primitive_helper<AT>::get_datum(pr,traits).bbox();
return get(bbm, pr.id());
}
Bounding_box compute_bbox(const Primitive& pr, const Default&)const
{
return internal::Primitive_helper<AT>::get_datum(pr,*this).bbox();
}
typedef enum { CGAL_AXIS_X = 0,
CGAL_AXIS_Y = 1,
CGAL_AXIS_Z = 2} Axis;
@ -463,17 +482,17 @@ private:
static Axis longest_axis(const Bounding_box& bbox);
/// Comparison functions
static bool less_x(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
static bool less_x(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& traits)
{
return GeomTraits().less_x_3_object()( internal::Primitive_helper<AT>::get_reference_point(pr1,traits),
internal::Primitive_helper<AT>::get_reference_point(pr2,traits) );
}
static bool less_y(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
static bool less_y(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& traits)
{
return GeomTraits().less_y_3_object()( internal::Primitive_helper<AT>::get_reference_point(pr1,traits),
internal::Primitive_helper<AT>::get_reference_point(pr2,traits) );
}
static bool less_z(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
static bool less_z(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive, BboxMap>& traits)
{
return GeomTraits().less_z_3_object()( internal::Primitive_helper<AT>::get_reference_point(pr1,traits),
internal::Primitive_helper<AT>::get_reference_point(pr2,traits) );
@ -485,9 +504,9 @@ private:
//-------------------------------------------------------
// Private methods
//-------------------------------------------------------
template<typename GT, typename P>
typename AABB_traits<GT,P>::Axis
AABB_traits<GT,P>::longest_axis(const Bounding_box& bbox)
template<typename GT, typename P, typename B>
typename AABB_traits<GT,P,B>::Axis
AABB_traits<GT,P,B>::longest_axis(const Bounding_box& bbox)
{
const double dx = bbox.xmax() - bbox.xmin();
const double dy = bbox.ymax() - bbox.ymin();

View File

@ -1130,7 +1130,7 @@ public:
this->traversal(query, traversal_traits);
return traversal_traits.is_intersection_found();
}
#ifndef DOXYGEN_RUNNING //To avoid doxygen to consider definition and declaration as 2 different functions (size_type causes problems)
template<typename Tr>
template<typename Query>
typename AABB_tree<Tr>::size_type
@ -1149,7 +1149,7 @@ public:
this->traversal(query, traversal_traits);
return counter;
}
#endif
template<typename Tr>
template<typename Query, typename OutputIterator>
OutputIterator

View File

@ -70,9 +70,9 @@ namespace CGAL {
m_facet = primitive.id();
}
AABB_triangulation_3_triangle_primitive(const Id& handle)
: m_facet(handle) { };
: m_facet(handle) { }
AABB_triangulation_3_triangle_primitive(const Id* ptr)
: m_facet(*ptr) { };
: m_facet(*ptr) { }
template <class Iterator>
AABB_triangulation_3_triangle_primitive( Iterator it,
typename boost::enable_if<
@ -86,18 +86,23 @@ namespace CGAL {
// Returns by constructing on the fly the geometric datum wrapped by the primitive
Datum datum() const
{
typename GeomTraits::Construct_point_3 cp =
GeomTraits().construct_point_3_object();
int i = m_facet.second;
const Point& a = m_facet.first->vertex((i+1) &3)->point();
const Point& b = m_facet.first->vertex((i+2) &3)->point();
const Point& c = m_facet.first->vertex((i+3) &3)->point();
const Point& a = cp(m_facet.first->vertex((i+1) &3)->point());
const Point& b = cp(m_facet.first->vertex((i+2) &3)->point());
const Point& c = cp(m_facet.first->vertex((i+3) &3)->point());
return Datum(a,b,c);
}
// Returns a point on the primitive
Point reference_point() const
{
return m_facet.first->vertex((m_facet.second +1) &3)->point();
typename GeomTraits::Construct_point_3 cp =
GeomTraits().construct_point_3_object();
return cp(m_facet.first->vertex((m_facet.second +1) &3)->point());
}
// Returns the identifier

View File

@ -21,13 +21,13 @@ typedef CGAL::First_of_pair_property_map<Point_with_normal> Point_map;
typedef CGAL::Second_of_pair_property_map<Point_with_normal> Normal_map;
// Efficient RANSAC types
typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits
typedef CGAL::Shape_detection_3::Shape_detection_traits
<Kernel, Pwn_vector, Point_map, Normal_map> Traits;
typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Efficient_ransac;
typedef CGAL::Shape_detection_3::Plane<Traits> Plane;
// Point set structuring type
typedef CGAL::Point_set_with_structure<Traits> Structure;
typedef CGAL::Point_set_with_structure<Kernel> Structure;
// Advancing front types
typedef CGAL::Advancing_front_surface_reconstruction_vertex_base_3<Kernel> LVb;
@ -140,10 +140,15 @@ int main (int argc, char* argv[])
ransac.detect(op); // Plane detection
Efficient_ransac::Plane_range planes = ransac.planes();
std::cerr << "done\nPoint set structuring... ";
Pwn_vector structured_pts;
Structure pss (points.begin (), points.end (), ransac,
Structure pss (points, Point_map(), Normal_map(),
planes,
CGAL::Shape_detection_3::Plane_map<Traits>(),
CGAL::Shape_detection_3::Point_to_shape_index_map<Traits>(points, planes),
op.cluster_epsilon); // Same parameter as RANSAC
for (std::size_t i = 0; i < pss.size(); ++ i)

View File

@ -2311,7 +2311,7 @@ namespace CGAL {
}
struct Remove : public std::unary_function<Vertex_handle, bool>
struct Remove : public CGAL::unary_function<Vertex_handle, bool>
{
Extract& E;
@ -2449,7 +2449,7 @@ namespace CGAL {
namespace AFSR {
template <typename T>
struct Auto_count : public std::unary_function<const T&,std::pair<T,std::size_t> >{
struct Auto_count : public CGAL::unary_function<const T&,std::pair<T,std::size_t> >{
mutable std::size_t i;
Auto_count()
@ -2462,7 +2462,7 @@ namespace CGAL {
};
template <typename T, typename CC>
struct Auto_count_cc : public std::unary_function<const T&,std::pair<T,std::size_t> >{
struct Auto_count_cc : public CGAL::unary_function<const T&,std::pair<T,std::size_t> >{
mutable std::size_t i;
CC cc;

View File

@ -29,7 +29,6 @@
#define CGAL_ALGEBRAIC_NUMBER_TRAITS_H 1
#include <numeric> // for std::accumulate
#include <functional> // for std::unary_function
#include <CGAL/tags.h>
#include <CGAL/Algebraic_structure_traits.h>
@ -47,7 +46,7 @@ public:
//! computes the factor which normalizes a number to be integral after
// multiplication
class Normalization_factor
: public std::unary_function<Type,Type> {
: public CGAL::unary_function<Type,Type> {
private:
static Type
normalization_factor(const Type&,Integral_domain_without_division_tag){
@ -68,7 +67,7 @@ public:
};
class Denominator_for_algebraic_integers
: public std::unary_function<Type,Type> {
: public CGAL::unary_function<Type,Type> {
public:
//! determine normalization factor
Type operator () (const Type&) {

View File

@ -111,7 +111,7 @@ class Algebraic_structure_traits_base< Type_, Null_tag > {
// does nothing by default
class Simplify
: public std::unary_function< Type&, void > {
: public CGAL::unary_function< Type&, void > {
public:
void operator()( Type& ) const {}
};
@ -150,7 +150,7 @@ class Algebraic_structure_traits_base< Type_,
// returns Type(1) by default
class Unit_part
: public std::unary_function< Type, Type > {
: public CGAL::unary_function< Type, Type > {
public:
Type operator()( const Type& x ) const {
return( x < Type(0)) ?
@ -159,7 +159,7 @@ class Algebraic_structure_traits_base< Type_,
};
class Square
: public std::unary_function< Type, Type > {
: public CGAL::unary_function< Type, Type > {
public:
Type operator()( const Type& x ) const {
return x*x;
@ -167,7 +167,7 @@ class Algebraic_structure_traits_base< Type_,
};
class Is_zero
: public std::unary_function< Type, bool > {
: public CGAL::unary_function< Type, bool > {
public:
bool operator()( const Type& x ) const {
return x == Type(0);
@ -175,7 +175,7 @@ class Algebraic_structure_traits_base< Type_,
};
class Is_one
: public std::unary_function< Type, bool > {
: public CGAL::unary_function< Type, bool > {
public:
bool operator()( const Type& x ) const {
return x == Type(1);
@ -220,7 +220,7 @@ class Algebraic_structure_traits_base< Type_,
// Default implementation of Divides functor for unique factorization domains
// x divides y if gcd(y,x) equals x up to inverses
class Divides
: public std::binary_function<Type,Type,bool>{
: public CGAL::binary_function<Type,Type,bool>{
public:
bool operator()( const Type& x, const Type& y) const {
typedef CGAL::Algebraic_structure_traits<Type> AST;
@ -256,7 +256,7 @@ class Algebraic_structure_traits_base< Type_,
// maps to \c Div by default.
class Integral_division
: public std::binary_function< Type, Type,
: public CGAL::binary_function< Type, Type,
Type > {
public:
Type operator()(
@ -278,7 +278,7 @@ class Algebraic_structure_traits_base< Type_,
// Algorithm from NiX/euclids_algorithm.h
class Gcd
: public std::binary_function< Type, Type,
: public CGAL::binary_function< Type, Type,
Type > {
public:
Type operator()(
@ -371,7 +371,7 @@ class Algebraic_structure_traits_base< Type_,
// based on \c Div_mod.
class Div
: public std::binary_function< Type, Type,
: public CGAL::binary_function< Type, Type,
Type > {
public:
Type operator()( const Type& x,
@ -389,7 +389,7 @@ class Algebraic_structure_traits_base< Type_,
// based on \c Div_mod.
class Mod
: public std::binary_function< Type, Type,
: public CGAL::binary_function< Type, Type,
Type > {
public:
Type operator()( const Type& x,
@ -407,7 +407,7 @@ class Algebraic_structure_traits_base< Type_,
// Divides for Euclidean Ring
class Divides
: public std::binary_function<Type, Type, bool>{
: public CGAL::binary_function<Type, Type, bool>{
public:
bool operator()( const Type& x, const Type& y) const {
typedef Algebraic_structure_traits<Type> AST;
@ -447,7 +447,7 @@ class Algebraic_structure_traits_base< Type_, Field_tag >
// returns the argument \a a by default
class Unit_part
: public std::unary_function< Type, Type > {
: public CGAL::unary_function< Type, Type > {
public:
Type operator()( const Type& x ) const {
return( x == Type(0)) ? Type(1) : x;
@ -455,7 +455,7 @@ class Algebraic_structure_traits_base< Type_, Field_tag >
};
// maps to \c operator/ by default.
class Integral_division
: public std::binary_function< Type, Type,
: public CGAL::binary_function< Type, Type,
Type > {
public:
Type operator()( const Type& x,
@ -474,7 +474,7 @@ class Algebraic_structure_traits_base< Type_, Field_tag >
// maps to \c 1/x by default.
class Inverse
: public std::unary_function< Type, Type > {
: public CGAL::unary_function< Type, Type > {
public:
Type operator()( const Type& x ) const {
return Type(1)/x;
@ -486,7 +486,7 @@ class Algebraic_structure_traits_base< Type_, Field_tag >
// returns always true
// \pre: x != 0
class Divides
: public std::binary_function< Type, Type, bool > {
: public CGAL::binary_function< Type, Type, bool > {
public:
bool operator()( const Type& CGAL_precondition_code(x), const Type& /* y */) const {
CGAL_precondition_code( typedef Algebraic_structure_traits<Type> AST);
@ -522,7 +522,7 @@ class Algebraic_structure_traits_base< Type_,
typedef Field_with_sqrt_tag Algebraic_category;
struct Is_square
:public std::binary_function<Type,Type&,bool>
:public CGAL::binary_function<Type,Type&,bool>
{
bool operator()(const Type& ) const {return true;}
bool operator()(
@ -579,7 +579,7 @@ class Algebraic_structure_traits_base< Type_,
namespace INTERN_AST {
template< class Type >
class Div_per_operator
: public std::binary_function< Type, Type,
: public CGAL::binary_function< Type, Type,
Type > {
public:
Type operator()( const Type& x,
@ -592,7 +592,7 @@ namespace INTERN_AST {
template< class Type >
class Mod_per_operator
: public std::binary_function< Type, Type,
: public CGAL::binary_function< Type, Type,
Type > {
public:
Type operator()( const Type& x,
@ -605,7 +605,7 @@ namespace INTERN_AST {
template< class Type >
class Is_square_per_sqrt
: public std::binary_function< Type, Type&,
: public CGAL::binary_function< Type, Type&,
bool > {
public:
bool operator()( const Type& x,

View File

@ -36,7 +36,7 @@ struct Is_zero_selector{ typedef AST_is_zero Type; };
template< class T >
struct Is_zero_selector< T, Null_functor >
{
struct Type : public std::unary_function< T, bool >{
struct Type : public CGAL::unary_function< T, bool >{
bool operator()( const T& x ) const {
return x == T(0);
}
@ -80,7 +80,7 @@ public:
Is_zero;
//! The generic \c Is_finite functor returns true
class Is_finite : public std::unary_function< Type, Boolean > {
class Is_finite : public CGAL::unary_function< Type, Boolean > {
public:
Boolean operator()( const Type& ) const {
return true;
@ -90,7 +90,7 @@ public:
//! The generic \c Abs functor implementation
//! uses one comparisons and the unary minus if necessary.
class Abs
: public std::unary_function< Type, Type > {
: public CGAL::unary_function< Type, Type > {
public:
//! the function call.
Type operator()( const Type& x ) const {
@ -100,7 +100,7 @@ public:
//! The generic \c Sgn functor implementation uses two comparisons.
class Sgn
: public std::unary_function< Type, ::CGAL::Sign > {
: public CGAL::unary_function< Type, ::CGAL::Sign > {
public:
//! the function call.
::CGAL::Sign operator()( const Type& x ) const {
@ -114,7 +114,7 @@ public:
//! The generic \c Is_positive functor implementation uses one comparison.
class Is_positive
: public std::unary_function< Type, Boolean > {
: public CGAL::unary_function< Type, Boolean > {
public:
//! the function call.
Boolean operator()( const Type& x ) const {
@ -124,7 +124,7 @@ public:
//! The generic \c Is_negative functor implementation uses one comparison.
class Is_negative
: public std::unary_function< Type, Boolean > {
: public CGAL::unary_function< Type, Boolean > {
public:
//! the function call.
Boolean operator()( const Type& x ) const {
@ -134,7 +134,7 @@ public:
//! The generic \c Compare functor implementation uses two comparisons.
class Compare
: public std::binary_function< Type, Type,
: public CGAL::binary_function< Type, Type,
Comparison_result > {
public:
//! the function call.
@ -151,7 +151,7 @@ public:
Comparison_result )
};
class To_double : public std::unary_function< Type, double > {
class To_double : public CGAL::unary_function< Type, double > {
public:
double operator()( const Type& x ) const {
return static_cast<double>(x);
@ -159,7 +159,7 @@ public:
};
class To_interval
: public std::unary_function< Type, std::pair<double,double> > {
: public CGAL::unary_function< Type, std::pair<double,double> > {
public:
std::pair<double,double> operator()( const Type& x ) const {
double dx(static_cast<double>(x));

View File

@ -101,7 +101,7 @@ struct Is_zero :
namespace internal {
template <class NT, class Compare> struct Compare_base: public Compare {};
template <class NT> struct Compare_base<NT,Null_functor>
:public std::binary_function< NT, NT, Comparison_result > {
:public CGAL::binary_function< NT, NT, Comparison_result > {
Comparison_result operator()( const NT& x, const NT& y) const
{
if (x < y) return SMALLER;

View File

@ -193,7 +193,7 @@ protected:
//! polynomial canonicalizer, needed for the cache
template <class Poly>
struct Poly_canonicalizer : public std::unary_function< Poly, Poly >
struct Poly_canonicalizer : public CGAL::unary_function< Poly, Poly >
{
// use Polynomial_traits_d<>::Canonicalize ?
Poly operator()(Poly p)
@ -349,7 +349,7 @@ public:
// Composition of two unary functors
template<typename InnerFunctor,typename OuterFunctor>
class Unary_compose
: public std::unary_function<typename InnerFunctor::argument_type,
: public CGAL::unary_function<typename InnerFunctor::argument_type,
typename OuterFunctor::result_type> {
public:
@ -412,7 +412,7 @@ public:
* when appropriate
*/
class Construct_curve_2 :
public std::unary_function< Polynomial_2, Curve_analysis_2 > {
public CGAL::unary_function< Polynomial_2, Curve_analysis_2 > {
public:
@ -436,7 +436,7 @@ public:
* caching is used when appropriate
*/
class Construct_curve_pair_2 :
public std::binary_function<Curve_analysis_2, Curve_analysis_2,
public CGAL::binary_function<Curve_analysis_2, Curve_analysis_2,
Curve_pair_analysis_2> {
public:
@ -629,7 +629,7 @@ public:
class Compute_polynomial_x_2 :
public std::unary_function<Algebraic_real_2, Polynomial_1> {
public CGAL::unary_function<Algebraic_real_2, Polynomial_1> {
public:
@ -649,7 +649,7 @@ public:
compute_polynomial_x_2_object);
class Compute_polynomial_y_2 :
public std::unary_function<Algebraic_real_2, Polynomial_1> {
public CGAL::unary_function<Algebraic_real_2, Polynomial_1> {
public:
@ -669,7 +669,7 @@ public:
compute_polynomial_y_2_object);
class Isolate_x_2 : public std::binary_function<Algebraic_real_2,
class Isolate_x_2 : public CGAL::binary_function<Algebraic_real_2,
Polynomial_1,
std::pair<Bound,Bound> > {
@ -692,7 +692,7 @@ public:
CGAL_Algebraic_Kernel_cons(Isolate_x_2,
isolate_x_2_object);
class Isolate_y_2 : public std::binary_function<Algebraic_real_2,
class Isolate_y_2 : public CGAL::binary_function<Algebraic_real_2,
Polynomial_1,
std::pair<Bound,Bound> > {
@ -880,7 +880,7 @@ public:
//! returns the x-coordinate of an \c Algebraic_real_2 object
class Compute_x_2 :
public std::unary_function<Algebraic_real_2, Algebraic_real_1> {
public CGAL::unary_function<Algebraic_real_2, Algebraic_real_1> {
public:
@ -915,7 +915,7 @@ public:
* return approximation of the y-coordinate.
*/
class Compute_y_2 :
public std::unary_function<Algebraic_real_2, Algebraic_real_1> {
public CGAL::unary_function<Algebraic_real_2, Algebraic_real_1> {
public:
@ -938,7 +938,7 @@ public:
#endif
class Approximate_absolute_x_2
: public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
: public CGAL::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
public:
@ -961,7 +961,7 @@ public:
approximate_absolute_x_2_object);
class Approximate_relative_x_2
: public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
: public CGAL::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
public:
@ -983,7 +983,7 @@ public:
approximate_relative_x_2_object);
class Approximate_absolute_y_2
: public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
: public CGAL::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
public:
@ -1013,7 +1013,7 @@ public:
approximate_absolute_y_2_object);
class Approximate_relative_y_2
: public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
: public CGAL::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
public:
@ -1164,8 +1164,8 @@ public:
//! \brief comparison of x-coordinates
class Compare_x_2 :
public std::binary_function<Algebraic_real_2, Algebraic_real_2,
Comparison_result > {
public CGAL::binary_function<Algebraic_real_2, Algebraic_real_2,
Comparison_result > {
public:
@ -1257,7 +1257,7 @@ public:
* If possible, it is recommended to avoid this functor for efficiency.}
*/
class Compare_y_2 :
public std::binary_function< Algebraic_real_2, Algebraic_real_2,
public CGAL::binary_function< Algebraic_real_2, Algebraic_real_2,
Comparison_result > {
public:
@ -1369,7 +1369,7 @@ public:
* to have equal x-coordinates, thus only the y-coordinates are compared.
*/
class Compare_xy_2 :
public std::binary_function<Algebraic_real_2, Algebraic_real_2,
public CGAL::binary_function<Algebraic_real_2, Algebraic_real_2,
Comparison_result > {
public:
@ -1500,7 +1500,7 @@ public:
* the polynomial \c p is square free.
*/
class Has_finite_number_of_self_intersections_2 :
public std::unary_function< Polynomial_2, bool > {
public CGAL::unary_function< Polynomial_2, bool > {
public:
@ -1529,7 +1529,7 @@ public:
* the two polynomials \c f and \c g are coprime.
*/
class Has_finite_number_of_intersections_2 :
public std::binary_function< Polynomial_2, Polynomial_2, bool > {
public CGAL::binary_function< Polynomial_2, Polynomial_2, bool > {
public:
@ -1713,7 +1713,7 @@ public:
//! Non-Algebraic name
typedef Algebraic_real_2 Coordinate_2;
class Is_square_free_2 : public std::unary_function<Polynomial_2,bool> {
class Is_square_free_2 : public CGAL::unary_function<Polynomial_2,bool> {
public:
@ -1735,7 +1735,7 @@ public:
typedef Has_finite_number_of_intersections_2 Is_coprime_2;
CGAL_Algebraic_Kernel_cons(Is_coprime_2, is_coprime_2_object);
class Make_square_free_2 : public std::unary_function<Polynomial_2,
class Make_square_free_2 : public CGAL::unary_function<Polynomial_2,
Polynomial_2> {
public:
@ -1800,7 +1800,7 @@ public:
* In pariticular, each singular point is x-critical.
*/
class X_critical_points_2 :
public std::binary_function< Curve_analysis_2,
public CGAL::binary_function< Curve_analysis_2,
std::iterator<std::output_iterator_tag, Algebraic_real_2>,
std::iterator<std::output_iterator_tag, Algebraic_real_2> > {
@ -1879,7 +1879,7 @@ public:
* In pariticular, each singular point is y-critical.
*/
class Y_critical_points_2 :
public std::binary_function< Curve_analysis_2,
public CGAL::binary_function< Curve_analysis_2,
std::iterator<std::output_iterator_tag, Algebraic_real_2>,
std::iterator<std::output_iterator_tag, Algebraic_real_2> > {
@ -1974,7 +1974,7 @@ public:
// Overload the Sign_at_1 functor, to enable filter steps in the
// Curve analysis in a coherent way
class Sign_at_1
: public::std::binary_function<Polynomial_1,Algebraic_real_1,Sign> {
: public::CGAL::binary_function<Polynomial_1,Algebraic_real_1,Sign> {
public:
@ -2009,7 +2009,7 @@ public:
std::make_pair(x_pair.first,
x_pair.second));
CGAL::Sign s_lower = CGAL::sign(iv.first);
if(s_lower == sign(iv.second)) {
if(s_lower == CGAL::sign(iv.second)) {
return s_lower;
} else {
prec*=2;
@ -2051,7 +2051,7 @@ public:
* curve. Returns a value convertible to \c CGAL::Sign
*/
class Sign_at_2 :
public std::binary_function<Polynomial_2, Algebraic_real_2, Sign > {
public CGAL::binary_function<Polynomial_2, Algebraic_real_2, Sign > {
public:
@ -2111,7 +2111,7 @@ public:
y_pair.first,
y_pair.second));
CGAL::Sign s_lower = CGAL::sign(iv.first);
if(s_lower == sign(iv.second)) {
if(s_lower == CGAL::sign(iv.second)) {
return s_lower;
} else {
prec*=2;
@ -2147,7 +2147,7 @@ public:
CGAL_Algebraic_Kernel_pred(Sign_at_2, sign_at_2_object);
class Is_zero_at_2
: public std::binary_function<Polynomial_2,Algebraic_real_2,bool> {
: public CGAL::binary_function<Polynomial_2,Algebraic_real_2,bool> {
public:
@ -2491,7 +2491,7 @@ public:
CGAL_Algebraic_Kernel_cons(Solve_2, solve_2_object);
class Number_of_solutions_2
: public std::binary_function<Polynomial_2,Polynomial_2,size_type> {
: public CGAL::binary_function<Polynomial_2,Polynomial_2,size_type> {
public:
@ -2517,7 +2517,7 @@ public:
// Functor used to evaluate a Polynomial_2 in a Bound, up to a
// constant factor
class Evaluate_utcf_2
: public std::binary_function<Polynomial_2,Bound,Polynomial_1> {
: public CGAL::binary_function<Polynomial_2,Bound,Polynomial_1> {
public:
@ -2593,7 +2593,7 @@ public:
//! Refines the x-coordinate of an Algebraic_real_2 object
class Refine_x_2 :
public std::unary_function<Algebraic_real_2, void> {
public CGAL::unary_function<Algebraic_real_2, void> {
public:
@ -2617,7 +2617,7 @@ public:
CGAL_Algebraic_Kernel_pred(Refine_x_2, refine_x_2_object);
class Refine_y_2 :
public std::unary_function<Algebraic_real_2, void> {
public CGAL::unary_function<Algebraic_real_2, void> {
public:

View File

@ -384,7 +384,7 @@ public:
typedef internal::Algebraic_real_d_1< Coefficient, Rational, HandlePolicy, RepClass > Type;
class Compare
: public std::binary_function< Type, Type, CGAL::Comparison_result > {
: public CGAL::binary_function< Type, Type, CGAL::Comparison_result > {
public:
CGAL::Comparison_result operator()( const Type& a, const Type& b ) const
{ return a.compare( b ); }
@ -413,7 +413,7 @@ public:
};
class Sgn
: public std::unary_function< Type, CGAL::Sign > {
: public CGAL::unary_function< Type, CGAL::Sign > {
public:
CGAL::Sign operator()( const Type& a ) const {
return a.compare( Rational(0) );
@ -421,7 +421,7 @@ public:
};
class To_double
: public std::unary_function< Type, double > {
: public CGAL::unary_function< Type, double > {
public:
double operator()(const Type& a) const {
return a.to_double();
@ -429,7 +429,7 @@ public:
};
class To_interval
: public std::unary_function< Type, std::pair<double, double> > {
: public CGAL::unary_function< Type, std::pair<double, double> > {
public:
typename std::pair<double, double> operator()(const Type& a) const {
return a.to_interval();

View File

@ -49,7 +49,7 @@ template <typename Coefficient_> struct Bitstream_coefficient_kernel {
return Is_zero();
}
struct Convert_to_bfi : public std::unary_function
struct Convert_to_bfi : public CGAL::unary_function
<Coefficient,Bigfloat_interval> {
Bigfloat_interval operator() (Coefficient c) const {

View File

@ -117,7 +117,7 @@ public:
//! \name Functors
//! @{
struct Is_zero : public std::unary_function<Coefficient,bool> {
struct Is_zero : public CGAL::unary_function<Coefficient,bool> {
Is_zero(Algebraic_kernel_d_1* kernel,Algebraic_real_1 alpha)
: _m_kernel(kernel),_m_alpha(alpha) {}
@ -137,7 +137,7 @@ public:
}
struct Convert_to_bfi
: public std::unary_function<Coefficient,Bigfloat_interval> {
: public CGAL::unary_function<Coefficient,Bigfloat_interval> {
Convert_to_bfi(Algebraic_kernel_d_1* kernel,
Algebraic_real_1 alpha)

View File

@ -111,7 +111,7 @@ template<typename Comparable>
};
template<typename Comparable> struct Compare_for_vert_line_map
: public std::binary_function<Comparable,Comparable,bool> {
: public CGAL::binary_function<Comparable,Comparable,bool> {
BOOST_MPL_HAS_XXX_TRAIT_DEF(T)
BOOST_MPL_HAS_XXX_TRAIT_DEF(Handle_policy)
@ -502,7 +502,6 @@ public:
const Polynomial_2& f,
CGAL::Degeneracy_strategy strategy
= CGAL_ACK_DEFAULT_DEGENERACY_STRATEGY)
throw(internal::Zero_resultant_exception<Polynomial_2>)
: Base(Rep(kernel,f,strategy))
{
@ -812,7 +811,7 @@ private:
// Creates a status line for the curve's <tt>index</tt>th critical point
Status_line_1 create_status_line_at_event(size_type index) const
throw(CGAL::internal::Non_generic_position_exception) {
{
Event_coordinate_1& event = event_coordinates()[index];
@ -1446,7 +1445,7 @@ private:
//! Returns the Sturm-Habicht sequence of the primitive part of f
std::vector<Polynomial_2>& sturm_habicht_of_primitive() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
if(! this->ptr()->sturm_habicht_of_primitive) {
compute_sturm_habicht_of_primitive();
}
@ -1460,7 +1459,7 @@ public:
* of the primitive part of the defining polynomial
*/
Polynomial_2 sturm_habicht_of_primitive(size_type i) const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
CGAL_assertion(i>=0 &&
i < static_cast<size_type>
(sturm_habicht_of_primitive().size()));
@ -1474,7 +1473,7 @@ public:
* of the primitive part of the defining polynomial
*/
Polynomial_1 principal_sturm_habicht_of_primitive(size_type i) const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
CGAL_assertion(i>=0 &&
i < static_cast<size_type>
(sturm_habicht_of_primitive().size()));
@ -1496,7 +1495,7 @@ public:
* of <tt>y^{i-1}</tt> of the <tt>i</tt>th Sturm-Habicht polynomial
*/
Polynomial_1 coprincipal_sturm_habicht_of_primitive(size_type i) const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
CGAL_assertion(i>=1 &&
i < static_cast<size_type>
(sturm_habicht_of_primitive().size()));
@ -1531,7 +1530,7 @@ private:
// Internal method to compute the Sturm-Habicht sequence
void compute_sturm_habicht_of_primitive() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
#if CGAL_ACK_DEBUG_FLAG
CGAL_ACK_DEBUG_PRINT << "Compute Sturm-Habicht.." << std::flush;
@ -1591,7 +1590,7 @@ private:
//! Returns the resultant of the primitive part of f and its y-derivative
Polynomial_1 resultant_of_primitive_and_derivative_y() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
if(! this->ptr()->resultant_of_primitive_and_derivative_y) {
compute_resultant_of_primitive_and_derivative_y();
}
@ -1602,7 +1601,7 @@ private:
//! Returns the resultant of the primitive part of f with its x-derivative
Polynomial_1 resultant_of_primitive_and_derivative_x() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
if(! this->ptr()->resultant_of_primitive_and_derivative_x) {
compute_resultant_of_primitive_and_derivative_x();
}
@ -1612,8 +1611,8 @@ private:
private:
// Computes <tt>res_y(f,f_y)</tt>, where \c f is the defining polynomial
void compute_resultant_of_primitive_and_derivative_y() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
#if CGAL_ACK_DEBUG_FLAG
CGAL_ACK_DEBUG_PRINT << "Compute resultant.." << std::flush;
#endif
@ -1664,7 +1663,7 @@ private:
// Computes <tt>res_y(f,f_x)</tt>, where \c f is the defining polynomial
void compute_resultant_of_primitive_and_derivative_x() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
#if CGAL_ACK_DEBUG_FLAG
CGAL_ACK_DEBUG_PRINT << "Compute x-resultant.." << std::flush;
@ -1723,7 +1722,7 @@ private:
// Returns the critical event coordinates
std::vector<Event_coordinate_1>& event_coordinates() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
if(! this->ptr()->event_coordinates) {
compute_event_coordinates();
}
@ -1734,8 +1733,7 @@ private:
// Returns the intermediate values for intervals between events
std::vector<boost::optional<Bound> >& intermediate_values() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
if(! this->ptr()->intermediate_values) {
// This is created during event_coordiantes()
event_coordinates();
@ -1755,7 +1753,7 @@ private:
* x-coordinates of the curve.
*/
void compute_event_coordinates() const
throw(internal::Zero_resultant_exception<Polynomial_2>) {
{
#if CGAL_ACK_DEBUG_FLAG
CGAL_ACK_DEBUG_PRINT << "compute events..." << std::flush;
@ -1953,7 +1951,6 @@ public:
* of the Algebraic_curve_kernel_2 yet.
*/
Self& shear_primitive_part(Integer s) const
throw(CGAL::internal::Non_generic_position_exception)
{
CGAL_assertion(s!=0);
#if CGAL_ACK_USE_SPECIAL_TREATMENT_FOR_CONIX

View File

@ -480,8 +480,6 @@ public:
Curve_analysis_2 c2,
CGAL::Degeneracy_strategy strategy
= CGAL_ACK_DEFAULT_DEGENERACY_STRATEGY)
throw(CGAL::internal::Zero_resultant_exception<Polynomial_2>,
CGAL::internal::Non_generic_position_exception)
: Base(Rep(kernel,c1, c2, strategy))
{
@ -847,13 +845,11 @@ private:
private:
// Computes a slice_info object at Algebraic_real_1 \c alpha
Slice_info construct_slice_info(Algebraic_real_1 alpha) const
throw(CGAL::internal::Non_generic_position_exception);
Slice_info construct_slice_info(Algebraic_real_1 alpha) const;
private:
Status_line_CPA_1 construct_generic_case(size_type i) const
throw(CGAL::internal::Non_generic_position_exception);
Status_line_CPA_1 construct_generic_case(size_type i) const;
private:
@ -1170,8 +1166,7 @@ private:
Status_line_CPA_1
create_event_slice_from_current_intersection_info (size_type i)
const throw(CGAL::internal::Non_generic_position_exception);
create_event_slice_from_current_intersection_info (size_type i) const;
Bound x_sheared(Bound x, Bound y,Integer sh) const {
return x-sh*y;
@ -1992,8 +1987,7 @@ create_slice_from_slice_info(size_type id,
template<typename AlgebraicKernelWithAnalysis_2>
typename Curve_pair_analysis_2<AlgebraicKernelWithAnalysis_2>::Slice_info
Curve_pair_analysis_2<AlgebraicKernelWithAnalysis_2>::
construct_slice_info(Algebraic_real_1 alpha) const
throw(CGAL::internal::Non_generic_position_exception) {
construct_slice_info(Algebraic_real_1 alpha) const {
/*
#if CGAL_ACK_DEBUG_FLAG
@ -2074,8 +2068,7 @@ template<typename AlgebraicKernelWithAnalysis_2>
typename Curve_pair_analysis_2<AlgebraicKernelWithAnalysis_2>
::Status_line_CPA_1
Curve_pair_analysis_2<AlgebraicKernelWithAnalysis_2>::
construct_generic_case(size_type i) const
throw(CGAL::internal::Non_generic_position_exception) {
construct_generic_case(size_type i) const {
Algebraic_real_1 alpha = event_x(i);
@ -2414,8 +2407,7 @@ template<typename AlgebraicKernelWithAnalysis_2>
typename Curve_pair_analysis_2<AlgebraicKernelWithAnalysis_2>
::Status_line_CPA_1
Curve_pair_analysis_2<AlgebraicKernelWithAnalysis_2>::
create_event_slice_from_current_intersection_info (size_type i)
const throw(CGAL::internal::Non_generic_position_exception){
create_event_slice_from_current_intersection_info (size_type i) const{
#if CGAL_ACK_DEBUG_FLAG
CGAL_ACK_DEBUG_PRINT << "Reduce the candidates.." << std::flush;
#endif

View File

@ -117,7 +117,6 @@ public:
Event_line_builder(Algebraic_kernel_with_analysis_2* kernel,
Curve_analysis_2 curve,
Polynomial_2 polynomial)
throw(internal::Zero_resultant_exception<Polynomial_2>)
: _m_kernel(kernel), curve(curve), polynomial(polynomial)
{}
@ -151,7 +150,7 @@ public:
Status_line_1
create_event_line(int id,Algebraic_real_1 alpha,int arcs_left,int arcs_right,
bool root_of_resultant, bool root_of_content,int mult)
throw(CGAL::internal::Non_generic_position_exception) {
{
try {
@ -531,7 +530,7 @@ protected:
int mult,
int arcs_left,
int arcs_right)
throw(CGAL::internal::Non_generic_position_exception) {
{
Bitstream_traits traits(Bitstream_coefficient_kernel(kernel(),alpha));
@ -613,7 +612,7 @@ protected:
int k,
const Polynomial_2& der_1,
const Polynomial_2& der_2)
throw(CGAL::internal::Non_generic_position_exception) {
{
//Guess the right expression for y
/*

View File

@ -65,7 +65,7 @@ template<>
class Float_traits< leda_bigfloat > {
public:
struct Get_mantissa
: public std::unary_function< leda_bigfloat, leda_integer > {
: public CGAL::unary_function< leda_bigfloat, leda_integer > {
leda_integer operator()( const leda_bigfloat& x ) const {
//std::cout << x.get_significant() << std::endl;
return x.get_significant();
@ -73,14 +73,14 @@ public:
};
struct Get_exponent
: public std::unary_function< leda_bigfloat, long > {
: public CGAL::unary_function< leda_bigfloat, long > {
long operator()( const leda_bigfloat& x ) const {
return x.get_exponent().to_long();
}
};
struct Mul_by_pow_of_2
: public std::binary_function< leda_bigfloat, long, leda_bigfloat> {
: public CGAL::binary_function< leda_bigfloat, long, leda_bigfloat> {
leda_bigfloat operator()( const leda_bigfloat& a, long e ) const {
return leda_bigfloat(a.get_significant(), a.get_exponent()+e);
}
@ -97,21 +97,21 @@ class Float_traits< CORE::BigFloat > {
public:
struct Get_mantissa
: public std::unary_function< CORE::BigFloat, CORE::BigInt > {
: public CGAL::unary_function< CORE::BigFloat, CORE::BigInt > {
CORE::BigInt operator()( const CORE::BigFloat& x ) const {
return x.m();
}
};
struct Get_exponent
: public std::unary_function< CORE::BigFloat, long > {
: public CGAL::unary_function< CORE::BigFloat, long > {
long operator()( const CORE::BigFloat& x ) const {
return CORE::CHUNK_BIT*x.exp(); // The basis is 2^CORE::CHUNK_BIT
}
};
struct Mul_by_pow_of_2
: public std::binary_function
: public CGAL::binary_function
< CORE::BigFloat, long , CORE::BigFloat> {
CORE::BigFloat operator()( const CORE::BigFloat& a, long e ) const {
return a*CORE::BigFloat::exp2(e);
@ -126,7 +126,7 @@ public:
template<> class Float_traits< Gmpfr > {
struct Get_mantissa_exponent
: public std::unary_function< Gmpfr, std::pair<Gmpz,long> > {
: public CGAL::unary_function< Gmpfr, std::pair<Gmpz,long> > {
std::pair<Gmpz,long> operator()( const Gmpfr& x ) const {
return x.to_integer_exp();
@ -134,21 +134,21 @@ template<> class Float_traits< Gmpfr > {
};
public:
struct Get_mantissa
: public std::unary_function< Gmpfr, Gmpz > {
: public CGAL::unary_function< Gmpfr, Gmpz > {
Gmpz operator()( const Gmpfr& x ) const {
return Get_mantissa_exponent()(x).first;
}
};
struct Get_exponent
: public std::unary_function< Gmpfr, long > {
: public CGAL::unary_function< Gmpfr, long > {
long operator()( const Gmpfr& x ) const {
return Get_mantissa_exponent()(x).second;
}
};
struct Mul_by_pow_of_2
: public std::binary_function< Gmpfr, Gmpz, Gmpfr> {
: public CGAL::binary_function< Gmpfr, Gmpz, Gmpfr> {
Gmpfr operator()( const Gmpfr& a, long e ) const {
Gmpfr result(0,a.get_precision()); // just to get the prec of a
if (e >= 0 ){

View File

@ -38,7 +38,7 @@ namespace CGAL {
namespace internal {
template<typename Polynomial_1, typename Bound>
struct Interval_evaluate_1 : public std::binary_function
struct Interval_evaluate_1 : public CGAL::binary_function
<Polynomial_1,std::pair<Bound,Bound>,
std::pair<typename CGAL::Coercion_traits<typename
CGAL::Polynomial_traits_d<Polynomial_1>::Coefficient_type,Bound>::Type,

View File

@ -39,7 +39,7 @@ namespace CGAL {
namespace internal {
template<typename Polynomial_2, typename Bound>
struct Interval_evaluate_2 : public std::binary_function
struct Interval_evaluate_2 : public CGAL::binary_function
<Polynomial_2,CGAL::cpp11::array<Bound,4>,
std::pair<typename CGAL::Coercion_traits<typename CGAL::Polynomial_traits_d<Polynomial_2>::Innermost_coefficient_type,Bound>::Type,
typename CGAL::Coercion_traits<typename CGAL::Polynomial_traits_d<Polynomial_2>::Innermost_coefficient_type,Bound>::Type> > {

View File

@ -102,7 +102,7 @@ template<>
class Real_embeddable_extension< long > {
public:
struct Ceil_log2_abs
: public std::unary_function< long, long > {
: public CGAL::unary_function< long, long > {
long operator()( long x ) {
if (x < 0) x = -x;
CGAL_precondition(x > 0);
@ -112,7 +112,7 @@ public:
};
struct Floor_log2_abs
: public std::unary_function< long, long > {
: public CGAL::unary_function< long, long > {
private:
signed char floor_log2_4bit[16];
public:
@ -148,11 +148,11 @@ public:
};
struct Floor
: public std::unary_function< long, long > {
: public CGAL::unary_function< long, long > {
long operator() (long x) { return x;}
};
struct Ceil
: public std::unary_function< long, long > {
: public CGAL::unary_function< long, long > {
long operator() (long x) { return x;}
};
};
@ -167,7 +167,7 @@ public:
typedef leda_integer Type;
struct Ceil_log2_abs
: public std::unary_function< leda_integer, long > {
: public CGAL::unary_function< leda_integer, long > {
long operator()( const leda_integer& x ) const {
CGAL_precondition(x != leda_integer(0));
::leda::digit_sz ldgzeros = ::leda::digLeadingZeros(x.highword());
@ -187,7 +187,7 @@ public:
};
struct Floor_log2_abs
: public std::unary_function< leda_integer, long > {
: public CGAL::unary_function< leda_integer, long > {
long operator()( const leda_integer& x ) const {
CGAL_precondition(x != leda_integer(0));
::leda::digit_sz ldgzeros
@ -199,11 +199,11 @@ public:
};
struct Floor
: public std::unary_function< leda_integer, leda_integer > {
: public CGAL::unary_function< leda_integer, leda_integer > {
leda_integer operator() (const leda_integer& x) const { return x;}
};
struct Ceil
: public std::unary_function< leda_integer, leda_integer > {
: public CGAL::unary_function< leda_integer, leda_integer > {
leda_integer operator() (const leda_integer& x) const { return x;}
};
};
@ -215,7 +215,7 @@ public:
typedef leda_bigfloat Type;
struct Floor_log2_abs
: public std::unary_function< leda_bigfloat, long > {
: public CGAL::unary_function< leda_bigfloat, long > {
long operator()( const leda_bigfloat& x ) const {
CGAL_precondition(CGAL::sign(x) != CGAL::ZERO);
::leda::integer abs_sign = abs(x.get_significant());
@ -225,7 +225,7 @@ public:
};
struct Ceil_log2_abs
: public std::unary_function< leda_bigfloat, long > {
: public CGAL::unary_function< leda_bigfloat, long > {
long operator()( const leda_bigfloat& x ) const {
CGAL_precondition(CGAL::sign(x) != CGAL::ZERO);
return ::leda::ilog2(x).to_long();
@ -233,14 +233,14 @@ public:
};
struct Floor
: public std::unary_function< leda_bigfloat, leda_integer > {
: public CGAL::unary_function< leda_bigfloat, leda_integer > {
leda_integer operator() ( const leda_bigfloat& x ) const {
return leda::to_integer( x, leda::TO_N_INF );
}
};
struct Ceil
: public std::unary_function< leda_bigfloat, leda_integer > {
: public CGAL::unary_function< leda_bigfloat, leda_integer > {
leda_integer operator() ( const leda_bigfloat& x ) const {
return leda::to_integer( x, leda::TO_P_INF );
}
@ -254,7 +254,7 @@ public:
typedef leda_bigfloat_interval Type;
struct Floor_log2_abs
: public std::unary_function< leda_bigfloat_interval, long > {
: public CGAL::unary_function< leda_bigfloat_interval, long > {
result_type operator() (const argument_type& x) const {
CGAL_precondition(! ::boost::numeric::in_zero(x));
@ -263,7 +263,7 @@ public:
};
struct Ceil_log2_abs
: public std::unary_function< leda_bigfloat_interval, long > {
: public CGAL::unary_function< leda_bigfloat_interval, long > {
long operator()( const leda_bigfloat_interval& x ) const {
CGAL_precondition(!(::boost::numeric::in_zero(x) &&
::boost::numeric::singleton(x)));
@ -272,7 +272,7 @@ public:
};
struct Floor
: public std::unary_function< leda_bigfloat_interval, leda_integer > {
: public CGAL::unary_function< leda_bigfloat_interval, leda_integer > {
leda_integer operator() ( const leda_bigfloat_interval& x )
const {
return internal::floor( x.lower() );
@ -280,7 +280,7 @@ public:
};
struct Ceil
: public std::unary_function< leda_bigfloat_interval, leda_integer > {
: public CGAL::unary_function< leda_bigfloat_interval, leda_integer > {
leda_integer operator() ( const leda_bigfloat_interval& x )
const {
return internal::ceil( x.upper() );
@ -298,27 +298,27 @@ class Real_embeddable_extension< CORE::BigInt > {
public:
typedef CORE::BigInt Type;
struct Floor_log2_abs
: public std::unary_function< CORE::BigInt, long > {
: public CGAL::unary_function< CORE::BigInt, long > {
long operator()( const CORE::BigInt& x ) const {
return CORE::floorLg(x);
}
};
struct Ceil_log2_abs
: public std::unary_function< CORE::BigInt, long > {
: public CGAL::unary_function< CORE::BigInt, long > {
long operator()( const CORE::BigInt& x ) const {
return CORE::ceilLg(x);
}
};
struct Floor
: public std::unary_function< CORE::BigInt, CORE::BigInt > {
: public CGAL::unary_function< CORE::BigInt, CORE::BigInt > {
CORE::BigInt operator() (const CORE::BigInt& x) const {
return x;
}
};
struct Ceil
: public std::unary_function< CORE::BigInt, CORE::BigInt > {
: public CGAL::unary_function< CORE::BigInt, CORE::BigInt > {
CORE::BigInt operator() (const CORE::BigInt& x) const {
return x;
}
@ -331,7 +331,7 @@ class Real_embeddable_extension< CORE::BigFloat > {
public:
typedef CORE::BigFloat Type;
struct Floor_log2_abs
: public std::unary_function< CORE::BigFloat, long > {
: public CGAL::unary_function< CORE::BigFloat, long > {
long operator()( CORE::BigFloat x ) const {
CGAL_precondition(!CGAL::zero_in(x));
x = CGAL::abs(x);
@ -340,7 +340,7 @@ public:
};
struct Ceil_log2_abs
: public std::unary_function< CORE::BigFloat, long > {
: public CGAL::unary_function< CORE::BigFloat, long > {
long operator()( CORE::BigFloat x ) const {
// (already commented out in EXACUS)...
// NiX_precond(!(NiX::in_zero(x) && NiX::singleton(x)));
@ -350,7 +350,7 @@ public:
};
struct Floor
: public std::unary_function< CORE::BigFloat, CORE::BigInt > {
: public CGAL::unary_function< CORE::BigFloat, CORE::BigInt > {
CORE::BigInt operator() ( const CORE::BigFloat& x ) const {
CORE::BigInt xi = x.BigIntValue();
if(x.sign() < 0 && x.cmp(xi)!=0) {
@ -361,7 +361,7 @@ public:
};
struct Ceil
: public std::unary_function< CORE::BigFloat, CORE::BigInt > {
: public CGAL::unary_function< CORE::BigFloat, CORE::BigInt > {
CORE::BigInt operator() ( const CORE::BigFloat& x ) const {
CORE::BigInt xi = x.BigIntValue();
if(x.sign() >0 && x.cmp(xi)!=0) {
@ -384,7 +384,7 @@ public:
typedef Gmpz Type;
struct Floor_log2_abs
: public std::unary_function< Gmpz, long > {
: public CGAL::unary_function< Gmpz, long > {
long operator()( const Gmpz& x ) const {
CGAL_precondition(!CGAL::is_zero(x));
return mpz_sizeinbase(x.mpz(),2)-1;
@ -392,7 +392,7 @@ public:
};
struct Ceil_log2_abs
: public std::unary_function< Gmpz, long > {
: public CGAL::unary_function< Gmpz, long > {
long operator()( const Gmpz& x ) const {
long pos = mpz_scan1(x.mpz(),0);
long size = mpz_sizeinbase(x.mpz(),2);
@ -404,13 +404,13 @@ public:
};
struct Floor
: public std::unary_function< Gmpz, Gmpz > {
: public CGAL::unary_function< Gmpz, Gmpz > {
Gmpz operator() (const Gmpz& x) const {
return x;
}
};
struct Ceil
: public std::unary_function< Gmpz, Gmpz > {
: public CGAL::unary_function< Gmpz, Gmpz > {
Gmpz operator() (const Gmpz& x) const {
return x;
}
@ -426,7 +426,7 @@ public:
typedef Gmpfr Type;
struct Floor_log2_abs
: public std::unary_function< Gmpfr, long > {
: public CGAL::unary_function< Gmpfr, long > {
long operator()( const Gmpfr& x ) const {
Float_traits<Gmpfr>::Get_mantissa get_mantissa;
Float_traits<Gmpfr>::Get_exponent get_exponent;
@ -437,7 +437,7 @@ public:
};
struct Ceil_log2_abs
: public std::unary_function< Gmpfr, long > {
: public CGAL::unary_function< Gmpfr, long > {
long operator()( const Gmpfr& x ) const {
Float_traits<Gmpfr>::Get_mantissa get_mantissa;
Float_traits<Gmpfr>::Get_exponent get_exponent;
@ -448,7 +448,7 @@ public:
};
struct Floor
: public std::unary_function< Gmpfr, Gmpz > {
: public CGAL::unary_function< Gmpfr, Gmpz > {
Gmpz operator() ( const Gmpfr& x ) const {
Gmpz result;
mpfr_get_z (result.mpz(),x.fr(),GMP_RNDD);
@ -457,7 +457,7 @@ public:
};
struct Ceil
: public std::unary_function< Gmpfr, Gmpz > {
: public CGAL::unary_function< Gmpfr, Gmpz > {
Gmpz operator() ( const Gmpfr& x ) const {
Gmpz result;
mpfr_get_z (result.mpz(),x.fr(),GMP_RNDU);
@ -475,7 +475,7 @@ public:
typedef Gmpfi Type;
struct Floor_log2_abs
: public std::unary_function< Gmpfi, long > {
: public CGAL::unary_function< Gmpfi, long > {
result_type operator() (const argument_type& x) const {
CGAL_precondition(!x.is_zero());
return internal::floor_log2_abs(x.abs().inf());
@ -483,7 +483,7 @@ public:
};
struct Ceil_log2_abs
: public std::unary_function< Gmpfi, long > {
: public CGAL::unary_function< Gmpfi, long > {
long operator()( const Gmpfi& x ) const {
CGAL_precondition(!x.inf().is_zero() || !x.sup().is_zero());
return internal::ceil_log2_abs(x.abs().sup());
@ -491,7 +491,7 @@ public:
};
struct Floor
: public std::unary_function< Gmpfi, Gmpz > {
: public CGAL::unary_function< Gmpfi, Gmpz > {
Gmpz operator() ( const Gmpfi& x )
const {
return internal::floor( x.inf() );
@ -499,7 +499,7 @@ public:
};
struct Ceil
: public std::unary_function< Gmpfi, Gmpz > {
: public CGAL::unary_function< Gmpfi, Gmpz > {
Gmpz operator() ( const Gmpfi& x )
const {
return internal::ceil( x.sup() );

View File

@ -68,7 +68,7 @@ namespace internal {
int variations = 0;
int old_sign = CGAL::sign(P[n]); // never zero unless P is zero
for (int i = n-1; i >= 0; i--) {
int s = sign(P[i]);
int s = CGAL::sign(P[i]);
if (s == 0) continue;
if (old_sign != s) {
old_sign = s;

View File

@ -68,12 +68,12 @@ protected:
// Some functors used for STL calls
template<typename A,typename B>
struct Pair_first : public std::unary_function<std::pair<A,B>,A> {
struct Pair_first : public CGAL::unary_function<std::pair<A,B>,A> {
A operator() (std::pair<A,B> pair) const { return pair.first; }
};
template<typename A,typename B>
struct Pair_second : public std::unary_function<std::pair<A,B>,B> {
struct Pair_second : public CGAL::unary_function<std::pair<A,B>,B> {
B operator() (std::pair<A,B> pair) const { return pair.second; }
};
@ -83,7 +83,7 @@ public:
typedef Algebraic_real_1 Type;
struct Bound_between
: public std::binary_function< Type, Type, Bound > {
: public CGAL::binary_function< Type, Type, Bound > {
Bound operator()( const Type& t1,
const Type& t2 ) const {
#if CGAL_AK_DONT_USE_SIMPLE_BOUND_BETWEEN
@ -96,21 +96,21 @@ public:
};
struct Lower_bound
: public std::unary_function< Type, Bound > {
: public CGAL::unary_function< Type, Bound > {
Bound operator()( const Type& t ) const {
return t.low();
}
};
struct Upper_bound
: public std::unary_function< Type, Bound > {
: public CGAL::unary_function< Type, Bound > {
Bound operator()( const Type& t ) const {
return t.high();
}
};
struct Refine
: public std::unary_function< Type, void > {
: public CGAL::unary_function< Type, void > {
void operator()( const Type& t ) const {
t.refine();
}
@ -148,7 +148,7 @@ public:
};
struct Approximate_absolute_1:
public std::binary_function<Algebraic_real_1,int,std::pair<Bound,Bound> >{
public CGAL::binary_function<Algebraic_real_1,int,std::pair<Bound,Bound> >{
std::pair<Bound,Bound>
operator()(const Algebraic_real_1& x, int prec) const {
Lower_bound lower;
@ -167,7 +167,7 @@ public:
};
struct Approximate_relative_1:
public std::binary_function<Algebraic_real_1,int,std::pair<Bound,Bound> >{
public CGAL::binary_function<Algebraic_real_1,int,std::pair<Bound,Bound> >{
std::pair<Bound,Bound>
operator()(const Algebraic_real_1& x, int prec) const {
@ -275,7 +275,7 @@ public:
/*
// TODO: Can we avoid to use this?
struct Greater_compare :
public std::binary_function<Algebraic_real_1,Algebraic_real_1,bool> {
public CGAL::binary_function<Algebraic_real_1,Algebraic_real_1,bool> {
bool operator() (const Algebraic_real_1& a, const Algebraic_real_1& b)
const {
@ -333,7 +333,7 @@ public:
};
class Number_of_solutions_1
: public std::unary_function<Polynomial_1,size_type> {
: public CGAL::unary_function<Polynomial_1,size_type> {
public:
@ -349,7 +349,7 @@ public:
struct Sign_at_1
: public std::binary_function< Polynomial_1, Algebraic_real_1, CGAL::Sign > {
: public CGAL::binary_function< Polynomial_1, Algebraic_real_1, CGAL::Sign > {
CGAL::Sign operator()( const Polynomial_1& p, const Algebraic_real_1& ar ) const {
if(CGAL::is_zero(p)) return ZERO;
if(CGAL::degree(p)==0) return p.sign_at(0);
@ -372,7 +372,7 @@ public:
}
};
struct Is_zero_at_1
: public std::binary_function< Polynomial_1, Algebraic_real_1, bool > {
: public CGAL::binary_function< Polynomial_1, Algebraic_real_1, bool > {
bool operator()( const Polynomial_1& p, const Algebraic_real_1& ar ) const {
if(CGAL::is_zero(p)) return true;
if( ar.low() == ar.high() ) return p.sign_at( ar.low() ) == ZERO;
@ -382,7 +382,7 @@ public:
};
struct Is_square_free_1
: public std::unary_function< Polynomial_1, bool > {
: public CGAL::unary_function< Polynomial_1, bool > {
bool operator()( const Polynomial_1& p ) const {
typename CGAL::Polynomial_traits_d< Polynomial_1 >::Is_square_free isf;
return isf(p);
@ -390,7 +390,7 @@ public:
};
struct Is_coprime_1
: public std::binary_function< Polynomial_1, Polynomial_1, bool > {
: public CGAL::binary_function< Polynomial_1, Polynomial_1, bool > {
bool operator()( const Polynomial_1& p1, const Polynomial_1& p2 ) const {
typename CGAL::Polynomial_traits_d< Polynomial_1 >::Total_degree total_degree;
@ -400,7 +400,7 @@ public:
};
struct Make_square_free_1
: public std::unary_function< Polynomial_1, Polynomial_1 > {
: public CGAL::unary_function< Polynomial_1, Polynomial_1 > {
Polynomial_1 operator()( const Polynomial_1& p ) const {
return typename CGAL::Polynomial_traits_d< Polynomial_1 >::Make_square_free()( p );
}
@ -435,7 +435,7 @@ public:
}
};
struct Compute_polynomial_1 : public std::unary_function<Algebraic_real_1,
struct Compute_polynomial_1 : public CGAL::unary_function<Algebraic_real_1,
Polynomial_1> {
Polynomial_1 operator()(const Algebraic_real_1& x) const {
return x.polynomial();
@ -485,7 +485,7 @@ public:
};
struct Compare_1
: public std::binary_function<Algebraic_real_1,
: public CGAL::binary_function<Algebraic_real_1,
Algebraic_real_1,
CGAL::Comparison_result>{
@ -530,7 +530,7 @@ public:
public:
struct Isolate_1 : public std::binary_function
struct Isolate_1 : public CGAL::binary_function
< Algebraic_real_1,Polynomial_1,std::pair<Bound,Bound> > {
public:

View File

@ -258,39 +258,39 @@ public INTERN_RET::Real_embeddable_traits_base<
Base;
typedef typename Base::Compare Compare;
class Sgn:public std::unary_function<Type,CGAL::Sign>{
class Sgn:public CGAL::unary_function<Type,CGAL::Sign>{
public:
CGAL::Sign operator()(const Type &a)const{
return Compare()(a,Type(0));
}
};
class To_double:public std::unary_function<Type,double>{
class To_double:public CGAL::unary_function<Type,double>{
public:
double operator()(const Type &a)const{return a.to_double();}
};
class To_interval:
public std::unary_function<Type,std::pair<double,double> >{
public CGAL::unary_function<Type,std::pair<double,double> >{
public:
std::pair<double,double> operator()(const Type &a)const{
return a.to_interval();
}
};
class Is_zero:public std::unary_function<Type,Boolean>{
class Is_zero:public CGAL::unary_function<Type,Boolean>{
public:
bool operator()(const Type &a)const{
return Sgn()(a)==CGAL::ZERO;
}
};
class Is_finite:public std::unary_function<Type,Boolean>{
class Is_finite:public CGAL::unary_function<Type,Boolean>{
public:
bool operator()(const Type&)const{return true;}
};
class Abs:public std::unary_function<Type,Type>{
class Abs:public CGAL::unary_function<Type,Type>{
public:
Type operator()(const Type &a)const{
return Sgn()(a)==CGAL::NEGATIVE?-a:a;

View File

@ -249,39 +249,39 @@ public INTERN_RET::Real_embeddable_traits_base<
Base;
typedef typename Base::Compare Compare;
class Sgn:public std::unary_function<Type,CGAL::Sign>{
class Sgn:public CGAL::unary_function<Type,CGAL::Sign>{
public:
CGAL::Sign operator()(const Type &a)const{
return Compare()(a,Type(0));
}
};
class To_double:public std::unary_function<Type,double>{
class To_double:public CGAL::unary_function<Type,double>{
public:
double operator()(const Type &a)const{return a.to_double();}
};
class To_interval:
public std::unary_function<Type,std::pair<double,double> >{
public CGAL::unary_function<Type,std::pair<double,double> >{
public:
std::pair<double,double> operator()(const Type &a)const{
return a.to_interval();
}
};
class Is_zero:public std::unary_function<Type,Boolean>{
class Is_zero:public CGAL::unary_function<Type,Boolean>{
public:
bool operator()(const Type &a)const{
return Sgn()(a)==CGAL::ZERO;
}
};
class Is_finite:public std::unary_function<Type,Boolean>{
class Is_finite:public CGAL::unary_function<Type,Boolean>{
public:
bool operator()(const Type&)const{return true;}
};
class Abs:public std::unary_function<Type,Type>{
class Abs:public CGAL::unary_function<Type,Type>{
public:
Type operator()(const Type &a)const{
return Sgn()(a)==CGAL::NEGATIVE?-a:a;

View File

@ -60,7 +60,7 @@ struct Construct_algebraic_real_1{
template <class Polynomial_,class Algebraic_>
struct Compute_polynomial_1:
public std::unary_function<Algebraic_,Polynomial_>{
public CGAL::unary_function<Algebraic_,Polynomial_>{
typedef Polynomial_ Polynomial;
typedef Algebraic_ Algebraic;
Polynomial operator()(const Algebraic &x)const{
@ -70,7 +70,7 @@ public std::unary_function<Algebraic_,Polynomial_>{
template <class Polynomial_,class Ptraits_>
struct Is_coprime_1:
public std::binary_function<Polynomial_,Polynomial_,bool>{
public CGAL::binary_function<Polynomial_,Polynomial_,bool>{
typedef Polynomial_ Polynomial;
typedef Ptraits_ Ptraits;
typedef typename Ptraits::Gcd_up_to_constant_factor Gcd;
@ -256,7 +256,7 @@ template <class Polynomial_,
class Signat_,
class Ptraits_>
class Sign_at_1:
public std::binary_function<Polynomial_,Algebraic_,CGAL::Sign>{
public CGAL::binary_function<Polynomial_,Algebraic_,CGAL::Sign>{
// This implementation will work with any polynomial type whose
// coefficient type is explicit interoperable with Gmpfi.
// TODO: Make this function generic.
@ -362,7 +362,7 @@ template <class Polynomial_,
class Signat_,
class Ptraits_>
class Is_zero_at_1:
public std::binary_function<Polynomial_,Algebraic_,bool>{
public CGAL::binary_function<Polynomial_,Algebraic_,bool>{
// This implementation will work with any polynomial type whose
// coefficient type is explicit interoperable with Gmpfi.
// TODO: Make this function generic.
@ -442,7 +442,7 @@ public std::binary_function<Polynomial_,Algebraic_,bool>{
// programs assume that this is equal to int
template <class Polynomial_,class Isolator_>
struct Number_of_solutions_1:
public std::unary_function<Polynomial_,int>{
public CGAL::unary_function<Polynomial_,int>{
typedef Polynomial_ Polynomial_1;
typedef Isolator_ Isolator;
size_t operator()(const Polynomial_1 &p)const{
@ -458,7 +458,7 @@ template <class Algebraic_,
class Bound_,
class Comparator_>
struct Compare_1:
public std::binary_function<Algebraic_,Algebraic_,CGAL::Comparison_result>{
public CGAL::binary_function<Algebraic_,Algebraic_,CGAL::Comparison_result>{
typedef Algebraic_ Algebraic;
typedef Bound_ Bound;
typedef Comparator_ Comparator;
@ -510,7 +510,7 @@ template <class Algebraic_,
class Bound_,
class Comparator_>
struct Bound_between_1:
public std::binary_function<Algebraic_,Algebraic_,Bound_>{
public CGAL::binary_function<Algebraic_,Algebraic_,Bound_>{
typedef Algebraic_ Algebraic;
typedef Bound_ Bound;
typedef Comparator_ Comparator;
@ -550,7 +550,7 @@ template <class Polynomial_,
class Signat_,
class Ptraits_>
struct Isolate_1:
public std::binary_function<Algebraic_,Polynomial_,std::pair<Bound_,Bound_> >{
public CGAL::binary_function<Algebraic_,Polynomial_,std::pair<Bound_,Bound_> >{
typedef Polynomial_ Polynomial_1;
typedef Bound_ Bound;
typedef Algebraic_ Algebraic;
@ -588,7 +588,7 @@ template <class Polynomial_,
class Algebraic_,
class Refiner_>
struct Approximate_absolute_1:
public std::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
public CGAL::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
typedef Polynomial_ Polynomial_1;
typedef Bound_ Bound;
typedef Algebraic_ Algebraic;
@ -620,7 +620,7 @@ template <class Polynomial_,
class Algebraic_,
class Refiner_>
struct Approximate_relative_1:
public std::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
public CGAL::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
typedef Polynomial_ Polynomial_1;
typedef Bound_ Bound;
typedef Algebraic_ Algebraic;

View File

@ -68,7 +68,7 @@ struct Construct_algebraic_real_z_1{
template <class Polynomial_,class Algebraic_>
struct Compute_polynomial_z_1:
public std::unary_function<Algebraic_,Polynomial_>{
public CGAL::unary_function<Algebraic_,Polynomial_>{
typedef Polynomial_ Polynomial;
typedef Algebraic_ Algebraic;
Polynomial operator()(const Algebraic &x)const{
@ -78,7 +78,7 @@ public std::unary_function<Algebraic_,Polynomial_>{
template <class Polynomial_,class Ptraits_>
struct Is_coprime_z_1:
public std::binary_function<Polynomial_,Polynomial_,bool>{
public CGAL::binary_function<Polynomial_,Polynomial_,bool>{
typedef Polynomial_ Polynomial;
typedef Ptraits_ Ptraits;
typedef typename Ptraits::Gcd_up_to_constant_factor Gcd;
@ -284,7 +284,7 @@ template <class Polynomial_,
class Ptraits_,
class ZPtraits_>
class Sign_at_z_1:
public std::binary_function<Polynomial_,Algebraic_,CGAL::Sign>{
public CGAL::binary_function<Polynomial_,Algebraic_,CGAL::Sign>{
// This implementation will work with any polynomial type whose
// coefficient type is explicit interoperable with Gmpfi.
// TODO: Make this function generic.
@ -396,7 +396,7 @@ template <class Polynomial_,
class Ptraits_,
class ZPtraits_>
class Is_zero_at_z_1:
public std::binary_function<Polynomial_,Algebraic_,bool>{
public CGAL::binary_function<Polynomial_,Algebraic_,bool>{
// This implementation will work with any polynomial type whose
// coefficient type is explicit interoperable with Gmpfi.
// TODO: Make this function generic.
@ -482,7 +482,7 @@ template <class Polynomial_,
class PolConverter_,
class Isolator_>
struct Number_of_solutions_z_1:
public std::unary_function<Polynomial_,int>{
public CGAL::unary_function<Polynomial_,int>{
typedef Polynomial_ Polynomial_1;
typedef ZPolynomial_ ZPolynomial_1;
typedef PolConverter_ PolConverter;
@ -500,7 +500,7 @@ template <class Algebraic_,
class Bound_,
class Comparator_>
struct Compare_z_1:
public std::binary_function<Algebraic_,Algebraic_,CGAL::Comparison_result>{
public CGAL::binary_function<Algebraic_,Algebraic_,CGAL::Comparison_result>{
typedef Algebraic_ Algebraic;
typedef Bound_ Bound;
typedef Comparator_ Comparator;
@ -552,7 +552,7 @@ template <class Algebraic_,
class Bound_,
class Comparator_>
struct Bound_between_z_1:
public std::binary_function<Algebraic_,Algebraic_,Bound_>{
public CGAL::binary_function<Algebraic_,Algebraic_,Bound_>{
typedef Algebraic_ Algebraic;
typedef Bound_ Bound;
typedef Comparator_ Comparator;
@ -595,7 +595,7 @@ template <class Polynomial_,
class Ptraits_,
class ZPtraits_>
struct Isolate_z_1:
public std::binary_function<Algebraic_,Polynomial_,std::pair<Bound_,Bound_> >{
public CGAL::binary_function<Algebraic_,Polynomial_,std::pair<Bound_,Bound_> >{
typedef Polynomial_ Polynomial_1;
typedef ZPolynomial_ ZPolynomial_1;
typedef PolConverter_ PolConverter;
@ -639,7 +639,7 @@ template <class Polynomial_,
class Algebraic_,
class Refiner_>
struct Approximate_absolute_z_1:
public std::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
public CGAL::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
typedef Polynomial_ Polynomial_1;
typedef Bound_ Bound;
typedef Algebraic_ Algebraic;
@ -671,7 +671,7 @@ template <class Polynomial_,
class Algebraic_,
class Refiner_>
struct Approximate_relative_z_1:
public std::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
public CGAL::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
typedef Polynomial_ Polynomial_1;
typedef Bound_ Bound;
typedef Algebraic_ Algebraic;

View File

@ -26,7 +26,7 @@ namespace RS_AK1{
template <class InputPolynomial_,class OutputPolynomial_>
struct Polynomial_converter_1:
public std::unary_function<InputPolynomial_,OutputPolynomial_>{
public CGAL::unary_function<InputPolynomial_,OutputPolynomial_>{
typedef InputPolynomial_ InpPolynomial_1;
typedef OutputPolynomial_ OutPolynomial_1;
OutPolynomial_1 operator()(const InpPolynomial_1&)const;

View File

@ -11,8 +11,8 @@ namespace CGAL {
\image html alphashape.png
\image latex alphashape.png
Assume we are given a set \f$ S\f$ of points in 2D or 3D and we'd like to
have something like "the shape formed by these points." This is
Assume we are given a set \f$ S\f$ of points in 2D or 3D and we would like to
have something like "the shape formed by these points". This is
quite a vague notion and there are probably many possible
interpretations, the \f$ \alpha\f$-shape being one of them. Alpha shapes
can be used for shape reconstruction from a dense unorganized set of
@ -23,50 +23,51 @@ As mentioned in Edelsbrunner's and M&uuml;cke's paper \cgalCite{em-tdas-94},
one can intuitively think of an \f$ \alpha\f$-shape as the
following. Imagine a huge mass of ice-cream making up the space \f$ \mathbb{R}^3\f$
and containing the points as "hard" chocolate pieces. Using one of
these sphere-formed ice-cream spoons we carve out all parts of the
these sphere-formed ice-cream spoons, we carve out all parts of the
ice-cream block we can reach without bumping into chocolate pieces,
thereby even carving out holes in the inside (e.g. parts not reachable
by simply moving the spoon from the outside). We will eventually end
up with a (not necessarily convex) object bounded by caps, arcs and
points. If we now straighten all "round" faces to triangles and line
segments, we have an intuitive description of what is called the
\f$ \alpha\f$-shape of \f$ S\f$. Here's an example for this process in 2D (where
our ice-cream spoon is simply a circle):
\f$ \alpha\f$-shape of \f$ S\f$. The drawing above provides an example
of this process in 2D (where our ice-cream spoon is simply a circle).
And what is \f$ \alpha\f$ in the game? \f$ \alpha\f$ is the squared radius of the
Alpha shapes depend on a parameter \f$ \alpha\f$ after which they are named.
In the ice-cream analogy above, \f$ \alpha\f$ is the squared radius of the
carving spoon. A very small value will allow us to eat up all of the
ice-cream except the chocolate points themselves. Thus we already see
that the \f$ \alpha\f$-shape degenerates to the point-set \f$ S\f$ for
\f$ \alpha \rightarrow 0\f$. On the other hand, a huge value of \f$ \alpha\f$
will prevent us even from moving the spoon between two points since
it's way too large. So we will never spoon up ice-cream lying in the
inside of the convex hull of \f$ S\f$, and hence the \f$ \alpha\f$-shape for
\f$ \alpha \rightarrow \infty\f$ is the convex hull of \f$ S\f$.
it is too large. So we will never spoon up the ice-cream lying in the
inside of the convex hull of \f$ S\f$. Hence, the alpha shape becomes
the convex hull of \f$ S\f$ as \f$ \alpha \rightarrow \infty\f$.
\cgal offers 2D and 3D alpha shapes. The GUDHI library offers a
<a href="http://gudhi.gforge.inria.fr/doc/latest/group__alpha__complex.html"> dD Alpha complex</a>.
\section Alpha_shapes_2Definitions Definitions
We distinguish two versions of alpha shapes. <I>Basic alpha shapes</I>
are based on the Delaunay triangulation. <I>Weighted alpha shapes</I>
are based on its generalization, the regular triangulation, replacing
the euclidean distance by the power to weighted points.
are based on its generalization, the regular triangulation
(cf. Section \ref Section_2D_Triangulations_Regular "Regular Triangulations"),
replacing the euclidean distance by the power to weighted points.
There is a close connection between alpha shapes and the underlying
triangulations. More precisely, the \f$ \alpha\f$-complex of \f$ S\f$ is a
subcomplex of this triangulation of \f$ S\f$, containing the \f$ \alpha\f$-exposed
\f$ k\f$-simplices, \f$ 0 \leq k \leq d\f$. A simplex is \f$ \alpha\f$-exposed, if there is an
\f$ k\f$-simplices, \f$ 0 \leq k \leq d\f$. A simplex is said to be \f$ \alpha\f$-exposed, if there is an
open disk (resp. ball) of radius \f$ \sqrt{\alpha}\f$ through the vertices of the
simplex that does not contain any other point of \f$ S\f$, for the metric used in
the computation of the underlying triangulation. The corresponding
\f$ \alpha\f$-shape is defined as the underlying interior space of the
\f$ \alpha\f$-complex (see \cgalCite{em-tdas-94}).
In general, an \f$ \alpha\f$-complex is a non-connected and non-pure polytope, it
means, that one \f$ k\f$-simplex, \f$ 0 \leq k \leq d-1\f$ is not necessary adjacent to
a \f$ (k+1)\f$-simplex.
In general, an \f$ \alpha\f$-complex is a non-connected and non-pure polytope,
meaning that one \f$ k\f$-simplex, with \f$ 0 \leq k \leq d-1\f$, is not necessarily
adjacent to a \f$ (k+1)\f$-simplex.
The \f$ \alpha\f$-shapes of \f$ S\f$ form a discrete family, even though they
are defined for all real numbers \f$ \alpha\f$ with \f$ 0 \leq \alpha
@ -105,12 +106,12 @@ but not incident/incident to a triangle of the \f$ \alpha\f$-complex.
Finally, it provides a function to determine the \f$ \alpha\f$-value
such that the \f$ \alpha\f$-shape satisfies the following two properties,
or at least the second one if there is no such \f$ \alpha\f$ that both
are satisfied:
(i) The number of components equals a number of your choice and
(ii) all data points are either on the boundary or in the interior of the regularized version of
the \f$ \alpha\f$-shape (no singular edges).<BR>
are satisfied: <br>
<ol>
<li> the number of components equals a number of your choice, and
<li> all data points are either on the boundary or in the interior of the regularized version of
the \f$ \alpha\f$-shape (no singular edges).
</ol>
The current implementation is static, that is after its construction
points cannot be inserted or removed.
@ -118,30 +119,51 @@ points cannot be inserted or removed.
\section I1_SectDtClass2D Concepts and Models
We currently do not specify concepts for the underlying triangulation
type. Models that work for a basic alpha-shape are the classes
`Delaunay_triangulation_2` and
type. Models that work for a basic alpha shape are the classes
`Delaunay_triangulation_2`, `Periodic_2_Delaunay_triangulation_2`, and
`Triangulation_hierarchy_2` templated with a Delaunay
triangulation. A model that works for a weighted alpha-shape is
triangulation. A model that works for a weighted alpha shape is
the class `Regular_triangulation_2`.
The triangulation needs a geometric traits class as argument.
The requirements of this class are described in the
concept `AlphaShapeTraits_2` for which
the \cgal kernels
and `Weighted_alpha_shape_euclidean_traits_2` are models.
\subsection AlphaShape2D_ConceptAndModelsAlphaShapes Alpha Shapes
There are no requirements on the triangulation data structure.
However it must be parameterized with
vertex and face classes, which are model of the concepts
`AlphaShapeVertex_2` and `AlphaShapeFace_2`,
by default the classes `Alpha_shape_vertex_base_2<Gt>`
and `Alpha_shape_face_base_2<Gt>`.
The triangulation needs a geometric traits class as argument.
The requirements of this class are described in the concepts `AlphaShapeTraits_2`
in the non-weighted case and `WeightedAlphaShapeTraits_2` in the weighted case.
All \cgal kernels are models of both concepts.
The triangulation data structure of the triangulation
has to be a model of the concept `TriangulationDataStructure_2`,
and it must be parameterized with
vertex and face classes which are models of the concepts
`AlphaShapeVertex_2` and `AlphaShapeFace_2`.
The classes `Alpha_shape_vertex_base_2<Gt, Vb>` and `Alpha_shape_face_base_2<Gt, Fb>`
are models of these concepts and can be used for all type of alpha shapes,
provided that the template parameters `Vb` and `Fb` are appropriately chosen,
as we shall see in the following section.
\subsection AlphaShape2D_ConceptAndModelsTDS Triangulation data structure
Additional requirements are put when using weighted or
periodic triangulations as underlying triangulation:
<ul>
<li> When using a weighted triangulation (`Regular_triangulation_2`), the vertex
and face classes must respectively be models to both `AlphaShapeVertex_2` and
`RegularTriangulationVertexBase_2`, and to both
`AlphaShapeFace_2` and `RegularTriangulationFaceBase_2`
(see example: \ref I1_SectWeightedAS2D).
<li> When using a periodic triangulation (`Periodic_2_Delaunay_triangulation_2`),
the vertex and face classes must respectively be models to both `AlphaShapeVertex_2`
and `Periodic_2TriangulationVertexBase_2`,
and to both `AlphaShapeFace_2` and `Periodic_2TriangulationFaceBase_2`
(see example: \ref AlphaShape_2DExampleForPeriodicAlphaShapes).
</ul>
\section Alpha_shapes_2Examples Examples
\subsection I1_SectClassicAS2D Example for Basic Alpha-Shapes
\subsection I1_SectClassicAS2D Example for Basic Alpha Shapes
The basic alpha shape needs a Delaunay triangulation as
The basic alpha shape requires a Delaunay triangulation as
underlying triangulation `Dt`. The Delaunay triangulation class is
parameterized with a geometric and a triangulation data structure traits.
@ -150,21 +172,53 @@ For the geometric traits class we can use a \cgal kernel.
For the triangulation data structure traits, we have to
choose the vertex and face classes needed for alpha shapes,
namely `Alpha_shape_vertex_base_2<Gt, Vb>` and `Alpha_shape_face_base_2<Gt,Fb>`.
As default vertex and face type they use `Triangulation_vertex_base_2<Gt>`
and `Triangulation_face_base_2<Gt>` respectively.
The parameter `Vb` and `Fb` must be filled by classes that are models of the
`TriangulationVertexBase_2` and `TriangulationFaceBase_2` concepts. The classes
`Triangulation_vertex_base_2<Gt>` and `Triangulation_face_base_2<Gt>` fit these
requirements.
The example below illustrates how to construct a basic alpha shape.
Note that `Triangulation_vertex_base_2<Gt>` and `Triangulation_face_base_2<Gt>`
are the default parameters for `Vb` and `Fb` in the classes
`Alpha_shape_vertex_base_2<Gt, Vb>` and `Alpha_shape_face_base_2<Gt,Fb>`. They
are thus omitted in the code below.
\cgalExample{Alpha_shapes_2/ex_alpha_shapes_2.cpp}
\subsection I1_SectWeightedAS2D Example for Weighted Alpha Shapes
\subsection I1_SectWeightedAS2D Example for Weighted Alpha-Shapes
A weighted alpha shape requires a regular triangulation as
underlying triangulation `Dt`.
Here again, we can use the vertex and face `Alpha_shape_vertex_base_2<Gt, Vb>`
and `Alpha_shape_face_base_2<Gt,Fb>`, but for weighted alpha shapes, `Vb` and `Fb`
must be models of the concepts `RegularTriangulationVertexBase_2` and
`RegularTriangulationFaceBase_2`. The classes `Regular_triangulation_vertex_base_2<Gt>`
`Regular_triangulation_face_base_2<Gt>` fit these requirements.
A weighted alpha shape, needs a regular triangulation as
underlying triangulation `Dt`, and it needs a particular
face class, namely `Regular_triangulation_face_base_2<Gt>`.
Note that there is no special weighted alpha shape class.
The example below illustrates how to construct a weighted alpha shape.
\cgalExample{Alpha_shapes_2/ex_weighted_alpha_shapes_2.cpp}
\subsection AlphaShape_2DExampleForPeriodicAlphaShapes Example for Periodic Alpha Shapes
The following example shows how to use a periodic Delaunay
triangulation as underlying triangulation for the alpha shape computation.
In order to define the original domain and to benefit from the
built-in heuristic optimizations of the periodic triangulation computation,
it is recommended to first construct the triangulation and
then construct the alpha shape from it. The alpha
shape constructor that takes a point range can be used as well but in
this case the original domain cannot be specified and the default unit
cube will be chosen and no optimizations will be used.
It is also recommended to switch the triangulation to 1-sheeted
covering if possible. Note that a periodic triangulation in 9-sheeted
covering space is degenerate. In this case, an exact constructions
kernel needs to be used to compute the alpha shapes. Otherwise the
results will suffer from round-off problems.
\cgalExample{Alpha_shapes_2/ex_periodic_alpha_shapes_2.cpp}
*/
} /* namespace CGAL */

View File

@ -16,20 +16,48 @@ and the \f$ k\f$-dimensional faces of the triangulation.
Note that this class is at the same time used for <I>basic</I> and
for <I>weighted</I> Alpha Shapes.
The modifying functions `Alpha_shape_2::insert()` and `Alpha_shape_2::remove()` will overwrite
the one inherited from the underlying triangulation class `Dt`.
At the moment, only the static version is implemented.
\tparam Dt must be either `Delaunay_triangulation_2` or `Regular_triangulation_2`.
Note that `Dt::Geom_traits`, `Dt::Vertex` and `Dt::Face` must be model the concepts `AlphaShapeTraits_2`,
Note that `Dt::Geom_traits`, `Dt::Vertex`, and `Dt::Face` must be model the concepts `AlphaShapeTraits_2`,
`AlphaShapeVertex_2` and `AlphaShapeFace_2`, respectively.
\tparam ExactAlphaComparisonTag is a tag that, when set to
\link Tag_true `Tag_true`\endlink, triggers exact comparisons between alpha values. This is useful
when the underlying triangulation is instantiated with an exact predicates inexact constructions
kernel. By default the `ExactAlphaComparisonTag` is set to \link Tag_false `Tag_false`\endlink as it induces a small
overhead. Note that since such a strategy does not make sense if used together with a traits class with exact constructions,
the tag `ExactAlphaComparisonTag` is not taken into account if `Dt::Geom_traits::FT` is not a floating point number type.
overhead. Note that the tag `ExactAlphaComparisonTag` is currently ignored (meaning that the code will
behave as if `ExactAlphaComparisonTag` were set to \link Tag_false `Tag_false`\endlink)
if `Dt::Geom_traits::FT` is not a floating point number type as this strategy
does not make sense if the traits class already provides exact constructions.
The modifying functions `Alpha_shape_2::insert()` and `Alpha_shape_2::remove()` will overwrite
the one inherited from the underlying triangulation class `Dt`.
At the moment, only the static version is implemented.
\warning
<ul>
<li>When the tag `ExactAlphaComparisonTag` is set to \link Tag_true `Tag_true`\endlink,
the class `Cartesian_converter` is used internally to switch between the traits class
and the %CGAL kernel `CGAL::Simple_cartesian<NT>`, where `NT` can be either `CGAL::Interval_nt` or
`CGAL::Exact_rational`. `Cartesian_converter` must thus offer the necessary functors
to convert a two-dimensional point of the traits class to a two-dimensional point
of `CGAL::Simple_cartesian<NT>`. However, these functors are not necessarily provided by
the basic `Cartesian_converter`. For example when using the traits class `CGAL::Projection_traits_xy_3`,
a `CGAL::Point_3` is camouflaged as a `%Point_2` and the basic `Cartesian_converter` does not know
how to convert from the camouflaged `CGAL::Point_3` to the two-dimensional point
of `CGAL::Simple_cartesian<NT>`. In this case, a partial specialization of `Cartesian_converter`
must be provided by the user. An example of such specialization is given in the example
\ref Alpha_shapes_2/ex_alpha_projection_traits.cpp "ex_alpha_projection_traits.cpp".
<li>The tag `ExactAlphaComparisonTag` cannot be used in conjonction with periodic triangulations.
When the tag `ExactAlphaComparisonTag` is set to \link Tag_true `Tag_true`\endlink,
the evaluations of predicates such as `Side_of_oriented_circle_2` are done lazily.
Consequently, the predicates store pointers to the geometrical positions of the
points passed as arguments of the predicates. It is thus important that
these points are not temporary objects. Points of the triangulation are accessed
using the function `point(Face_handle, int)` of the underlying triangulation.
In the case of periodic triangulations, the `point(Face_handle, int)` function
is actually a construction that returns a temporary, which thus cannot be used
along with a lazy predicate evaluation.
</ul>
\cgalHeading{I/O}
@ -87,6 +115,14 @@ For convenience, classical comparison operators are provided for the type `FT`.
*/
typedef Gt::FT FT;
/*!
The point type.
For basic alpha shapes, `Point` will be equal to `Gt::Point_2`. For weighted alpha
shapes, `Point` will be equal to `Gt::Weighted_point_2`.
*/
typedef Dt::Point Point;
/*!
The size type.
*/
@ -348,8 +384,11 @@ size_type number_of_solid_components(const FT& alpha = get_alpha()) const;
Returns an iterator pointing to the first element with \f$ \alpha\f$-value
such that the alpha shape satisfies the following two properties:
- `nb_components` equals the number of solid components and
- all data points are either on the boundary or in the interior of the regularized version of the alpha shape.
- All data points are either on the boundary or in the interior
of the regularized version of the alpha shape.
- The number of solid component of the alpha shape is equal to or
smaller than `nb_components`.
If no such value is found, the iterator points to the first element with
\f$ \alpha\f$-value such that the alpha shape satisfies the second property.

View File

@ -17,6 +17,10 @@ if `Alpha_shape_face_base_2` is intended to be used with an alpha-shape class ba
provided in the documentation of `Alpha_shape_2` for more details. The default value is \link Tag_false `Tag_false`\endlink.
\cgalModels `AlphaShapeFace_2`
\sa `Triangulation_face_base_2`
\sa `Regular_triangulation_face_base_2`
\sa `Periodic_2_triangulation_face_base_2`
*/
template< typename Traits, typename Fb, typename ExactAlphaComparisonTag >
class Alpha_shape_face_base_2 : public Fb {

View File

@ -18,6 +18,10 @@ if `Alpha_shape_vertex_base_2` is intended to be used with an alpha-shape class
provided in the documentation of `Alpha_shape_2` for more details. The default value is \link Tag_false `Tag_false`\endlink.
\cgalModels `AlphaShapeVertex_2`
\sa `Triangulation_vertex_base_2`
\sa `Regular_triangulation_vertex_base_2`
\sa `Periodic_2_triangulation_vertex_base_2`
*/
template< typename Traits, typename Vb, typename ExactAlphaComparisonTag >
class Alpha_shape_vertex_base_2 : public Vb {

View File

@ -4,17 +4,22 @@ namespace CGAL {
/*!
\ingroup PkgAlphaShape2
The class `Weighted_alpha_shape_euclidean_traits_2` is the default model for the concept
`AlphaShapeTraits_2` for the regular version of Alpha Shapes.
\deprecated The class is deprecated since \cgal 4.10, as the weighted point and the function
objects for weighted points are part of the concept `Kernel`. The class is kept for backward
compatibility.
\tparam K must be a `Kernel`.
The class `Weighted_alpha_shape_euclidean_traits_2` was the default model for the concept
`AlphaShapeTraits_2` for the regular version of Alpha Shapes.
\tparam K must be a model of `Kernel`.
\cgalModels `AlphaShapeTraits_2`
*/
template< typename K >
class Weighted_alpha_shape_euclidean_traits_2 :
public Regular_triangulation_euclidean_traits_2<K, typename K::FT> {
class Weighted_alpha_shape_euclidean_traits_2
: public K
{
public:
}; /* end Weighted_alpha_shape_euclidean_traits_2 */

View File

@ -3,12 +3,15 @@
\ingroup PkgAlphaShape2Concepts
\cgalConcept
\cgalRefines `TriangulationFaceBase_2`
The concept `AlphaShapeFace_2` describes the requirements for the base face of an alpha shape.
\cgalHasModel `CGAL::Alpha_shape_face_base_2`
\cgalRefines `TriangulationFaceBase_2`, if the underlying triangulation of the alpha shape is a Delaunay triangulation.
\cgalRefines `RegularTriangulationFaceBase_2`, if the underlying triangulation of the alpha shape is a regular triangulation.
\cgalRefines `Periodic_2TriangulationFaceBase_2`, if the underlying triangulation of the alpha shape is a periodic triangulation.
\cgalHasModel `CGAL::Alpha_shape_face_base_2` (templated with the appropriate triangulation face base class).
*/
class AlphaShapeFace_2 {
public:

View File

@ -3,17 +3,20 @@
\ingroup PkgAlphaShape2Concepts
\cgalConcept
A model of the concept `AlphaShapeTraits_2` must provide the following predicate and
operations in addition to the requirements for the underlying triangulation
traits class.
It means, the metric has to be Euclidean for Delaunay triangulation or the power
metric for regular triangulation.
The concept `AlphaShapeTraits_2` describes the requirements for the geometric traits
class of the underlying Delaunay triangulation of a basic alpha shape.
\cgalRefines `TriangulationTraits_2`
\cgalRefines `DelaunayTriangulationTraits_2`
\cgalHasModel Kernel
\cgalHasModel `CGAL::Projection_traits_xy_3<K>`
In addition to the requirements described in the concept
::DelaunayTriangulationTraits_2, the geometric traits class of a
Delaunay triangulation plugged in a basic alpha shapes provides the
following.
\cgalHasModel All models of `Kernel`.
\cgalHasModel Projection traits such as `CGAL::Projection_traits_xy_3<K>`.
\sa `CGAL::Exact_predicates_inexact_constructions_kernel` (recommended kernel)
*/
class AlphaShapeTraits_2 {

View File

@ -3,9 +3,13 @@
\ingroup PkgAlphaShape2Concepts
\cgalConcept
\cgalRefines `TriangulationVertexBase_2`
The concept `AlphaShapeVertex_2` describes the requirements for the base vertex of an alpha shape.
\cgalHasModel `CGAL::Alpha_shape_vertex_base_2`
\cgalRefines `TriangulationVertexBase_2`, if the underlying triangulation of the alpha shape is a Delaunay triangulation.
\cgalRefines `RegularTriangulationVertexBase_2`, if the underlying triangulation of the alpha shape is a regular triangulation.
\cgalRefines `Periodic_2TriangulationVertexBase_2`, if the underlying triangulation of the alpha shape is a periodic triangulation.
\cgalHasModel `CGAL::Alpha_shape_vertex_base_2` (templated with the appropriate triangulation vertex base class).
*/
class AlphaShapeVertex_2 {
public:

View File

@ -0,0 +1,78 @@
/*!
\ingroup PkgAlphaShape2Concepts
\cgalConcept
The concept `WeightedAlphaShapeTraits_2` describes the requirements
for the geometric traits class
of the underlying regular triangulation of a weighted alpha shape.
\cgalRefines `RegularTriangulationTraits_2`
In addition to the requirements described in the concept
`RegularTriangulationTraits_2`, the geometric traits class of a
regular triangulation plugged in a basic alpha shapes provides the
following.
\cgalHasModel All models of `Kernel`.
\cgalHasModel Projection traits such as `CGAL::Projection_traits_xy_3<K>`.
\sa `CGAL::Exact_predicates_inexact_constructions_kernel` (recommended kernel)
*/
class WeightedAlphaShapeTraits_2 {
public:
/// \name Types
/// @{
/*!
A coordinate type.
The type must provide a copy constructor, assignment, comparison
operators, negation, multiplication, division and allow the
declaration and initialization with a small integer constant
(cf. requirements for number types).
An obvious choice would be coordinate type of the point class.
*/
typedef unspecified_type FT;
/// @}
/// \name Creation
/// Only a default constructor is required. Note that further constructors can be provided.
/// @{
/*!
A default constructor.
*/
AlphaShapeTraits_2();
/// @}
/// \name Constructions by function objects
/// @{
/*!
Returns an object, which has to be able to compute the squared radius of the
orthogonal circle of the points `p0, p1, p2` or the squared radius of the
smallest orthogonal circle of the points `p0, p1`, as `FT`.
*/
Compute_squared_radius_smallest_orthogonal_circle_2
compute_squared_radius_smallest_orthogonal_circle_2_object();
/// @}
/// \name Predicate by function object
/// @{
/*!
Returns an object, which has to be able to compute the relative position of the
point `test` to the smallest orthogonal circle of the points `p0, p1`.
*/
Power_side_of_bounded_power_circle_2
power_side_of_bounded_power_circle_2_object();
/// @}
}; /* end WeightedAlphaShapeTraits_2 */

View File

@ -50,9 +50,9 @@ the computation of the underlying triangulation. The corresponding
\f$ \alpha\f$-shape is defined as the underlying interior space of the
\f$ \alpha\f$-complex.
In general, an \f$ \alpha\f$-complex is a non-connected and non-pure polytope, it
means, that one \f$ k\f$-simplex, \f$ 0 \leq k \leq d-1\f$ is not necessary adjacent to
a \f$ (k+1)\f$-simplex.
In general, an \f$ \alpha\f$-complex is a non-connected and non-pure polytope,
meaning that a \f$ k\f$-simplex, with \f$ 0 \leq k \leq d-1\f$, is not necessarily
adjacent to a \f$ (k+1)\f$-simplex.
The \f$ \alpha\f$-shapes of \f$ S\f$ form a discrete family, even though they
are defined for all real numbers \f$ \alpha\f$ with \f$ 0 \leq \alpha

View File

@ -4,5 +4,6 @@ STL_Extension
Algebraic_foundations
Circulator
Stream_support
Periodic_2_triangulation_2
Triangulation_2
Number_types

View File

@ -1,4 +1,6 @@
/*!
\example Alpha_shapes_2/ex_alpha_shapes_2.cpp
\example Alpha_shapes_2/ex_periodic_alpha_shapes_2.cpp
\example Alpha_shapes_2/ex_weighted_alpha_shapes_2.cpp
\example Alpha_shapes_2/ex_alpha_projection_traits.cpp
*/

View File

@ -0,0 +1,207 @@
206
39 498 19
57 502 -90
70 496 -75
606 495 76
25 492 -51
54 492 25
61 494 3
78 494 29
85 494 -47
101 485 -38
114 487 -39
119 487 13
126 490 -88
140 488 67
148 493 -19
598 485 -88
623 492 31
34 481 -8
163 480 94
169 475 -13
184 483 35
194 478 -18
337 482 45
354 478 -29
590 477 33
621 480 -69
25 471 -22
196 467 67
211 466 51
224 474 -13
234 466 -73
244 468 -29
246 474 -4
259 465 -49
267 466 -52
277 474 44
289 469 75
298 466 50
309 472 -26
316 467 -71
333 466 -87
363 465 34
367 465 42
576 474 -76
633 465 2
17 458 -77
383 455 -64
394 456 -66
578 456 13
617 459 -69
20 452 20
366 451 -51
413 454 12
423 450 -34
432 449 18
441 447 -54
567 452 -4
612 449 95
20 439 -86
380 436 -52
391 439 -18
399 444 -59
427 439 18
562 440 77
606 440 -9
17 426 65
433 431 21
453 431 -33
456 431 16
537 433 95
545 425 -5
605 433 28
17 417 30
424 422 -63
435 423 52
459 421 -66
532 421 -40
607 415 87
10 414 -32
419 406 72
438 412 -81
460 413 87
469 406 -78
524 410 30
609 412 -47
13 396 39
415 401 76
444 403 48
482 399 35
519 395 90
603 395 95
13 385 -82
417 390 -69
439 386 14
479 393 95
512 385 21
585 392 -20
-5 379 17
415 380 87
439 384 95
478 381 13
487 379 -17
499 380 23
584 378 -55
-2 367 19
419 371 -23
431 368 -22
585 367 78
10 356 -36
576 361 44
11 345 50
582 353 -17
9 342 31
579 335 71
16 331 -86
567 333 84
20 319 11
574 320 89
23 314 32
568 306 -52
22 299 80
582 302 28
25 290 -34
571 293 -89
31 280 -56
560 284 -39
34 268 32
547 270 22
42 259 77
45 263 20
553 263 18
48 248 -9
543 248 -97
58 237 -57
68 241 35
77 241 21
539 237 18
85 225 -87
525 229 0
536 233 82
103 221 56
106 224 -49
171 222 -35
176 220 -11
188 218 -77
526 219 -22
122 209 -27
132 209 34
144 212 -32
150 205 -94
164 209 81
202 213 -52
525 208 34
214 204 -53
452 197 -41
525 197 77
206 192 7
430 189 90
444 192 0
455 193 -15
469 190 10
484 189 -81
493 188 75
535 193 12
216 184 -39
259 183 10
363 175 -65
370 178 78
377 183 23
387 181 34
415 176 61
504 177 -20
511 177 84
536 181 -74
221 173 67
230 169 -92
243 166 3
249 171 -59
269 173 41
343 172 70
350 172 -54
404 167 23
410 170 -82
420 171 79
517 174 70
545 172 -23
274 158 56
342 156 -22
522 163 -33
553 155 -43
279 149 62
332 148 77
524 149 -25
548 146 38
275 140 -9
320 138 34
530 142 -50
547 139 24
286 127 13
296 132 72
319 130 -41
525 126 -25
538 131 -47
301 124 -56
305 117 0
321 119 -80

View File

@ -0,0 +1,146 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/algorithm.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <fstream>
#include <vector>
#include <list>
typedef double coord_type;
typedef CGAL::Simple_cartesian<coord_type> SC;
typedef CGAL::Filtered_kernel<SC> FK;
typedef CGAL::Projection_traits_xy_3<FK> K;
typedef K::Point_2 Point;
typedef K::Segment_2 Segment;
// -------------------------------------------------------------------
// Since K::Point_2 is here in fact CGAL::Point_3<FK>, the basic Cartesian_converter
// cannot be used (and thus ExactAlphaComparisonTag cannot be set to 'true') because
// it does not know how to convert from CGAL::Point_3<FK> to CGAL::Point_2<EK>.
// Thus, we must provide a specialization of Cartesian_converter to be able
// to set ExactAlphaComparisonTag to 'true'
namespace CGAL {
template < class K2, class C >
class Cartesian_converter<FK, K2, C>
{
public:
typedef CGAL::Projection_traits_xy_3<FK> Source_kernel;
typedef K2 Target_kernel;
typedef C Number_type_converter;
typedef typename Source_kernel::Point_2 SP2;
typedef typename Target_kernel::Point_2 TP2;
TP2 operator()(const SP2& p) const
{
return TP2(c(p.x()), c(p.y()));
}
private:
C c;
};
} // namespace CGAL
// The partial specialization must be defined before Alpha Shapes-related headers
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
// ExactAlphaComparisonTag is false
typedef K Gt;
typedef CGAL::Alpha_shape_vertex_base_2<Gt> Vb;
typedef CGAL::Alpha_shape_face_base_2<Gt> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_2<Gt,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
// ExactAlphaComparisonTag is true
typedef K Gt;
typedef CGAL::Alpha_shape_vertex_base_2<Gt,CGAL::Default,CGAL::Tag_true> Vb_TT;
typedef CGAL::Alpha_shape_face_base_2<Gt,CGAL::Default,CGAL::Tag_true> Fb_TT;
typedef CGAL::Triangulation_data_structure_2<Vb_TT,Fb_TT> Tds_TT;
typedef CGAL::Delaunay_triangulation_2<Gt,Tds_TT> Triangulation_2_TT;
typedef CGAL::Alpha_shape_2<Triangulation_2_TT,CGAL::Tag_true> Alpha_shape_2_TT;
template <class Alpha_shape,class InputIterator, class OutputIterator>
void alpha_edges(InputIterator begin, InputIterator end,
const typename Alpha_shape::FT& Alpha,
bool mode,
OutputIterator out)
{
typedef typename Alpha_shape::Alpha_shape_edges_iterator Alpha_shape_edges_iterator;
Alpha_shape A(begin,end);
if (mode) { A.set_mode(Alpha_shape::GENERAL); }
else { A.set_mode(Alpha_shape::REGULARIZED); }
A.set_alpha(Alpha);
for(Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin();
it != A.alpha_shape_edges_end(); ++it) {
*out++ = A.segment(*it);
}
}
template <class OutputIterator>
bool file_input(OutputIterator out)
{
std::ifstream is("./data/fin3", std::ios::in);
if(is.fail()) {
std::cerr << "unable to open file for input" << std::endl;
return false;
}
int n;
is >> n;
std::cout << "Reading " << n << " points from file" << std::endl;
CGAL::cpp11::copy_n(std::istream_iterator<Point>(is), n, out);
return true;
}
int main()
{
std::list<Point> points;
if(! file_input(std::back_inserter(points)))
return -1;
// ExactAlphaComparisonTag is False
{
std::vector<Segment> segments;
alpha_edges<Alpha_shape_2>(points.begin(), points.end(),
10000.,Alpha_shape_2::GENERAL,
std::back_inserter(segments));
std::cout << "Alpha Shape computed with ExactAlphaComparisonTag = false" << std::endl;
std::cout << segments.size() << " alpha shape edges" << std::endl;
}
// ExactAlphaComparisonTag is True
{
std::vector<Segment> segments;
alpha_edges<Alpha_shape_2_TT>(points.begin(), points.end(),
10000.,Alpha_shape_2_TT::GENERAL,
std::back_inserter(segments));
std::cout << "Alpha Shape computed with ExactAlphaComparisonTag = true" << std::endl;
std::cout << segments.size() << " alpha shape edges" << std::endl;
}
return 0;
}

View File

@ -1,47 +1,48 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/algorithm.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/algorithm.h>
#include <CGAL/assertions.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <iostream>
#include <list>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::FT FT;
typedef K::Point_2 Point;
typedef K::Segment_2 Segment;
typedef K::FT FT;
typedef K::Point_2 Point;
typedef K::Segment_2 Segment;
typedef CGAL::Alpha_shape_vertex_base_2<K> Vb;
typedef CGAL::Alpha_shape_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_2<K,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
typedef CGAL::Alpha_shape_vertex_base_2<K> Vb;
typedef CGAL::Alpha_shape_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_2<K,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
typedef Alpha_shape_2::Alpha_shape_edges_iterator Alpha_shape_edges_iterator;
typedef Alpha_shape_2::Alpha_shape_edges_iterator Alpha_shape_edges_iterator;
template <class OutputIterator>
void
alpha_edges( const Alpha_shape_2& A,
OutputIterator out)
void alpha_edges( const Alpha_shape_2& A, OutputIterator out)
{
for(Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin();
it != A.alpha_shape_edges_end();
++it){
Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin(),
end = A.alpha_shape_edges_end();
for( ; it!=end; ++it)
*out++ = A.segment(*it);
}
}
template <class OutputIterator>
bool
file_input(OutputIterator out)
bool file_input(OutputIterator out)
{
std::ifstream is("./data/fin", std::ios::in);
if(is.fail()){
if(is.fail())
{
std::cerr << "unable to open file for input" << std::endl;
return false;
}
@ -54,22 +55,20 @@ file_input(OutputIterator out)
return true;
}
// Reads a list of points and returns a list of segments
// corresponding to the Alpha shape.
int main()
{
std::list<Point> points;
if(! file_input(std::back_inserter(points))){
if(! file_input(std::back_inserter(points)))
return -1;
}
Alpha_shape_2 A(points.begin(), points.end(),
FT(10000),
Alpha_shape_2::GENERAL);
FT(10000),
Alpha_shape_2::GENERAL);
std::vector<Segment> segments;
alpha_edges( A, std::back_inserter(segments));
alpha_edges(A, std::back_inserter(segments));
std::cout << "Alpha Shape computed" << std::endl;
std::cout << segments.size() << " alpha shape edges" << std::endl;

View File

@ -0,0 +1,96 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h>
#include <CGAL/Periodic_2_Delaunay_triangulation_2.h>
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <fstream>
#include <iostream>
// Traits
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> Gt;
// Vertex type
typedef CGAL::Periodic_2_triangulation_vertex_base_2<Gt> Vb;
typedef CGAL::Alpha_shape_vertex_base_2<Gt, Vb> AsVb;
// Cell type
typedef CGAL::Periodic_2_triangulation_face_base_2<Gt> Cb;
typedef CGAL::Alpha_shape_face_base_2<Gt, Cb> AsCb;
typedef CGAL::Triangulation_data_structure_2<AsVb, AsCb> Tds;
typedef CGAL::Periodic_2_Delaunay_triangulation_2<Gt, Tds> P2DT2;
typedef CGAL::Alpha_shape_2<P2DT2> Alpha_shape_2;
typedef Gt::Point_2 Point;
typedef Gt::Segment_2 Segment;
typedef Alpha_shape_2::Alpha_shape_edges_iterator Alpha_shape_edges_iterator;
template <class OutputIterator>
void alpha_edges( const Alpha_shape_2& A, OutputIterator out)
{
Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin(),
end = A.alpha_shape_edges_end();
for( ; it!=end; ++it)
*out++ = A.segment(*it);
}
template <class OutputIterator>
bool file_input(OutputIterator out)
{
std::ifstream is("./data/fin", std::ios::in);
if(is.fail())
{
std::cerr << "unable to open file for input" << std::endl;
return false;
}
int n;
is >> n;
std::cout << "Reading " << n << " points from file" << std::endl;
CGAL::cpp11::copy_n(std::istream_iterator<Point>(is), n, out);
return true;
}
int main()
{
std::list<Point> points;
if(! file_input(std::back_inserter(points)))
return -1;
// Define the periodic square
P2DT2 pdt(Gt::Iso_rectangle_2(-10,-10, 700,700));
// Heuristic for inserting large point sets (if pts is reasonably large)
pdt.insert(points.begin(), points.end(), true);
// As pdt won't be modified anymore switch to 1-sheeted cover if possible
if(pdt.is_triangulation_in_1_sheet())
pdt.convert_to_1_sheeted_covering();
std::cout << "Periodic Delaunay computed." << std::endl;
// compute alpha shape
Alpha_shape_2 as(pdt);
std::cout << "Alpha shape computed in REGULARIZED mode by default." << std::endl;
// find optimal alpha values
Alpha_shape_2::NT alpha_solid = as.find_alpha_solid();
Alpha_shape_2::Alpha_iterator opt = as.find_optimal_alpha(1);
std::cout << "Smallest alpha value to get a solid through data points is " << alpha_solid << std::endl;
std::cout << "Optimal alpha value to get one connected component is " << *opt << std::endl;
as.set_alpha(*opt);
assert(as.number_of_solid_components() == 1);
as.set_alpha(10000);
std::vector<Segment> segments;
alpha_edges(as, std::back_inserter(segments));
std::cout << segments.size() << " alpha shape edges" << std::endl;
return 0;
}

View File

@ -1,98 +1,80 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Weighted_alpha_shape_euclidean_traits_2.h>
#include <CGAL/Regular_triangulation_2.h>
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <CGAL/Regular_triangulation_2.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <iostream>
#include <list>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::FT FT;
typedef K::Point_2 Point_base;
typedef K::Weighted_point_2 Point;
typedef CGAL::Weighted_alpha_shape_euclidean_traits_2<K> Gt;
typedef CGAL::Regular_triangulation_vertex_base_2<Gt> Rvb;
typedef CGAL::Alpha_shape_vertex_base_2<Gt,Rvb> Vb;
typedef CGAL::Regular_triangulation_face_base_2<Gt> Rf;
typedef CGAL::Alpha_shape_face_base_2<Gt, Rf> Fb;
typedef K::FT FT;
typedef K::Weighted_point_2 Weighted_point;
typedef K::Segment_2 Segment;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Regular_triangulation_2<Gt,Tds> Triangulation_2;
typedef CGAL::Regular_triangulation_vertex_base_2<K> Rvb;
typedef CGAL::Alpha_shape_vertex_base_2<K,Rvb> Vb;
typedef CGAL::Regular_triangulation_face_base_2<K> Rf;
typedef CGAL::Alpha_shape_face_base_2<K,Rf> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Regular_triangulation_2<K,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
typedef Alpha_shape_2::Alpha_shape_edges_iterator Alpha_shape_edges_iterator;
typedef Alpha_shape_2::Alpha_shape_edges_iterator Alpha_shape_edges_iterator;
template <class InputIterator, class OutputIterator>
void
alpha_edges(InputIterator begin, InputIterator end,
const FT &Alpha,
bool mode,
OutputIterator out)
// Generate Alpha Shape
template <class OutputIterator>
void alpha_edges(const Alpha_shape_2& A, OutputIterator out)
{
std::vector<Gt::Segment_2> V_seg;
Alpha_shape_2 A(begin,end);
if (mode)
{ A.set_mode(Alpha_shape_2::GENERAL); }
else
{ A.set_mode(Alpha_shape_2::REGULARIZED); };
A.set_alpha(Alpha);
for(Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin();
it != A.alpha_shape_edges_end();
++it){
Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin(),
end = A.alpha_shape_edges_end();
for( ; it!=end; ++it)
*out++ = A.segment(*it);
}
}
bool
file_input(std::list<Point>& L)
bool file_input(std::list<Weighted_point>& L)
{
std::ifstream is("./data/fin", std::ios::in);
std::ifstream is("./data/fin_weighted", std::ios::in);
if(is.fail())
{
std::cerr << "unable to open file for input" << std::endl;
return false;
}
CGAL::set_ascii_mode(is);
{
std::cerr << "unable to open file for input" << std::endl;
return false;
}
int n;
is >> n;
std::cout << "Reading " << n << " points" << std::endl;
for( ; n>0 ; n--)
{
Point_base p(0., 0.);
is >> p;
if(is) {
L.push_back(Point (p, FT(10)));
} else {
return false;
}
}
std::cout << "Points inserted" << std::endl;
for( ; n>0; n--)
{
Weighted_point wp;
is >> wp;
L.push_back(wp);
}
return true;
}
// Reads a list of points and returns a list of segments corresponding to
// the weighted Alpha Shape.
int main()
{
std::list<Point> points;
file_input(points);
std::vector<Gt::Segment_2> segments;
alpha_edges(points.begin(), points.end(),
FT(10000),Alpha_shape_2::GENERAL,
std::back_inserter(segments));
std::cout << segments.size() << " alpha shape edges." << std::endl;
std::list<Weighted_point> wpoints;
if(!file_input(wpoints))
return -1;
Alpha_shape_2 A(wpoints.begin(), wpoints.end(),
FT(10000),
Alpha_shape_2::GENERAL);
std::vector<Segment> segments;
alpha_edges(A, std::back_inserter(segments));
std::cout << "Alpha Shape computed" << std::endl;
std::cout << segments.size() << " alpha shape edges" << std::endl;
std::cout << "Optimal alpha: " << *A.find_optimal_alpha(1)<<std::endl;
return 0;
}

View File

@ -12,10 +12,6 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Tran Kai Frank DA
// Andreas Fabri <Andreas.Fabri@geometryfactory.com>
@ -24,31 +20,30 @@
#include <CGAL/license/Alpha_shapes_2.h>
#include <CGAL/basic.h>
#include <list>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <iostream>
#include <CGAL/utility.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Triangulation_vertex_base_2.h>
#include <CGAL/Triangulation_face_base_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/internal/Lazy_alpha_nt_2.h>
// for convenience only
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/assertions.h>
#include <CGAL/basic.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/utility.h>
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <utility>
#include <vector>
namespace CGAL {
template < class Dt,class ExactAlphaComparisonTag = Tag_false>
class Alpha_shape_2 : public Dt
class Alpha_shape_2 : public Dt
{
// DEFINITION The class Alpha_shape_2<Dt> represents the family
// of alpha-shapes of points in a plane for all positive alpha. It
@ -66,17 +61,33 @@ class Alpha_shape_2 : public Dt
public:
typedef Dt Triangulation;
typedef typename Dt::Geom_traits Gt;
typedef typename Gt::Compute_squared_radius_2 Compute_squared_radius_2;
typedef typename Dt::Triangulation_data_structure Tds;
typedef typename internal::Alpha_nt_selector_2<Gt,ExactAlphaComparisonTag>::Type_of_alpha Type_of_alpha;
//check simplices are correctly instantiated
CGAL_static_assertion( (boost::is_same<Type_of_alpha,typename Dt::Face::FT>::value) );
CGAL_static_assertion( (boost::is_same<Type_of_alpha,typename Dt::Vertex::FT>::value) );
// The Exact Comparison Tag cannot be used in conjonction with periodic triangulations
// because the periodic triangulations' point() function return a temporary
// value while the lazy predicate evaluations that are used when the Exact tag
// is set to true rely on a permanent and safe access to the points.
CGAL_static_assertion(
(boost::is_same<ExactAlphaComparisonTag, Tag_false>::value) ||
(boost::is_same<typename Dt::Periodic_tag, Tag_false>::value));
typedef Type_of_alpha NT;
typedef Type_of_alpha FT;
typedef typename Gt::Point_2 Point;
typedef typename internal::Alpha_nt_selector_2<
Gt, ExactAlphaComparisonTag, typename Dt::Weighted_tag>::Type_of_alpha Type_of_alpha;
typedef typename internal::Alpha_nt_selector_2<
Gt, ExactAlphaComparisonTag, typename Dt::Weighted_tag>::Compute_squared_radius_2 Compute_squared_radius_2;
typedef typename internal::Alpha_nt_selector_2<
Gt, ExactAlphaComparisonTag, typename Dt::Weighted_tag>::Side_of_bounded_circle_2 Side_of_bounded_circle_2;
typedef Type_of_alpha NT;
typedef Type_of_alpha FT;
// check that simplices are correctly instantiated
CGAL_static_assertion( (boost::is_same<NT, typename Dt::Face::NT>::value) );
CGAL_static_assertion( (boost::is_same<NT, typename Dt::Vertex::NT>::value) );
typedef typename Dt::Point Point;
typedef typename Gt::Point_2 Point_2;
typedef typename Gt::Segment_2 Segment;
typedef typename Gt::Line_2 Line;
@ -95,6 +106,8 @@ public:
typedef typename Dt::Locate_type Locate_type;
typedef typename Dt::size_type size_type;
using Dt::cw;
using Dt::ccw;
using Dt::finite_vertices_begin;
using Dt::finite_vertices_end;
using Dt::faces_begin;
@ -102,15 +115,16 @@ public:
using Dt::edges_begin;
using Dt::edges_end;
using Dt::number_of_vertices;
using Dt::cw;
using Dt::ccw;
using Dt::is_infinite;
using Dt::locate;
using Dt::point;
using Dt::VERTEX;
using Dt::EDGE;
using Dt::FACE;
using Dt::OUTSIDE_CONVEX_HULL;
using Dt::OUTSIDE_AFFINE_HULL;
using Dt::dimension;
using Dt::is_infinite;
// for backward compatibility
typedef Finite_vertices_iterator Vertex_iterator;
@ -264,7 +278,7 @@ public:
//----------- OUTPUT POINTS CONNECTED BY PAIRS ----------------------
std::list<Point> Output();
std::list<Point_2> Output();
std::ostream& op_ostream(std::ostream& os) const;
@ -594,7 +608,7 @@ public:
// Classifies a point `p' with respect to `A'.
Locate_type type;
int i;
Face_handle pFace = this->locate(p, type, i);
Face_handle pFace = locate(p, type, i);
switch (type)
{
case VERTEX : return classify(pFace->vertex(i), alpha);
@ -670,13 +684,13 @@ public:
const Type_of_alpha& alpha) const;
//--------------------- NB COMPONENTS ---------------------------------
int
size_type
number_solid_components() const
{
return number_of_solid_components(get_alpha());
}
int
size_type
number_of_solid_components() const
{
return number_of_solid_components(get_alpha());
@ -705,40 +719,33 @@ public:
Alpha_iterator find_optimal_alpha(size_type nb_components);
private:
Type_of_alpha find_alpha_solid() const;
//---------------------- PREDICATES ------------------------------------
private:
bool is_attached(const Face_handle& f, int i) const
{
Bounded_side b =
Gt().side_of_bounded_circle_2_object()(f->vertex(cw(i))->point(),
f->vertex(ccw(i))->point(),
f->vertex(i)->point());
return (b == ON_BOUNDED_SIDE) ? true : false;
}
bool is_attached(const Face_handle& f, int i) const
{
Bounded_side b = Side_of_bounded_circle_2()(*this)(point(f, cw(i)),
point(f, ccw(i)),
point(f, i));
return (b == ON_BOUNDED_SIDE);
}
//-------------------- GEOMETRIC PRIMITIVES ----------------------------
Type_of_alpha squared_radius(const Face_handle& f) const
{
return
Compute_squared_radius_2()(f->vertex(0)->point(),
f->vertex(1)->point(),
f->vertex(2)->point());
}
Type_of_alpha squared_radius(const Face_handle& f) const
{
return Compute_squared_radius_2()(*this)(point(f, 0), point(f, 1), point(f, 2));
}
Type_of_alpha squared_radius(const Face_handle& f, int i) const
{
return
Compute_squared_radius_2()(f->vertex(ccw(i))->point(),
f->vertex(cw(i))->point());
}
Type_of_alpha squared_radius(const Face_handle& f, int i) const
{
return Compute_squared_radius_2()(*this)(point(f, ccw(i)),
point(f, cw(i)));
}
//---------------------------------------------------------------------
@ -1473,241 +1480,220 @@ template < class Dt, class EACT >
std::ostream&
Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const
{
typedef typename Alpha_shape_2<Dt,EACT>::Interval_vertex_map
Interval_vertex_map ;
typedef typename Alpha_shape_2<Dt,EACT>::Interval_vertex_map Interval_vertex_map ;
typedef typename Alpha_shape_2<Dt,EACT>::Interval_edge_map Interval_edge_map;
typename Interval_vertex_map::const_iterator vertex_alpha_it;
const typename Alpha_shape_2<Dt,EACT>::Interval2* pInterval2;
Unique_hash_map< Vertex_handle , size_type > V;
size_type number_of_vertices = 0;
typedef typename Alpha_shape_2<Dt,EACT>::Interval_edge_map
Interval_edge_map;
typename Interval_edge_map::const_iterator edge_alpha_it;
const typename Alpha_shape_2<Dt,EACT>::Interval3* pInterval;
if (get_mode() == Alpha_shape_2<Dt,EACT>::REGULARIZED)
Unique_hash_map< Vertex_handle, size_type > V;
size_type number_of_vertices = 0;
if (get_mode() == Alpha_shape_2<Dt,EACT>::REGULARIZED)
{
typename Alpha_shape_2<Dt,EACT>::Vertex_handle v;
for (vertex_alpha_it = _interval_vertex_map.begin();
vertex_alpha_it != _interval_vertex_map.end() &&
(*vertex_alpha_it).first.first <= get_alpha();
++vertex_alpha_it)
{
typename Alpha_shape_2<Dt,EACT>::Vertex_handle v;
for (vertex_alpha_it = _interval_vertex_map.begin();
vertex_alpha_it != _interval_vertex_map.end() &&
(*vertex_alpha_it).first.first <= get_alpha();
++vertex_alpha_it)
{
pInterval2 = &(*vertex_alpha_it).first;
pInterval2 = &(*vertex_alpha_it).first;
#ifdef CGAL_DEBUG_ALPHA_SHAPE_2
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha =
get_alpha();
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_mid =
pInterval2->first;
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_max =
pInterval2->second;
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha =
get_alpha();
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_mid =
pInterval2->first;
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_max =
pInterval2->second;
#endif // CGAL_DEBUG_ALPHA_SHAPE_2
if((pInterval2->second > get_alpha()
|| pInterval2->second == Infinity))
{
// alpha must be larger than the min boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// write the vertex
if((pInterval2->second > get_alpha()
|| pInterval2->second == Infinity))
{
// alpha must be larger than the min boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// write the vertex
v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
// if we used Edelsbrunner and Muecke's definition
// regular means incident to a higher-dimensional face
// we would write too many vertices
v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
// if we used Edelsbrunner and Muecke's definition
// regular means incident to a higher-dimensional face
// we would write too many vertices
V[v] = number_of_vertices++;
os << v->point() << std::endl;
}
}
// the vertices are oriented counterclockwise
typename Alpha_shape_2<Dt,EACT>::Face_handle f;
int i;
for (edge_alpha_it = _interval_edge_map.begin();
edge_alpha_it != _interval_edge_map.end() &&
(*edge_alpha_it).first.first <= get_alpha();
++edge_alpha_it)
{
pInterval = &(*edge_alpha_it).first;
CGAL_triangulation_assertion(pInterval->second != Infinity);
// since this happens only for convex hull of dimension 1
// thus singular
if(pInterval->second <= get_alpha() &&
(pInterval->third > get_alpha()
|| pInterval->third == Infinity))
{
// alpha must be larger than the mid boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
f = (*edge_alpha_it).second.first;
i = (*edge_alpha_it).second.second;
// assure that all vertices are in ccw order
if (classify(f) == Alpha_shape_2<Dt,EACT>::EXTERIOR)
{
// take the reverse face
typename Alpha_shape_2<Dt,EACT>::Face_handle
pNeighbor = f->neighbor(i);
i = pNeighbor->index(f);
f = pNeighbor;
}
CGAL_triangulation_assertion((classify(f) ==
Alpha_shape_2<Dt,EACT>::INTERIOR));
CGAL_triangulation_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
os << V[f->vertex(f->ccw(i))] << ' '
<< V[f->vertex(f->cw(i))] << std::endl;
}
}
V[v] = number_of_vertices++;
os << v->point() << std::endl;
}
}
else
{ // get_mode() == GENERAL -----------------------------------------
// the vertices are oriented counterclockwise
typename Alpha_shape_2<Dt,EACT>::Vertex_handle v;
// write the regular vertices
typename Alpha_shape_2<Dt,EACT>::Face_handle f;
int i;
for (vertex_alpha_it = _interval_vertex_map.begin();
vertex_alpha_it != _interval_vertex_map.end() &&
(*vertex_alpha_it).first.first <= get_alpha();
++vertex_alpha_it)
{
for (edge_alpha_it = _interval_edge_map.begin();
edge_alpha_it != _interval_edge_map.end() &&
(*edge_alpha_it).first.first <= get_alpha();
++edge_alpha_it)
{
pInterval = &(*edge_alpha_it).first;
pInterval2 = &(*vertex_alpha_it).first;
CGAL_triangulation_assertion(pInterval->second != Infinity);
// since this happens only for convex hull of dimension 1
// thus singular
if((pInterval2->second > get_alpha()
|| pInterval2->second == Infinity))
{
// alpha must be larger than the min boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// write the vertex
if(pInterval->second <= get_alpha() &&
(pInterval->third > get_alpha()
|| pInterval->third == Infinity))
{
// alpha must be larger than the mid boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
V[v] = number_of_vertices++;
os << v->point() << std::endl;
}
}
// write the singular vertices
for (;
vertex_alpha_it != _interval_vertex_map.end();
++vertex_alpha_it)
{
v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::SINGULAR));
f = (*edge_alpha_it).second.first;
i = (*edge_alpha_it).second.second;
V[v] = number_of_vertices++;
os << v->point() << std::endl;
}
// the vertices are oriented counterclockwise
// assure that all vertices are in ccw order
if (classify(f) == Alpha_shape_2<Dt,EACT>::EXTERIOR)
{
// take the reverse face
typename Alpha_shape_2<Dt,EACT>::Face_handle
pNeighbor = f->neighbor(i);
i = pNeighbor->index(f);
f = pNeighbor;
}
typename Alpha_shape_2<Dt,EACT>::Face_handle f;
int i;
CGAL_triangulation_assertion((classify(f) ==
Alpha_shape_2<Dt,EACT>::INTERIOR));
for (edge_alpha_it = _interval_edge_map.begin();
edge_alpha_it != _interval_edge_map.end() &&
(*edge_alpha_it).first.first <= get_alpha();
++edge_alpha_it)
{
CGAL_triangulation_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
pInterval = &(*edge_alpha_it).first;
os << V[f->vertex(f->ccw(i))] << ' '
<< V[f->vertex(f->cw(i))] << std::endl;
}
}
}
else
{ // get_mode() == GENERAL -----------------------------------------
typename Alpha_shape_2<Dt,EACT>::Vertex_handle v;
// write the regular vertices
for (vertex_alpha_it = _interval_vertex_map.begin();
vertex_alpha_it != _interval_vertex_map.end() &&
(*vertex_alpha_it).first.first <= get_alpha();
++vertex_alpha_it)
{
pInterval2 = &(*vertex_alpha_it).first;
if((pInterval2->second > get_alpha()
|| pInterval2->second == Infinity))
{
// alpha must be larger than the min boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// write the vertex
v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
V[v] = number_of_vertices++;
os << v->point() << std::endl;
}
}
// write the singular vertices
for (;
vertex_alpha_it != _interval_vertex_map.end();
++vertex_alpha_it)
{
v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::SINGULAR));
V[v] = number_of_vertices++;
os << v->point() << std::endl;
}
// the vertices are oriented counterclockwise
typename Alpha_shape_2<Dt,EACT>::Face_handle f;
int i;
for (edge_alpha_it = _interval_edge_map.begin();
edge_alpha_it != _interval_edge_map.end() &&
(*edge_alpha_it).first.first <= get_alpha();
++edge_alpha_it)
{
pInterval = &(*edge_alpha_it).first;
#ifdef CGAL_DEBUG_ALPHA_SHAPE_2
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha =
get_alpha();
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_min =
pInterval->first;
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_mid =
pInterval->second;
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_max =
pInterval->third;
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha =
get_alpha();
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_min =
pInterval->first;
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_mid =
pInterval->second;
typename Alpha_shape_2<Dt,EACT>::Type_of_alpha alpha_max =
pInterval->third;
#endif // CGAL_DEBUG_ALPHA_SHAPE_2
if(pInterval->third > get_alpha()
|| pInterval->third == Infinity)
{
// if alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
f = (*edge_alpha_it).second.first;
i = (*edge_alpha_it).second.second;
if(pInterval->third > get_alpha()
|| pInterval->third == Infinity)
{
// if alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
f = (*edge_alpha_it).second.first;
i = (*edge_alpha_it).second.second;
// write the regular edges
if (pInterval->second != Infinity &&
pInterval->second <= get_alpha())
{
// write the regular edges
if (pInterval->second != Infinity &&
pInterval->second <= get_alpha())
{
CGAL_triangulation_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
// assure that all vertices are in ccw order
if (classify(f) == Alpha_shape_2<Dt,EACT>::EXTERIOR)
{
// take the reverse face
typename Alpha_shape_2<Dt,EACT>::Face_handle
pNeighbor = f->neighbor(i);
CGAL_triangulation_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
// assure that all vertices are in ccw order
if (classify(f) == Alpha_shape_2<Dt,EACT>::EXTERIOR)
{
// take the reverse face
typename Alpha_shape_2<Dt,EACT>::Face_handle
pNeighbor = f->neighbor(i);
i = pNeighbor->index(f);
f = pNeighbor;
}
CGAL_triangulation_assertion((classify(f) ==
Alpha_shape_2<Dt,EACT>::INTERIOR));
i = pNeighbor->index(f);
f = pNeighbor;
}
os << V[f->vertex(f->ccw(i))] << ' '
<< V[f->vertex(f->cw(i))] << std::endl;
}
else
{ // pInterval->second == Infinity ||
// pInterval->second >= get_alpha())
// pInterval->second == Infinity happens only for convex hull
// of dimension 1 thus singular
CGAL_triangulation_assertion((classify(f) ==
Alpha_shape_2<Dt,EACT>::INTERIOR));
// write the singular edges
if (pInterval->first != UNDEFINED)
{
CGAL_triangulation_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::SINGULAR));
os << V[f->vertex(f->ccw(i))] << ' '
<< V[f->vertex(f->cw(i))] << std::endl;
}
}
}
}
os << V[f->vertex(f->ccw(i))] << ' '
<< V[f->vertex(f->cw(i))] << std::endl;
}
else
{ // pInterval->second == Infinity ||
// pInterval->second >= get_alpha())
// pInterval->second == Infinity happens only for convex hull
// of dimension 1 thus singular
// write the singular edges
if (pInterval->first != UNDEFINED)
{
CGAL_triangulation_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::SINGULAR));
os << V[f->vertex(f->ccw(i))] << ' '
<< V[f->vertex(f->cw(i))] << std::endl;
}
}
}
}
}
return os;
}
@ -1720,151 +1706,141 @@ operator<<(std::ostream& os, const Alpha_shape_2<Dt>& A)
return A.op_ostream(os);
}
//-------------------------------------------------------------------
template < class Dt, class EACT >
std::list<typename Alpha_shape_2<Dt,EACT>::Point>
std::list<typename Alpha_shape_2<Dt,EACT>::Point_2>
Alpha_shape_2<Dt,EACT>::Output ()
{
typename Interval_edge_map::const_iterator edge_alpha_it;
const Interval3* pInterval;
std::list<Point> L;
std::list<Point_2> L;
if (get_mode() == REGULARIZED)
if (get_mode() == REGULARIZED)
{
// it is much faster looking at the sorted intervals
// than looking at all sorted faces
// alpha must be larger than the mid boundary
// and alpha is smaller than the upper boundary
for (edge_alpha_it = _interval_edge_map.begin();
edge_alpha_it != _interval_edge_map.end() &&
(*edge_alpha_it).first.first <= get_alpha();
++edge_alpha_it)
{
pInterval = &(*edge_alpha_it).first;
// it is much faster looking at the sorted intervals
// than looking at all sorted faces
// alpha must be larger than the mid boundary
// and alpha is smaller than the upper boundary
for (edge_alpha_it = _interval_edge_map.begin();
edge_alpha_it != _interval_edge_map.end() &&
(*edge_alpha_it).first.first <= get_alpha();
++edge_alpha_it)
{
pInterval = &(*edge_alpha_it).first;
if (pInterval->second != Infinity)
{
// since this happens only for convex hull of dimension 1
// thus singular
if (pInterval->second != Infinity)
{
// since this happens only for convex hull of dimension 1
// thus singular
if(pInterval->second <= get_alpha() &&
(pInterval->third > get_alpha()
|| pInterval->third == Infinity))
{
// alpha must be larger than the mid boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR));
// if we used Edelsbrunner and Muecke's definition
// regular means incident to a higher-dimensional face
// thus we would write to many vertices
L.push_back((segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.source());
L.push_back((segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.target());
}
}
}
if(pInterval->second <= get_alpha() &&
(pInterval->third > get_alpha()
|| pInterval->third == Infinity))
{
// alpha must be larger than the mid boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR));
// if we used Edelsbrunner and Muecke's definition
// regular means incident to a higher-dimensional face
// thus we would write to many vertices
L.push_back((this->segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.source());
L.push_back((this->segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.target());
}
}
}
else
{ // get_mode() == GENERAL
// draw the edges
for (edge_alpha_it = _interval_edge_map.begin();
edge_alpha_it != _interval_edge_map.end() &&
(*edge_alpha_it).first.first <= get_alpha();
++edge_alpha_it)
{
}
else
{ // get_mode() == GENERAL
// draw the edges
for (edge_alpha_it = _interval_edge_map.begin();
edge_alpha_it != _interval_edge_map.end() &&
(*edge_alpha_it).first.first <= get_alpha();
++edge_alpha_it)
{
pInterval = &(*edge_alpha_it).first;
pInterval = &(*edge_alpha_it).first;
if (pInterval->first == UNDEFINED)
{
if (pInterval->first == UNDEFINED)
{
CGAL_triangulation_assertion(pInterval->second != Infinity);
// since this happens only for convex hull of dimension 1
// thus singular
CGAL_triangulation_assertion(pInterval->second != Infinity);
// since this happens only for convex hull of dimension 1
// thus singular
if(pInterval->second <= get_alpha() &&
(pInterval->third > get_alpha()
|| pInterval->third == Infinity))
{
// alpha must be larger than the mid boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR));
L.push_back((segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.source());
L.push_back((segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.target());
}
}
else
{
if(pInterval->second <= get_alpha() &&
(pInterval->third > get_alpha()
|| pInterval->third == Infinity))
{
// alpha must be larger than the mid boundary
// and alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
if(pInterval->third > get_alpha()
|| pInterval->third == Infinity)
{
// if alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
CGAL_triangulation_assertion(((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR) ||
(classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
SINGULAR)));
L.push_back((segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.source());
L.push_back((segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.target());
}
}
CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR));
L.push_back((this->segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.source());
L.push_back((this->segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.target());
}
}
else
{
if(pInterval->third > get_alpha()
|| pInterval->third == Infinity)
{
// if alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
}
CGAL_triangulation_assertion(((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR) ||
(classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
SINGULAR)));
L.push_back((this->segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.source());
L.push_back((this->segment((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second))
.target());
}
}
}
}
return L;
}
template < class Dt, class EACT >
void
Alpha_shape_2<Dt,EACT>::print_edge_map() {
void Alpha_shape_2<Dt,EACT>::print_edge_map()
{
for (typename Interval_edge_map::iterator iemapit= _interval_edge_map.begin();
iemapit != _interval_edge_map.end(); ++iemapit) {
iemapit != _interval_edge_map.end(); ++iemapit) {
Interval3 interval = (*iemapit).first;
Edge edge = (*iemapit).second;
Point p1 = edge.first->vertex(cw(edge.second))->point();
Point p2 = edge.first->vertex(ccw(edge.second))->point();
std::cout << "[ (" << p1 << ") - (" << p2 << ") ] : "
<< interval.first << " "
<< interval.second << " " << interval.third << std::endl;
}
Edge edge = (*iemapit).second;
Point p1 = point(edge.first, cw(edge.second));
Point p2 = point(edge.first, ccw(edge.second));
std::cout << "[ (" << p1 << ") - (" << p2 << ") ] : "
<< interval.first << " "
<< interval.second << " " << interval.third << std::endl;
}
}
} //namespace CGAL

View File

@ -32,26 +32,32 @@
namespace CGAL {
template < class Gt, class Fb_ = Default,class ExactAlphaComparisonTag =Tag_false >
class Alpha_shape_face_base_2 : public Default::Get<Fb_, Triangulation_face_base_2<Gt> >::type
template <class Gt,
class Fb_ = Default,
class ExactAlphaComparisonTag = Tag_false,
class Weighted_tag = Tag_false>
class Alpha_shape_face_base_2
: public Default::Get<Fb_, Triangulation_face_base_2<Gt> >::type
{
typedef typename Default::Get<Fb_, Triangulation_face_base_2<Gt> >::type Fb;
typedef typename Fb::Triangulation_data_structure TDS;
public:
typedef TDS Triangulation_data_structure;
typedef typename TDS::Vertex_handle Vertex_handle;
typedef typename TDS::Face_handle Face_handle;
typedef typename internal::Alpha_nt_selector_2<Gt,ExactAlphaComparisonTag>::Type_of_alpha Type_of_alpha;
typedef Type_of_alpha FT;
typedef Triple<Type_of_alpha, Type_of_alpha, Type_of_alpha> Interval_3;
public:
typedef typename Fb::Vertex_handle Vertex_handle;
typedef typename Fb::Face_handle Face_handle;
template < typename TDS2 >
struct Rebind_TDS {
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
typedef Alpha_shape_face_base_2<Gt,Fb2,ExactAlphaComparisonTag> Other;
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
typedef Alpha_shape_face_base_2<
Gt, Fb2, ExactAlphaComparisonTag, Weighted_tag> Other;
};
typedef typename internal::Alpha_nt_selector_2<
Gt, ExactAlphaComparisonTag, Weighted_tag>::Type_of_alpha Type_of_alpha;
typedef Type_of_alpha NT;
typedef Type_of_alpha FT;
typedef Triple<Type_of_alpha, Type_of_alpha, Type_of_alpha> Interval_3;
private:
Interval_3 vec_edge[3];

View File

@ -32,54 +32,52 @@
namespace CGAL {
//-------------------------------------------------------------------
template <class Gt, class Vb_ = Default, class ExactAlphaComparisonTag = Tag_false >
class Alpha_shape_vertex_base_2 : public Default::Get<Vb_, Triangulation_vertex_base_2<Gt> >::type
template <class Gt,
class Vb_ = Default,
class ExactAlphaComparisonTag = Tag_false,
class Weighted_tag = Tag_false>
class Alpha_shape_vertex_base_2
: public Default::Get<Vb_, Triangulation_vertex_base_2<Gt> >::type
{
typedef typename Default::Get<Vb_, Triangulation_vertex_base_2<Gt> >::type Vb;
typedef typename Vb::Triangulation_data_structure TDS;
public:
typedef TDS Triangulation_data_structure;
typedef typename TDS::Vertex_handle Vertex_handle;
typedef typename TDS::Face_handle Face_handle;
typedef typename internal::Alpha_nt_selector_2<Gt,ExactAlphaComparisonTag>::Type_of_alpha Type_of_alpha;
typedef Type_of_alpha FT;
typedef std::pair< Type_of_alpha, Type_of_alpha > Interval2;
typedef typename Vb::Point Point;
public:
typedef typename Vb::Vertex_handle Vertex_handle;
typedef typename Vb::Face_handle Face_handle;
typedef typename Vb::Point Point;
template < typename TDS2 >
struct Rebind_TDS {
typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
typedef Alpha_shape_vertex_base_2 <Gt,Vb2,ExactAlphaComparisonTag> Other;
typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
typedef Alpha_shape_vertex_base_2<
Gt, Vb2, ExactAlphaComparisonTag, Weighted_tag> Other;
};
typedef typename internal::Alpha_nt_selector_2<
Gt, ExactAlphaComparisonTag, Weighted_tag>::Type_of_alpha Type_of_alpha;
typedef Type_of_alpha NT;
typedef std::pair< Type_of_alpha, Type_of_alpha > Interval2;
private:
Interval2 I;
public:
Alpha_shape_vertex_base_2()
: Vb()
{}
: Vb()
{}
Alpha_shape_vertex_base_2(const Point & p)
: Vb(p)
{}
: Vb(p)
{}
Alpha_shape_vertex_base_2(const Point & p, Face_handle f)
: Vb(p, f)
{}
: Vb(p, f)
{}
public:
inline Interval2 get_range()
{
return I;
}
inline void set_range(Interval2 Inter)
{
I = Inter;
}
inline Interval2 get_range() { return I; }
inline void set_range(Interval2 Inter) { I = Inter; }
};

View File

@ -12,10 +12,6 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Tran Kai Frank DA <Frank.Da@sophia.inria.fr>
// Andreas Fabri <Andreas.Fabri@geometryfactory.com>
@ -24,23 +20,23 @@
#include <CGAL/license/Alpha_shapes_2.h>
#include <CGAL/Regular_triangulation_euclidean_traits_2.h>
#define CGAL_DEPRECATED_HEADER "<CGAL/Weighted_alpha_shape_euclidean_traits_2.h>"
#define CGAL_DEPRECATED_MESSAGE_DETAILS \
"The kernel K can be used directly as traits since weighted points and "\
"the associated function objects are now part of the concept Kernel."
#include <CGAL/internal/deprecation_warning.h>
namespace CGAL {
//------------------ Traits class -------------------------------------
template< class K_ >
class Weighted_alpha_shape_euclidean_traits_2
: public K_
{
public:
Weighted_alpha_shape_euclidean_traits_2() { }
Weighted_alpha_shape_euclidean_traits_2(const K_& k) : K_(k) { }
};
#ifdef CGAL_NO_DEPRECATED_CODE
#error The class Weighted_alpha_shape_euclidean_traits_2<K> is deprecated in favor of Regular_triangulation_euclidean_traits_2<K>.
#endif
} // namespace CGAL
template< class R >
class Weighted_alpha_shape_euclidean_traits_2 : public
Regular_triangulation_euclidean_traits_2<R, typename R::FT>
{};
} //namespace CGAL
#endif //CGAL_WEIGHTED_ALPHA_SHAPE_EUCLIDEAN_TRAITS_2_H
#endif // CGAL_WEIGHTED_ALPHA_SHAPE_EUCLIDEAN_TRAITS_2_H

View File

@ -1,80 +0,0 @@
// Copyright (c) 1997 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Tran Kai Frank DA <Frank.Da@sophia.inria.fr>
#ifndef CGAL_SQUARED_RADIUS_SMALLEST_ORTHOGONALCIRCLE_FTC2_H
#define CGAL_SQUARED_RADIUS_SMALLEST_ORTHOGONALCIRCLE_FTC2_H
#include <CGAL/license/Alpha_shapes_2.h>
#include <CGAL/determinant.h>
#include <CGAL/enum.h>
//-------------------------------------------------------------------
namespace CGAL {
//-------------------------------------------------------------------
template< class FT >
CGAL_MEDIUM_INLINE
FT
squared_radius_orthogonalcircleC2(
const FT &px, const FT &py, const FT &pw,
const FT &qx, const FT &qy, const FT &qw,
const FT &rx, const FT &ry, const FT &rw)
{
FT FT4(4);
FT dpx = px-rx;
FT dpy = py-ry;
FT dqx = qx-rx;
FT dqy = qy-ry;
FT dpp = CGAL_NTS square(dpx)+CGAL_NTS square(dpy)-pw+rw;
FT dqq = CGAL_NTS square(dqx)+CGAL_NTS square(dqy)-qw+rw;
FT det0 = determinant(dpx, dpy, dqx, dqy);
FT det1 = determinant(dpp, dpy, dqq, dqy);
FT det2 = determinant(dpx, dpp, dqx, dqq);
return
(CGAL_NTS square(det1)+CGAL_NTS square(det2))/
(FT4*CGAL_NTS square(det0)) - rw;
}
template< class FT >
CGAL_MEDIUM_INLINE
FT
squared_radius_smallest_orthogonalcircleC2(
const FT &px, const FT &py, const FT &pw,
const FT &qx, const FT &qy, const FT &qw)
{
FT FT4(4);
FT dpz = CGAL_NTS square(px-qx)+CGAL_NTS square(py-qy);
return (CGAL_NTS square(dpz-pw+qw)/(FT4*dpz)-qw);
}
//-------------------------------------------------------------------
} //namespace CGAL
//-------------------------------------------------------------------
#endif //CGAL_SQUARED_RADIUS_SMALLEST_ORTHOGONALCIRCLE_ftC2_H

View File

@ -1,4 +1,4 @@
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// Copyright (c) 2012, 2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@ -12,215 +12,286 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sébastien Loriot <sebastien.loriot@geometryfactory.com>
// Mael Rouxel-Labbé
#ifndef CGAL_INTERNAL_LAZY_ALPHA_NT_2_H
#define CGAL_INTERNAL_LAZY_ALPHA_NT_2_H
#include <CGAL/license/Alpha_shapes_2.h>
#include <CGAL/number_type_basic.h>
#include <CGAL/internal/Exact_type_selector.h>
#include <CGAL/assertions.h>
#include <CGAL/Regular_triangulation_euclidean_traits_2.h>
#include <CGAL/internal/Exact_type_selector.h>
#include <CGAL/number_type_basic.h>
#include <CGAL/Cartesian_converter.h>
#include <boost/shared_ptr.hpp>
#include <CGAL/Has_conversion.h>
#include <boost/mpl/has_xxx.hpp>
#include <boost/type_traits.hpp>
#include <iostream>
namespace CGAL {
namespace internal{
namespace internal {
//non-weighted case
template <class Weighted_tag,class Input_traits,class Kernel_input,class Kernel_approx,class Kernel_exact>
// check whether Cartesian_converter can do the following conversions
// -- Input_traits::(Weighted_)Point_2 to K2::(Weighted_)Point_2
// -- Input_traits::(Weighted_)Point_2 to K3::(Weighted_)Point_2
//
template < class Input_traits, class Kernel_approx, class Kernel_exact,
class Weighted_tag >
class Is_traits_point_convertible
{
typedef typename Kernel_traits<typename Input_traits::Point_2>::Kernel Kernel_input;
typedef typename Input_traits::Point_2 K1P;
typedef typename Kernel_approx::Point_2 K2P;
typedef typename Kernel_exact::Point_2 K3P;
public:
static const bool value
= (Has_conversion<Kernel_input, Kernel_approx, K1P, K2P>::value &&
Has_conversion<Kernel_input, Kernel_exact, K1P, K3P>::value);
};
template < class Input_traits, class Kernel_approx, class Kernel_exact >
class Is_traits_point_convertible<Input_traits, Kernel_approx, Kernel_exact,
::CGAL::Tag_true /* Weighted_tag */>
{
typedef typename Kernel_traits<typename Input_traits::Point_2>::Kernel Kernel_input;
typedef typename Input_traits::Weighted_point_2 K1WP;
typedef typename Kernel_approx::Weighted_point_2 K2WP;
typedef typename Kernel_exact::Weighted_point_2 K3WP;
public:
static const bool value
= (Has_conversion<Kernel_input, Kernel_approx, K1WP, K2WP>::value &&
Has_conversion<Kernel_input, Kernel_exact, K1WP, K3WP>::value);
};
template <class T>
struct Input_points_for_lazy_alpha_nt_2
{
int nbpts;
const T* p0;
const T* p1;
const T* p2;
};
//non-weighted case
template <class Weighted_tag, class Input_traits, class Kernel_input,
class Kernel_approx, class Kernel_exact>
struct Types_for_alpha_nt_2
{
//Converter types
typedef CGAL::Cartesian_converter<Kernel_input,Kernel_approx> To_approx;
typedef CGAL::Cartesian_converter<Kernel_input,Kernel_exact> To_exact;
//Traits types
//Point types
typedef typename Kernel_approx::Point_2 Approx_point;
typedef typename Kernel_exact::Point_2 Exact_point;
typedef typename Kernel_input::Point_2 Input_point;
//Constructions
typedef typename Kernel_approx::Compute_squared_radius_2 Approx_squared_radius;
typedef typename Kernel_exact::Compute_squared_radius_2 Exact_squared_radius;
};
//weighted case
template <class Input_traits,class Kernel_input,class Kernel_approx,class Kernel_exact>
struct Types_for_alpha_nt_2< ::CGAL::Tag_true,Input_traits,Kernel_input,Kernel_approx,Kernel_exact>
{
//Converter types
typedef CGAL::Cartesian_converter<Kernel_input,Kernel_approx> To_approx;
typedef CGAL::Cartesian_converter<Kernel_input,Kernel_exact> To_exact;
//Traits types
typedef ::CGAL::Regular_triangulation_euclidean_traits_2<Kernel_approx> Approx_traits;
typedef ::CGAL::Regular_triangulation_euclidean_traits_2<Kernel_exact> Exact_traits;
//Point types
typedef typename Approx_traits::Weighted_point Approx_point;
typedef typename Exact_traits::Weighted_point Exact_point;
typedef typename Input_traits::Weighted_point Input_point;
//Constructions
typedef typename Approx_traits::Compute_squared_radius_2 Approx_squared_radius;
typedef typename Exact_traits::Compute_squared_radius_2 Exact_squared_radius;
//Converter types
typedef CGAL::Cartesian_converter<Kernel_input, Kernel_approx> To_approx;
typedef CGAL::Cartesian_converter<Kernel_input, Kernel_exact> To_exact;
//Point types
typedef typename Kernel_approx::Point_2 Approx_point;
typedef typename Kernel_exact::Point_2 Exact_point;
typedef typename Input_traits::Point_2 Input_point;
//Constructions
typedef typename Kernel_approx::Compute_squared_radius_2 Approx_squared_radius;
typedef typename Kernel_exact::Compute_squared_radius_2 Exact_squared_radius;
};
//weighted case
template <class Input_traits, class Kernel_input,
class Kernel_approx, class Kernel_exact>
struct Types_for_alpha_nt_2< ::CGAL::Tag_true /* Weighted_tag */,
Input_traits, Kernel_input,
Kernel_approx, Kernel_exact >
{
//Converter types
typedef CGAL::Cartesian_converter<Kernel_input, Kernel_approx> To_approx;
typedef CGAL::Cartesian_converter<Kernel_input, Kernel_exact> To_exact;
//Point types
typedef typename Kernel_approx::Weighted_point_2 Approx_point;
typedef typename Kernel_exact::Weighted_point_2 Exact_point;
typedef typename Input_traits::Weighted_point_2 Input_point;
//Constructions
typedef typename Kernel_approx::Compute_squared_radius_smallest_orthogonal_circle_2 Approx_squared_radius;
typedef typename Kernel_exact::Compute_squared_radius_smallest_orthogonal_circle_2 Exact_squared_radius;
};
template<class Input_traits, bool mode, class Weighted_tag>
class Lazy_alpha_nt_2{
//NT & kernels
typedef CGAL::Interval_nt<mode> NT_approx;
class Lazy_alpha_nt_2
{
//NT & kernels
typedef CGAL::Interval_nt<mode> NT_approx;
//Gmpq or Quotient<MP_float>
typedef Exact_field_selector<double>::Type NT_exact;
typedef CGAL::Simple_cartesian<NT_approx> Kernel_approx;
typedef CGAL::Simple_cartesian<NT_exact> Kernel_exact;
typedef typename Kernel_traits<typename Input_traits::Point_2>::Kernel Kernel_input;
//Helper class for weighted and non-weighted case
typedef Types_for_alpha_nt_2<Weighted_tag,Input_traits,Kernel_input,Kernel_approx,Kernel_exact> Types;
//Converters
typedef typename Types::To_approx To_approx;
typedef typename Types::To_exact To_exact;
//Constructions class
typedef typename Types::Approx_squared_radius Approx_squared_radius;
typedef typename Types::Exact_squared_radius Exact_squared_radius;
//Point
typedef typename Types::Approx_point Approx_point;
typedef typename Types::Exact_point Exact_point;
typedef typename Types::Input_point Input_point;
//Convertion functions
Approx_point to_approx(const Input_point& wp) const {
typedef Exact_field_selector<double>::Type NT_exact;
typedef CGAL::Simple_cartesian<NT_approx> Kernel_approx;
typedef CGAL::Simple_cartesian<NT_exact> Kernel_exact;
typedef typename Kernel_traits<typename Input_traits::Point_2>::Kernel Kernel_input;
//Helper class for weighted and non-weighted case
typedef Types_for_alpha_nt_2<Weighted_tag, Input_traits, Kernel_input,
Kernel_approx, Kernel_exact> Types;
//Converters
typedef typename Types::To_approx To_approx;
typedef typename Types::To_exact To_exact;
//Constructions class
typedef typename Types::Approx_squared_radius Approx_squared_radius;
typedef typename Types::Exact_squared_radius Exact_squared_radius;
//Point
typedef typename Types::Approx_point Approx_point;
typedef typename Types::Exact_point Exact_point;
typedef typename Types::Input_point Input_point;
//Convertion functions
Approx_point to_approx(const Input_point& wp) const
{
// The traits class' Point_2 must be convertible using the Cartesian converter
CGAL_static_assertion((Is_traits_point_convertible<
Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value));
To_approx converter;
return converter(wp);
}
Exact_point to_exact(const Input_point& wp) const {
Exact_point to_exact(const Input_point& wp) const
{
// The traits class' Point_2 must be convertible using the Cartesian converter
CGAL_static_assertion((Is_traits_point_convertible<
Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value));
To_exact converter;
return converter(wp);
}
//members
unsigned nb_pt;
//members
//the members can be updated when calling method exact()
mutable bool updated;
mutable NT_exact exact_;
mutable boost::optional<NT_exact> exact_;
mutable NT_approx approx_;
typedef std::vector<const Input_point*> Data_vector;
boost::shared_ptr<Data_vector> inputs_ptr;
//private functions
const Data_vector& data() const{ return *inputs_ptr;}
//private functions
typedef Input_points_for_lazy_alpha_nt_2<Input_point> Data_vector;
Data_vector input_points;
const Data_vector& data() const{ return input_points;}
Data_vector& data(){ return input_points;}
Data_vector&
data(){ return *inputs_ptr;}
public:
typedef NT_exact Exact_nt;
typedef NT_approx Approximate_nt;
void update_exact() const{
switch (nb_pt){
void update_exact() const
{
switch(data().nbpts) {
case 1:
exact_ = Exact_squared_radius()( to_exact(*data()[0]) );
break;
exact_ = Exact_squared_radius()( to_exact(*data().p0) );
break;
case 2:
exact_ = Exact_squared_radius()( to_exact(*data()[0]),to_exact(*data()[1]) );
break;
exact_ = Exact_squared_radius()( to_exact(*data().p0),to_exact(*data().p1) );
break;
case 3:
exact_ = Exact_squared_radius()( to_exact(*data()[0]),to_exact(*data()[1]),to_exact(*data()[2]) );
break;
exact_ = Exact_squared_radius()( to_exact(*data().p0),to_exact(*data().p1),to_exact(*data().p2) );
break;
default:
CGAL_assertion(false);
}
updated=true;
}
void set_approx(){
switch (nb_pt){
case 1:
approx_ = Approx_squared_radius()( to_approx(*data()[0]) );
break;
case 2:
approx_ = Approx_squared_radius()( to_approx(*data()[0]),to_approx(*data()[1]) );
break;
case 3:
approx_ = Approx_squared_radius()( to_approx(*data()[0]),to_approx(*data()[1]),to_approx(*data()[2]) );
break;
default:
CGAL_assertion(false);
}
}
const NT_exact& exact() const {
if (!updated){
void set_approx()
{
switch(data().nbpts) {
case 1:
approx_ = Approx_squared_radius()( to_approx(*data().p0) );
break;
case 2:
approx_ = Approx_squared_radius()( to_approx(*data().p0),to_approx(*data().p1) );
break;
case 3:
approx_ = Approx_squared_radius()( to_approx(*data().p0),to_approx(*data().p1),to_approx(*data().p2) );
break;
default:
CGAL_assertion(false);
}
}
const NT_exact& exact() const
{
if (exact_ == boost::none) {
update_exact();
approx_=to_interval(exact_);
approx_=to_interval(*exact_);
}
return exact_;
return *exact_;
}
const NT_approx& approx() const{
const NT_approx& approx() const {
return approx_;
}
//Constructors
Lazy_alpha_nt_2():nb_pt(0),updated(true),exact_(0),approx_(0){}
Lazy_alpha_nt_2(double d):nb_pt(0),updated(true),exact_(d),approx_(d){}
Lazy_alpha_nt_2(const Input_point& wp1):nb_pt(1),updated(false),inputs_ptr(new Data_vector())
//Constructors
Lazy_alpha_nt_2()
: exact_(Exact_nt(0)), approx_(0)
{
data().reserve(nb_pt);
data().push_back(&wp1);
data().nbpts=0;
data().p0=NULL;
data().p1=NULL;
data().p2=NULL;
}
Lazy_alpha_nt_2(double d)
: exact_(Exact_nt(d)), approx_(d)
{
data().nbpts=0;
data().p0=NULL;
data().p1=NULL;
data().p2=NULL;
}
Lazy_alpha_nt_2(const Input_point& wp0)
{
data().nbpts=1;
data().p0=&wp0;
data().p1=NULL;
data().p2=NULL;
set_approx();
}
Lazy_alpha_nt_2(const Input_point& wp1,
const Input_point& wp2):nb_pt(2),updated(false),inputs_ptr(new Data_vector())
Lazy_alpha_nt_2(const Input_point& wp0,
const Input_point& wp1)
{
data().reserve(nb_pt);
data().push_back(&wp1);
data().push_back(&wp2);
data().nbpts=2;
data().p0=&wp0;
data().p1=&wp1;
data().p2=NULL;
set_approx();
}
Lazy_alpha_nt_2(const Input_point& wp1,
const Input_point& wp2,
const Input_point& wp3):nb_pt(3),updated(false),inputs_ptr(new Data_vector())
Lazy_alpha_nt_2(const Input_point& wp0,
const Input_point& wp1,
const Input_point& wp2)
{
data().reserve(nb_pt);
data().push_back(&wp1);
data().push_back(&wp2);
data().push_back(&wp3);
data().nbpts=3;
data().p0=&wp0;
data().p1=&wp1;
data().p2=&wp2;
set_approx();
}
#define CGAL_LANT_COMPARE_FUNCTIONS(CMP) \
#define CGAL_LANT_COMPARE_FUNCTIONS(CMP) \
bool \
operator CMP (const Lazy_alpha_nt_2<Input_traits,mode,Weighted_tag> &other) const \
{ \
try{ \
return this->approx() CMP other.approx(); \
} \
catch(CGAL::Uncertain_conversion_exception&){ \
Uncertain<bool> res = this->approx() CMP other.approx(); \
if (res.is_certain()) \
return res; \
else \
return this->exact() CMP other.exact(); \
} \
} \
\
CGAL_LANT_COMPARE_FUNCTIONS(<)
CGAL_LANT_COMPARE_FUNCTIONS(>)
@ -229,74 +300,155 @@ public:
CGAL_LANT_COMPARE_FUNCTIONS(==)
CGAL_LANT_COMPARE_FUNCTIONS(!=)
#undef CGAL_LANT_COMPARE_FUNCTIONS
#undef CGAL_LANT_COMPARE_FUNCTIONS
};
template<class Input_traits, class Kernel_input, bool mode, class Weighted_tag>
template<class Input_traits, bool mode, class Weighted_tag>
std::ostream&
operator<< (std::ostream& os,const Lazy_alpha_nt_2<Input_traits,mode,Weighted_tag>& a){
operator<< (std::ostream& os,
const Lazy_alpha_nt_2<Input_traits, mode, Weighted_tag>& a){
return os << ::CGAL::to_double(a.approx());
}
template <class Type_of_alpha>
struct Lazy_compute_squared_radius_2 {
typedef typename Type_of_alpha::Input_point Point;
Type_of_alpha operator() (const Point& p,
const Point& q ,
const Point& r,
const Point& s)
{return Type_of_alpha(p,q,r,s);}
// small classes to select the functors in weighted or unweighted cases
template <class GeomTraits, class Weighted_tag>
struct iCompute_squared_radius_2;
Type_of_alpha operator() ( const Point& p,
const Point& q ,
const Point& r)
{return Type_of_alpha(p,q,r); }
Type_of_alpha operator() (const Point& p,
const Point& q )
{return Type_of_alpha(p,q); }
Type_of_alpha operator() (const Point& p)
{return Type_of_alpha(p);}
template <class GeomTraits>
struct iCompute_squared_radius_2<GeomTraits, Tag_false /* Weighted_tag*/>
{
template <class As>
typename GeomTraits::Compute_squared_radius_2
operator()(const As& as) const {
return static_cast<const typename As::Triangulation&>(as).geom_traits().
compute_squared_radius_2_object();
}
};
template <class GeomTraits>
struct iCompute_squared_radius_2<GeomTraits, Tag_true /* Weighted_tag*/>
{
template <class As>
typename GeomTraits::Compute_squared_radius_smallest_orthogonal_circle_2
operator()(const As& as) const {
return static_cast<const typename As::Triangulation&>(as).geom_traits().
compute_squared_radius_smallest_orthogonal_circle_2_object();
}
};
template <class GeomTraits,class ExactAlphaComparisonTag>
template <class GeomTraits, class Weighted_tag>
struct iSide_of_bounded_circle_2;
template <class GeomTraits>
struct iSide_of_bounded_circle_2<GeomTraits, Tag_false /* Weighted_tag*/>
{
template <class As>
typename GeomTraits::Side_of_bounded_circle_2
operator()(const As& as) const {
return static_cast<const typename As::Triangulation&>(as).geom_traits().
side_of_bounded_circle_2_object();
}
};
template <class GeomTraits>
struct iSide_of_bounded_circle_2<GeomTraits, Tag_true /* Weighted_tag*/>
{
template <class As>
typename GeomTraits::Power_side_of_bounded_power_circle_2
operator()(const As& as) const {
return static_cast<const typename As::Triangulation&>(as).geom_traits().
power_side_of_bounded_power_circle_2_object();
}
};
template <class Type_of_alpha, class Point>
struct Lazy_compute_squared_radius_2
{
Type_of_alpha operator()(const Point& p,
const Point& q,
const Point& r)
{ return Type_of_alpha(p,q,r); }
Type_of_alpha operator()(const Point& p,
const Point& q)
{ return Type_of_alpha(p,q); }
Type_of_alpha operator()(const Point& p)
{ return Type_of_alpha(p); }
};
template <class GeomTraits, class ExactAlphaComparisonTag, class Weighted_tag>
struct Alpha_nt_selector_impl_2;
template <class GeomTraits>
struct Alpha_nt_selector_impl_2<GeomTraits,Tag_false>
template <class GeomTraits, class Weighted_tag>
struct Alpha_nt_selector_impl_2<GeomTraits,
Tag_false /* ExactAlphaComparisonTag */,
Weighted_tag>
{
typedef typename GeomTraits::FT Type_of_alpha;
typedef typename GeomTraits::Compute_squared_radius_2 Compute_squared_radius_2;
typedef iCompute_squared_radius_2<GeomTraits, Weighted_tag> Compute_squared_radius_2;
typedef iSide_of_bounded_circle_2<GeomTraits, Weighted_tag> Side_of_bounded_circle_2;
};
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_typedef_Weighted_point,Weighted_point,false)
template <class GeomTraits, class Weighted_tag>
struct Alpha_nt_selector_impl_2<GeomTraits,
Tag_true /* ExactAlphaComparisonTag */,
Weighted_tag>
{
typedef Lazy_alpha_nt_2<
GeomTraits, true /* mode */, Tag_false /* Weighted_tag */> Type_of_alpha;
typedef Lazy_compute_squared_radius_2<
Type_of_alpha, typename GeomTraits::Point_2> Functor;
struct Compute_squared_radius_2
{
template<class As>
Functor operator()(const As&){return Functor();}
};
typedef iSide_of_bounded_circle_2<GeomTraits, Weighted_tag> Side_of_bounded_circle_2;
};
template <class GeomTraits>
struct Alpha_nt_selector_impl_2<GeomTraits,Tag_true>
struct Alpha_nt_selector_impl_2<GeomTraits,
Tag_true /* ExactAlphaComparisonTag */,
Tag_true /* Weighted_tag */ >
{
//This is not very satisfactory but we can improve it if some user complains.
typedef Boolean_tag<
Has_typedef_Weighted_point<GeomTraits>::value &&
!boost::is_same<
typename Kernel_traits<typename GeomTraits::Point_2>::Kernel::Compute_squared_radius_2,
typename GeomTraits::Compute_squared_radius_2 >::value
> Weighted_tag;
typedef Lazy_alpha_nt_2<GeomTraits,true,Weighted_tag> Type_of_alpha;
typedef Lazy_compute_squared_radius_2<Type_of_alpha> Compute_squared_radius_2;
typedef Lazy_alpha_nt_2<
GeomTraits, true /* mode */, Tag_true /* Weighted_tag */> Type_of_alpha;
typedef Lazy_compute_squared_radius_2<
Type_of_alpha, typename GeomTraits::Weighted_point_2> Functor;
struct Compute_squared_radius_2
{
template<class As>
Functor operator()(const As&){return Functor();}
};
typedef iSide_of_bounded_circle_2<GeomTraits, Tag_true> Side_of_bounded_circle_2;
};
template <class GeomTraits,class ExactAlphaComparisonTag>
struct Alpha_nt_selector_2:
public Alpha_nt_selector_impl_2<GeomTraits,
Boolean_tag< boost::is_floating_point<typename GeomTraits::FT>::value && ExactAlphaComparisonTag::value > >
{};
template <class GeomTraits, class ExactAlphaComparisonTag, class Weighted_tag>
struct Alpha_nt_selector_2
: public Alpha_nt_selector_impl_2<
GeomTraits,
// If the base traits is already exact then we don't need to do anything,
// and we can simply directly use the traits class
Boolean_tag<boost::is_floating_point<typename GeomTraits::FT>::value &&
ExactAlphaComparisonTag::value >,
Weighted_tag>
{ };
} // namespace internal
} //namespace internal
template<class Input_traits, bool mode, class Weighted_tag>
double to_double(const internal::Lazy_alpha_nt_2<Input_traits, mode, Weighted_tag>& a)
{
return to_double(a.approx());
}
} //namespace CGAL
} // namespace CGAL
#endif //CGAL_INTERNAL_LAZY_ALPHA_NT_2_H
#endif // CGAL_INTERNAL_LAZY_ALPHA_NT_2_H

View File

@ -1,56 +0,0 @@
// Copyright (c) 1997 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Tran Kai Frank DA <Frank.Da@sophia.inria.fr>
#ifndef CGAL_IN_SMALLEST_ORTHOGONALCIRCLE_FTC2_H
#define CGAL_IN_SMALLEST_ORTHOGONALCIRCLE_FTC2_H
#include <CGAL/license/Alpha_shapes_2.h>
#include <CGAL/determinant.h>
#include <CGAL/enum.h>
//-------------------------------------------------------------------
namespace CGAL {
//-------------------------------------------------------------------
template< class FT >
CGAL_MEDIUM_INLINE
Bounded_side
in_smallest_orthogonalcircleC2(const FT &px, const FT &py, const FT &pw,
const FT &qx, const FT &qy, const FT &qw,
const FT &tx, const FT &ty, const FT &tw)
{
FT dpx = px-qx;
FT dpy = py-qy;
FT dtx = tx-qx;
FT dty = ty-qy;
FT dpz = CGAL_NTS square(dpx)+CGAL_NTS square(dpy);
return Bounded_side
(CGAL_NTS sign(-(CGAL_NTS square(dtx)+CGAL_NTS square(dty)-tw+qw)*dpz
+(dpz-pw+qw)*(dpx*dtx+dpy*dty)));
}
//-------------------------------------------------------------------
} //namespace CGAL
//-------------------------------------------------------------------
#endif //CGAL_IN_SMALLEST_ORTHOGONALCIRCLEC2_H

View File

@ -0,0 +1,207 @@
206
39 498 19
57 502 -90
70 496 -75
606 495 76
25 492 -51
54 492 25
61 494 3
78 494 29
85 494 -47
101 485 -38
114 487 -39
119 487 13
126 490 -88
140 488 67
148 493 -19
598 485 -88
623 492 31
34 481 -8
163 480 94
169 475 -13
184 483 35
194 478 -18
337 482 45
354 478 -29
590 477 33
621 480 -69
25 471 -22
196 467 67
211 466 51
224 474 -13
234 466 -73
244 468 -29
246 474 -4
259 465 -49
267 466 -52
277 474 44
289 469 75
298 466 50
309 472 -26
316 467 -71
333 466 -87
363 465 34
367 465 42
576 474 -76
633 465 2
17 458 -77
383 455 -64
394 456 -66
578 456 13
617 459 -69
20 452 20
366 451 -51
413 454 12
423 450 -34
432 449 18
441 447 -54
567 452 -4
612 449 95
20 439 -86
380 436 -52
391 439 -18
399 444 -59
427 439 18
562 440 77
606 440 -9
17 426 65
433 431 21
453 431 -33
456 431 16
537 433 95
545 425 -5
605 433 28
17 417 30
424 422 -63
435 423 52
459 421 -66
532 421 -40
607 415 87
10 414 -32
419 406 72
438 412 -81
460 413 87
469 406 -78
524 410 30
609 412 -47
13 396 39
415 401 76
444 403 48
482 399 35
519 395 90
603 395 95
13 385 -82
417 390 -69
439 386 14
479 393 95
512 385 21
585 392 -20
-5 379 17
415 380 87
439 384 95
478 381 13
487 379 -17
499 380 23
584 378 -55
-2 367 19
419 371 -23
431 368 -22
585 367 78
10 356 -36
576 361 44
11 345 50
582 353 -17
9 342 31
579 335 71
16 331 -86
567 333 84
20 319 11
574 320 89
23 314 32
568 306 -52
22 299 80
582 302 28
25 290 -34
571 293 -89
31 280 -56
560 284 -39
34 268 32
547 270 22
42 259 77
45 263 20
553 263 18
48 248 -9
543 248 -97
58 237 -57
68 241 35
77 241 21
539 237 18
85 225 -87
525 229 0
536 233 82
103 221 56
106 224 -49
171 222 -35
176 220 -11
188 218 -77
526 219 -22
122 209 -27
132 209 34
144 212 -32
150 205 -94
164 209 81
202 213 -52
525 208 34
214 204 -53
452 197 -41
525 197 77
206 192 7
430 189 90
444 192 0
455 193 -15
469 190 10
484 189 -81
493 188 75
535 193 12
216 184 -39
259 183 10
363 175 -65
370 178 78
377 183 23
387 181 34
415 176 61
504 177 -20
511 177 84
536 181 -74
221 173 67
230 169 -92
243 166 3
249 171 -59
269 173 41
343 172 70
350 172 -54
404 167 23
410 170 -82
420 171 79
517 174 70
545 172 -23
274 158 56
342 156 -22
522 163 -33
553 155 -43
279 149 62
332 148 77
524 149 -25
548 146 38
275 140 -9
320 138 34
530 142 -50
547 139 24
286 127 13
296 132 72
319 130 -41
525 126 -25
538 131 -47
301 124 -56
305 117 0
321 119 -80

View File

@ -1,4 +1,3 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/algorithm.h>
@ -9,8 +8,10 @@
#include <vector>
#include <list>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <CGAL/Delaunay_triangulation_2.h>
typedef double coord_type;

View File

@ -1,118 +0,0 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/algorithm.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <fstream>
#include <vector>
#include <list>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Projection_traits_xy_3.h>
typedef double coord_type;
typedef CGAL::Simple_cartesian<coord_type> SC;
typedef CGAL::Filtered_kernel<SC> FK;
typedef CGAL::Projection_traits_xy_3<FK> K;
typedef K::Point_2 Point;
typedef K::Segment_2 Segment;
//ExactAlphaComparisonTag is false
typedef K Gt;
typedef CGAL::Alpha_shape_vertex_base_2<Gt> Vb;
typedef CGAL::Alpha_shape_face_base_2<Gt> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_2<Gt,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
//ExactAlphaComparisonTag is true
typedef K Gt;
typedef CGAL::Alpha_shape_vertex_base_2<Gt,CGAL::Default,CGAL::Tag_true> Vb_TT;
typedef CGAL::Alpha_shape_face_base_2<Gt,CGAL::Default,CGAL::Tag_true> Fb_TT;
typedef CGAL::Triangulation_data_structure_2<Vb_TT,Fb_TT> Tds_TT;
typedef CGAL::Delaunay_triangulation_2<Gt,Tds_TT> Triangulation_2_TT;
typedef CGAL::Alpha_shape_2<Triangulation_2_TT,CGAL::Tag_true> Alpha_shape_2_TT;
//---------------------------------------------------------------------
template <class Alpha_shape,class InputIterator, class OutputIterator>
void
alpha_edges(InputIterator begin, InputIterator end,
const typename Alpha_shape::FT &Alpha,
bool mode,
OutputIterator out)
{
typedef typename Alpha_shape::Alpha_shape_edges_iterator Alpha_shape_edges_iterator;
Alpha_shape A(begin,end);
if (mode)
{ A.set_mode(Alpha_shape::GENERAL); }
else
{ A.set_mode(Alpha_shape::REGULARIZED); };
A.set_alpha(Alpha);
for(Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin();
it != A.alpha_shape_edges_end();
++it){
*out++ = A.segment(*it);
}
}
//---------------------------------------------------------------------
template <class OutputIterator>
bool
file_input(OutputIterator out)
{
std::ifstream is("./data/fin3", std::ios::in);
if(is.fail()){
std::cerr << "unable to open file for input" << std::endl;
return false;
}
int n;
is >> n;
std::cout << "Reading " << n << " points from file" << std::endl;
CGAL::cpp11::copy_n(std::istream_iterator<Point>(is), n, out);
return true;
}
//------------------ main -------------------------------------------
int main()
{
std::list<Point> points;
if(! file_input(std::back_inserter(points))){
return -1;
}
//ExactAlphaComparisonTag is False
{
std::vector<Segment> segments;
alpha_edges<Alpha_shape_2>(points.begin(), points.end(),
10000.,Alpha_shape_2::GENERAL,
std::back_inserter(segments));
std::cout << segments.size() << " alpha shape edges" << std::endl;
std::cout << "Alpha Shape computed" << std::endl;
}
//ExactAlphaComparisonTag is True
{
std::vector<Segment> segments;
alpha_edges<Alpha_shape_2_TT>(points.begin(), points.end(),
10000.,Alpha_shape_2_TT::GENERAL,
std::back_inserter(segments));
std::cout << segments.size() << " alpha shape edges" << std::endl;
std::cout << "Alpha Shape computed" << std::endl;
}
return 0;
}

View File

@ -1,141 +1,145 @@
/***********************************************************************
Takes a list of points and returns a list of segments corresponding to
the weighted Alpha Shape.
Takes a list of weighted points and returns a list of segments
corresponding to the weighted Alpha Shape.
************************************************************************/
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <CGAL/Regular_triangulation_2.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <fstream>
#include <vector>
#include <iostream>
#include <list>
#include <vector>
#include <CGAL/Regular_triangulation_2.h>
#include <CGAL/Alpha_shape_2.h>
typedef double coord_type;
typedef CGAL::Simple_cartesian<coord_type> SC;
typedef CGAL::Filtered_kernel<SC> K;
typedef K::Point_2 Point;
typedef K::Weighted_point_2 Weighted_point;
typedef K::Segment_2 Segment;
typedef K::Line_2 Line;
typedef K::Triangle_2 Triangle;
typedef double coord_type;
typedef CGAL::Simple_cartesian<coord_type> SC;
typedef CGAL::Filtered_kernel<SC> K;
typedef K::Point_2 Point_base;
typedef K::Weighted_point_2 Point;
typedef K::Segment_2 Segment;
typedef K::Line_2 Line;
typedef K::Triangle_2 Triangle;
typedef K Gt;
typedef CGAL::Regular_triangulation_vertex_base_2<Gt> Rvb;
typedef CGAL::Regular_triangulation_face_base_2<Gt> Rf;
typedef K Gt;
typedef CGAL::Regular_triangulation_vertex_base_2<Gt> Rvb;
typedef CGAL::Regular_triangulation_face_base_2<Gt> Rf;
//ExactComparisonTag is Tag_false
typedef CGAL::Alpha_shape_vertex_base_2<Gt,Rvb> Vb;
typedef CGAL::Alpha_shape_face_base_2<Gt, Rf> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Regular_triangulation_2<Gt,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
typedef CGAL::Alpha_shape_vertex_base_2<Gt,Rvb> Vb;
typedef CGAL::Alpha_shape_face_base_2<Gt, Rf> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Regular_triangulation_2<Gt,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2> Alpha_shape_2;
//ExactComparisonTag is Tag_true
typedef CGAL::Alpha_shape_vertex_base_2<Gt,Rvb,CGAL::Tag_true> Vb_TT;
typedef CGAL::Alpha_shape_face_base_2<Gt, Rf,CGAL::Tag_true> Fb_TT;
typedef CGAL::Triangulation_data_structure_2<Vb_TT,Fb_TT> Tds_TT;
typedef CGAL::Regular_triangulation_2<Gt,Tds_TT> Triangulation_2_TT;
typedef CGAL::Alpha_shape_2<Triangulation_2_TT,CGAL::Tag_true> Alpha_shape_2_TT;
typedef CGAL::Alpha_shape_vertex_base_2<Gt,Rvb,
CGAL::Tag_true /* exact */,
CGAL::Tag_true /* weighted */> Vb_TT;
typedef CGAL::Alpha_shape_face_base_2<Gt, Rf,
CGAL::Tag_true /* exact */,
CGAL::Tag_true /* weighted */> Fb_TT;
typedef CGAL::Triangulation_data_structure_2<Vb_TT,Fb_TT> Tds_TT;
typedef CGAL::Regular_triangulation_2<Gt,Tds_TT> Triangulation_2_TT;
typedef CGAL::Alpha_shape_2<Triangulation_2_TT,CGAL::Tag_true> Alpha_shape_2_TT;
typedef Alpha_shape_2::Face Face;
typedef Alpha_shape_2::Vertex Vertex;
typedef Alpha_shape_2::Edge Edge;
typedef Alpha_shape_2::Face_handle Face_handle;
typedef Alpha_shape_2::Vertex_handle Vertex_handle;
typedef Alpha_shape_2::Face Face;
typedef Alpha_shape_2::Vertex Vertex;
typedef Alpha_shape_2::Edge Edge;
typedef Alpha_shape_2::Face_handle Face_handle;
typedef Alpha_shape_2::Vertex_handle Vertex_handle;
typedef Alpha_shape_2::Face_circulator Face_circulator;
typedef Alpha_shape_2::Face_circulator Face_circulator;
typedef Alpha_shape_2::Vertex_circulator Vertex_circulator;
typedef Alpha_shape_2::Locate_type Locate_type;
typedef Alpha_shape_2::Locate_type Locate_type;
typedef Alpha_shape_2::Face_iterator Face_iterator;
typedef Alpha_shape_2::Vertex_iterator Vertex_iterator;
typedef Alpha_shape_2::Edge_iterator Edge_iterator;
typedef Alpha_shape_2::Edge_circulator Edge_circulator;
typedef Alpha_shape_2::Face_iterator Face_iterator;
typedef Alpha_shape_2::Vertex_iterator Vertex_iterator;
typedef Alpha_shape_2::Edge_iterator Edge_iterator;
typedef Alpha_shape_2::Edge_circulator Edge_circulator;
typedef Alpha_shape_2::Alpha_iterator Alpha_iterator;
//---------------------------------------------------------------------
typedef Alpha_shape_2::Alpha_iterator Alpha_iterator;
template <class Alpha_shape,class InputIterator, class OutputIterator>
void
alpha_edges(InputIterator begin, InputIterator end,
const typename Alpha_shape::FT& Alpha,
bool mode,
OutputIterator out)
// Generate Alpha Shape
void alpha_edges(InputIterator begin, InputIterator end,
const typename Alpha_shape::FT& Alpha,
bool mode,
OutputIterator out)
{
typedef typename Alpha_shape::Alpha_shape_edges_iterator Alpha_shape_edges_iterator;
std::vector<Segment> V_seg;
Alpha_shape A(begin,end);
if (mode)
{ A.set_mode(Alpha_shape::GENERAL); }
else
{ A.set_mode(Alpha_shape::REGULARIZED); };
// Generate Alpha Shape
Alpha_shape A(begin, end);
if (mode) {
A.set_mode(Alpha_shape::GENERAL);
} else {
A.set_mode(Alpha_shape::REGULARIZED);
}
A.set_alpha(Alpha);
for(Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin();
it != A.alpha_shape_edges_end();
++it){
*out++ = A.segment(*it);
}
Alpha_shape_edges_iterator eit = A.alpha_shape_edges_begin(),
eend = A.alpha_shape_edges_end();
for( ; eit!=eend; ++eit)
*out++ = A.segment(*eit);
}
//---------------------------------------------------------------------
bool
file_input(std::list<Point>& L)
bool file_input(std::list<Weighted_point>& L)
{
std::ifstream is("./data/fin", std::ios::in);
std::ifstream is("./data/fin_weighted", std::ios::in);
if(is.fail())
{
std::cerr << "unable to open file for input" << std::endl;
return false;
}
CGAL::set_ascii_mode(is);
{
std::cerr << "unable to open file for input" << std::endl;
return false;
}
int n;
is >> n;
std::cout << "Reading " << n << " points" << std::endl;
Point_base p(1,2,3);
Weighted_point wp;
for( ; n>0 ; n--)
{
is >> p;
L.push_back(Point (p,coord_type(10)));
}
{
is >> wp;
L.push_back(wp);
}
std::cout << "Points inserted" << std::endl;
return true;
}
//------------------ main -------------------------------------------
//------------------ main -------------------------------------------
int main()
{
std::list<Point> points;
file_input(points);
std::list<Weighted_point> wpoints;
if(!file_input(wpoints))
return -1;
//ExactComparisonTag is Tag_false
{
std::vector<Segment> segments;
alpha_edges<Alpha_shape_2>(points.begin(), points.end(),
alpha_edges<Alpha_shape_2>(wpoints.begin(), wpoints.end(),
10000.,Alpha_shape_2::GENERAL,
std::back_inserter(segments));
std::cout << segments.size() << " alpha shape edges." << std::endl;
}
//ExactComparisonTag is Tag_true
{
std::vector<Segment> segments;
alpha_edges<Alpha_shape_2_TT>(points.begin(), points.end(),
alpha_edges<Alpha_shape_2_TT>(wpoints.begin(), wpoints.end(),
10000.,Alpha_shape_2_TT::GENERAL,
std::back_inserter(segments));
std::cout << segments.size() << " alpha shape edges." << std::endl;

View File

@ -8,9 +8,15 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0053)
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
find_package(CGAL COMPONENTS Qt5)
include(${CGAL_USE_FILE})

View File

@ -51,7 +51,7 @@ MainWindow::open_file()
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Points File"),
"./data",
tr("pts files (*.pts)"));
tr("pts files (*.pts)"));
if(! fileName.isEmpty()){
open(fileName);

View File

@ -2,6 +2,7 @@
#define VIEWER_H
#include "typedefs.h"
#include <QMap>
#include <QGLViewer/qglviewer.h>
#include <QOpenGLFunctions_2_1>
#include <QOpenGLVertexArrayObject>

View File

@ -10,8 +10,8 @@ namespace CGAL {
\image html alphashape.png
\image latex alphashape.png
Assume we are given a set \f$ S\f$ of points in 2D or 3D and we'd like to
have something like "the shape formed by these points." This is
Assume we are given a set \f$ S\f$ of points in 2D or 3D and we would like to
have something like "the shape formed by these points". This is
quite a vague notion and there are probably many possible
interpretations, the alpha shape being one of them. Alpha shapes
can be used for shape reconstruction from a dense unorganized set of
@ -22,27 +22,26 @@ As mentioned in Edelsbrunner's and M&uuml;cke's paper \cgalCite{em-tdas-94},
one can intuitively think of an alpha shape as the
following. Imagine a huge mass of ice-cream making up the space \f$ \mathbb{R}^3\f$
and containing the points as "hard" chocolate pieces. Using one of
those sphere-formed ice-cream spoons we carve out all parts of the
those sphere-formed ice-cream spoons, we carve out all parts of the
ice-cream block we can reach without bumping into chocolate pieces,
thereby even carving out holes in the inside (e.g. parts not reachable
by simply moving the spoon from the outside). We will eventually end
up with a (not necessarily convex) object bounded by caps, arcs and
points. If we now straighten all "round" faces to triangles and line
segments, we have an intuitive description of what is called the
alpha shape of \f$ S\f$. Here's an example for this process in 2D (where
our ice-cream spoon is simply a circle):
alpha shape of \f$ S\f$. The drawing above provides an example
of this process in 2D (where our ice-cream spoon is simply a circle).
Alpha shapes depend on a parameter \f$ \alpha\f$ from which they
are named.
What is \f$ \alpha\f$ in the ice-cream game? \f$ \alpha\f$ is the squared radius of the
Alpha shapes depend on a parameter \f$ \alpha\f$ after which they are named.
In the ice-cream analogy above, \f$ \alpha\f$ is the squared radius of the
carving spoon. A very small value will allow us to eat up all of the
ice-cream except the chocolate points themselves. Thus we already see
that the alpha shape degenerates to the point-set \f$ S\f$ for
\f$ \alpha \rightarrow 0\f$. On the other hand, a huge value of \f$ \alpha\f$
will prevent us even from moving the spoon between two points since
it's way too large. So we will never spoon up ice-cream lying in the
inside of the convex hull of \f$ S\f$, and hence the alpha shape for
\f$ \alpha \rightarrow \infty\f$ is the convex hull of \f$ S\f$.
it is too large and we will never spoon up the ice-cream lying in the
inside of the convex hull of \f$ S\f$. Hence, the alpha shape becomes
the convex hull of \f$ S\f$ as \f$ \alpha \rightarrow \infty\f$.
\cgal offers 2D and 3D alpha shapes. The GUDHI library offers a
<a href="http://gudhi.gforge.inria.fr/doc/latest/group__alpha__complex.html"> dD Alpha complex</a>.
@ -50,12 +49,11 @@ inside of the convex hull of \f$ S\f$, and hence the alpha shape for
\section Alpha_shapes_3Definitions Definitions
More precisely, the definition of alpha shapes is based on an underlying
triangulation that may be a Delaunay triangulation
in case of basic alpha shapes
or a regular triangulation
(cf. Section \ref Triangulation3secclassRegulartriangulation "Regular Triangulations")
in case of weighted alpha shapes.
We distinguish two versions of alpha shapes. <I>Basic alpha shapes</I>
are based on the Delaunay triangulation. <I>Weighted alpha shapes</I>
are based on its generalization, the regular triangulation
(cf. Section \ref Triangulation3secclassRegulartriangulation "Regular Triangulations"),
replacing the euclidean distance by the power to weighted points.
Let us consider the basic case with a Delaunay triangulation.
We first define the alpha complex of the set of points \f$ S\f$.
@ -64,13 +62,12 @@ of the Delaunay triangulation.
For a given value of \f$ \alpha\f$, the alpha complex includes
all the simplices in the Delaunay triangulation which have
an empty circumscribing sphere with squared radius equal or smaller than \f$ \alpha\f$.
Here "empty" means that the open sphere
do not include any points of \f$ S\f$.
Here "empty" means that the open sphere does not include any points of \f$ S\f$.
The alpha shape is then simply the domain covered by the simplices
of the alpha complex (see \cgalCite{em-tdas-94}).
In general, an alpha complex is a disconnected and non-pure complex:
This means in particular that the alpha complex may have
In general, an alpha complex is a disconnected and non-pure complex,
meaning in particular that the alpha complex may have
singular faces. For \f$ 0 \leq k \leq d-1\f$,
a \f$ k\f$-simplex of the alpha complex is said to be
singular if it is not a facet of a \f$ (k+1)\f$-simplex of the complex.
@ -102,18 +99,18 @@ faces of the triangulation of a set of points.
In this filtration, the faces of the triangulation are output
in increasing order of the alpha value
for which they appear
in the alpha complex. In case of equal alpha value
in the alpha complex. In case of equal alpha values,
lower dimensional faces are output first.
The definition is analog in the case of weighted alpha shapes.
The input set is now a set of weighted points (which can be regarded
as spheres) and the underlying triangulation
is the regular triangulation of this set.
Two spheres, or two weighted points , with centers \f$ C_1, C_2\f$
Two spheres, or two weighted points, with centers \f$ C_1, C_2\f$
and radii \f$ r_1, r_2 \f$ are said to be orthogonal iff
\f$ C_1C_2 ^2 = r_1^2 + r_2^2\f$ and suborthogonal
iff \f$ C_1C_2 ^2 < r_1^2 + r_2^2\f$.
For a given value of \f$ \alpha\f$
For a given value of \f$ \alpha\f$,
the weighted alpha complex is formed with the simplices of the
regular triangulation triangulation
such that there is a sphere orthogonal to the weighted points associated
@ -133,12 +130,14 @@ of the set, and associates to each \f$ k\f$-face of this triangulation
an interval specifying
for which values of \f$ \alpha\f$ the face belongs to the
alpha complex.
The second template parameter, `ExactAlphaComparisonTag`, is a tag that,
when set to CGAL::Tag_true, triggers exact comparisons between alpha values.
The class provides functions to set and
get the current \f$ \alpha\f$-value, as well as an iterator that enumerates
the \f$ \alpha\f$ values where the alpha shape changes.
Also the class has a filtration member function that, given
Additionally, the class has a filtration member function that, given
an output iterator with `Object`
as value type, outputs the faces of the triangulation
according to the
@ -146,12 +145,12 @@ order of apparition in the alpha complex when alpha increases.
Finally, it provides a function to determine
the smallest value \f$ \alpha\f$
such that the alpha shape satisfies the following two properties
(i) all data points are either on the boundary or in the interior
of the regularized version of the alpha shape (no singular faces).
(ii) The number of components is equal or less than a given number.
such that the alpha shape satisfies the following two properties: <br>
<ol>
<li> All data points are either on the boundary or in the interior
of the regularized version of the alpha shape (no singular faces).
<li> The number of components is equal or less than a given number.
</ol>
The current implementation is static, that is after its construction
points cannot be inserted or removed.
@ -199,38 +198,37 @@ We currently do not specify concepts for the underlying triangulation
type. Models that work for a family of alpha-shapes are the instantiations
of the classes `Delaunay_triangulation_3` and
`Periodic_3_Delaunay_triangulation_3` (see
example \ref AlphaShape_3DExampleForPeriodicAlphaShapes). A model that works for a fixed alpha-shape are the instantiations
example \ref AlphaShape_3DExampleForPeriodicAlphaShapes).
A model that works for a fixed alpha-shape are the instantiations
of the class `Delaunay_triangulation_3`.
A model that works for a weighted alpha-shape is
the class `Regular_triangulation_3`. The triangulation needs a geometric traits class
Models that work for a weighted alpha-shape are the instantiations
of the classes `Regular_triangulation_3` and
`Periodic_3_regular_triangulation_3`.
The triangulation needs a geometric traits class
and a triangulation data structure as template parameters.
\subsection AlphaShape3D_ConceptAndModelsAlphaShapes Alpha Shapes
For the class `Alpha_shape_3<Dt,ExactAlphaComparisonTag>`, the requirements of
the traits class are described in the concepts `AlphaShapeTraits_3`
in the non-weighted case and `WeightedAlphaShapeTraits_3` in the weighted case.
The \cgal kernels are models in the non-weighted case, and
the class `Regular_triangulation_euclidean_traits_3` is a model
in the weighted case.
All \cgal kernels are models of both concepts.
The triangulation data structure of the triangulation
has to be a model of the concept `TriangulationDataStructure_3`,
and it must be parameterized with vertex and cell classes, which are model of the concepts
`AlphaShapeVertex_3` and `AlphaShapeCell_3`.
The package provides by default the classes
`Alpha_shape_vertex_base_3<Gt>` and
`Alpha_shape_cell_base_3<Gt>`. When using
`Periodic_3_Delaunay_triangulation_3` as underlying
triangulation the vertex and cell classes need to be models to both
`AlphaShapeVertex_3` and
`Periodic_3TriangulationDSVertexBase_3` as well as
`AlphaShapeCell_3` and `Periodic_3TriangulationDSCellBase_3`
(see example \ref AlphaShape_3DExampleForPeriodicAlphaShapes).
The classes `Alpha_shape_vertex_base_3<Gt>` and `Alpha_shape_cell_base_3<Gt>`
are models of these concepts and can be used for all type of alpha shapes,
provided that the template parameters `Vb` and `Fb` are appropriately chosen,
as we shall see in the following section.
\subsection AlphaShape3D_ConceptAndModelsFixedAlphaShapes Fixed Alpha Shapes
For the class `Fixed_alpha_shape_3<Dt>`, the requirements of
the traits class are described in the concepts `FixedAlphaShapeTraits_3`
in the non-weighted case and `FixedWeightedAlphaShapeTraits_3` in the weighted case.
The \cgal kernels are models in the non-weighted case, and
the class `Regular_triangulation_euclidean_traits_3` is a model
in the weighted case.
All \cgal kernels are models of both concepts.
The triangulation data structure of the triangulation
has to be a model of the concept `TriangulationDataStructure_3`,
and it must be parameterized with vertex and cell classes, which are model of the concepts
@ -238,14 +236,32 @@ and it must be parameterized with vertex and cell classes, which are model of th
The package provides models `Fixed_alpha_shape_vertex_base_3<Gt>`
and `Fixed_alpha_shape_cell_base_3<Gt>`, respectively.
\subsection AlphaShape3D_ConceptAndModelsTDS Triangulation data structure
Additional requirements are put when using weighted or
periodic triangulations as underlying triangulation:
<ul>
<li> When using a weighted triangulation (`Regular_triangulation_3` or
`Periodic_3_regular_triangulation_3`), the vertex
and cell classes must respectively be models to both `AlphaShapeVertex_3` and
`RegularTriangulationVertexBase_3`, and to both
`AlphaShapeCell_3` and `RegularTriangulationCellBase_3`
(see example: \ref AlphaShape_3DExampleforWeightedAlphaShapes).
<li> When using a periodic triangulation (`Periodic_3_Delaunay_triangulation_3`
or `Periodic_3_regular_triangulation_3`), the vertex and cell classes must
respectively be models to both `AlphaShapeVertex_3` and `Periodic_3TriangulationDSVertexBase_3`,
and to both `AlphaShapeCell_3` and `Periodic_3TriangulationDSCellBase_3`
(see example: \ref AlphaShape_3DExampleForPeriodicAlphaShapes).
</ul>
\section Alpha_shapes_3AlphaShape3OrFixedAlphaShape3 Alpha_shape_3 vs. Fixed_alpha_shape_3
The class `Alpha_shape_3<Dt,ExactAlphaComparisonTag>` represents the whole family
of alpha shapes for a given set of points while the class `Fixed_alpha_shape_3<Dt>`
represents only one alpha shape (for a fixed alpha). When using the same kernel,
`Fixed_alpha_shape_3<Dt>` being a lighter version, it is naturally much more efficient
`Fixed_alpha_shape_3<Dt>` is a lighter version. It is thus naturally much more efficient
when the alpha-shape is needed for a single given value of alpha.
In addition note that the class `Alpha_shape_3<Dt,ExactAlphaComparisonTag>`
In addition, note that the class `Alpha_shape_3<Dt,ExactAlphaComparisonTag>`
requires constructions (squared radius of simplices) while the
class `Fixed_alpha_shape_3<Dt>` uses only predicates.
This implies that a certified construction of one (several)
@ -279,7 +295,7 @@ as underlying triangulation.
\subsection AlphaShape_3DBuildingBasicAlphaShapesForManyPoints Building Basic Alpha Shapes for Many Points
When many points are input in the alpha shape, say more than 10 000,
it may pay off to use a Delaunay triangulation with `Fast_location`
it may pay off to use a Delaunay triangulation with the `Fast_location`
policy as underlying triangulation in order to speed up point location
queries (cf. Section \ref Triangulation3seclocpol "The Location Policy Parameter").
@ -309,21 +325,22 @@ them with a traits with inexact constructions, the tag
\subsection AlphaShape_3DExampleForPeriodicAlphaShapes Example for Periodic Alpha Shapes
The following example shows how to use the periodic Delaunay
The following example shows how to use a periodic Delaunay
triangulation (Chapter \ref Chapter_3D_Periodic_Triangulations "3D Periodic Triangulations") as underlying
triangulation for the alpha shape computation.
triangulation for the alpha shape computation. Usage of a weighted Delaunay periodic
triangulation is presented in the example: \ref Alpha_shapes_3/ex_weighted_periodic_alpha_shapes_3.cpp "ex_weighted_periodic_alpha_shapes_3.cpp".
In order to define the original domain and to benefit from the
built-in heuristic optimizations of the periodic Delaunay
triangulation computation it is recommended to first construct the
triangulation and then construct the alpha shape from it. The alpha
built-in heuristic optimizations of the periodic triangulation computation,
it is recommended to first construct the triangulation and
then construct the alpha shape from it. The alpha
shape constructor that takes a point range can be used as well but in
this case the original domain cannot be specified and the default unit
cube will be chosen and no optimizations will be used.
It is also recommended to switch the triangulation to 1-sheeted
covering if possible. Note that a periodic triangulation in 27-sheeted
covering space is degenerate. In this case an exact constructions
covering space is degenerate. In this case, an exact constructions
kernel needs to be used to compute the alpha shapes. Otherwise the
results will suffer from round-off problems.

View File

@ -7,24 +7,56 @@ namespace CGAL {
The class `Alpha_shape_3` represents the family of
alpha shapes of points in the 3D space for <I>all</I> real
\f$ \alpha\f$. It maintains an underlying triangulation
of the class `Dt`. Each k-dimensional face of Dt is associated with an
of the class `Dt`. Each k-dimensional face of Dt is associated with an
interval that specifies for which values of alpha the face belongs to the alpha shape.
The second template parameter `ExactAlphaComparisonTag` is a tag that, when set to
`CGAL::Tag_true`, triggers exact comparisons between alpha values. This is useful
when the Delaunay triangulation is instantiated with an exact predicates inexact constructions
kernel. By default the `ExactAlphaComparisonTag` is set to `CGAL::Tag_false` as it induces a small
overhead. Note that since such a strategy does not make sense if used together with a traits class with exact constructions,
the tag `ExactAlphaComparisonTag` is not taken into account if `Dt::Geom_traits::FT` is not a floating point number type.
Note that this class is at the same time used for <I>basic</I> and
for <I>weighted</I> Alpha Shapes.
Note that this class is used for <I>basic</I>, <I>weighted</I>,
and <I>periodic</I> Alpha Shapes.
The modifying functions `insert` and `remove` will overwrite
the one inherited from the underlying triangulation class `Dt`.
At the moment, only the static version is implemented.
\cgalHeading{I/O}
\tparam Dt must be either `Delaunay_triangulation_3`, `Regular_triangulation_3`,
`Periodic_3_Delaunay_triangulation_3` or `Periodic_3_regular_triangulation_3`.
Note that `Dt::Geom_traits`, `Dt::Vertex`, and `Dt::Face`
must be model the concepts `AlphaShapeTraits_3`,
`AlphaShapeVertex_3` and `AlphaShapeCell_3`, respectively.
\tparam The second template parameter `ExactAlphaComparisonTag` is a tag that, when set to
\link Tag_true `Tag_true`\endlink, triggers exact comparisons between alpha values. This is useful
when the Delaunay triangulation is instantiated with an exact predicates inexact constructions
kernel. By default the `ExactAlphaComparisonTag` is set to \link Tag_false `Tag_false`\endlink as it induces a small
overhead. Note that the tag `ExactAlphaComparisonTag` is currently ignored (meaning that the code will
behave as if `ExactAlphaComparisonTag` were set to \link Tag_false `Tag_false`\endlink)
if `Dt::Geom_traits::FT` is not a floating point number type as this strategy
does not make sense if the traits class already provides exact constructions.
\warning
<ul>
<li>When the tag `ExactAlphaComparisonTag` is set to \link Tag_true `Tag_true`\endlink,
the class `Cartesian_converter` is used internally to switch between the traits class
and the %CGAL kernel `CGAL::Simple_cartesian<NT>`, where `NT` can be either `CGAL::Interval_nt` or
`CGAL::Exact_rational`. `Cartesian_converter` must thus offer the necessary functors
to convert a three-dimensional point of the traits class to a three-dimensional point
of `CGAL::Simple_cartesian<NT>`. However, these functors are not necessarily provided by
the basic `Cartesian_converter`, for example when a custom point is used.
In this case, a partial specialization of `Cartesian_converter`
must be provided by the user. An example of such specialization is given in the
two-dimensional Alpha Shapes example \ref Alpha_shapes_2/ex_alpha_projection_traits.cpp "ex_alpha_projection_traits.cpp".
<li>The tag `ExactAlphaComparisonTag` cannot be used in conjonction with periodic triangulations.
When the tag `ExactAlphaComparisonTag` is set to \link Tag_true `Tag_true`\endlink,
the evaluations of predicates such as `Side_of_oriented_sphere_3` are done lazily.
Consequently, the predicates store pointers to the geometrical positions of the
points passed as arguments of the predicates. It is thus important that
these points are not temporary objects. Points of the triangulation are accessed
using the function `point(Cell_handle, int)` of the underlying triangulation.
In the case of periodic triangulations, the `point(Cell_handle, int)` function
is actually a construction that returns a temporary, which thus cannot be used
along with a lazy predicate evaluation.
</ul>
\cgalHeading{I/O}
The I/O operators are defined for `iostream`, and for
the window stream provided by \cgal. The format for the iostream
is an internal format.
@ -81,6 +113,14 @@ For convenience, classical comparison operators are provided for the type `FT`.
*/
typedef unspecified_type FT;
/*!
The point type.
For basic alpha shapes, `Point` will be equal to `Gt::Point_2`. For weighted alpha
shapes, `Point` will be equal to `Gt::Weighted_point_2`.
*/
typedef Dt::Point Point;
/*!
The size type.
*/
@ -411,13 +451,13 @@ size_type number_of_solid_components(const FT& alpha = get_alpha()) const;
/*!
Returns an iterator pointing to smallest \f$ \alpha\f$ value
such that the alpha shape satisfies the following two properties:
such that the alpha shape satisfies the following two properties:
all data points are either on the boundary or in the interior
of the regularized version of the alpha shape.
- All data points are either on the boundary or in the interior
of the regularized version of the alpha shape.
The number of solid component of the alpha shape is equal to or
smaller than `nb_components`.
- The number of solid component of the alpha shape is equal to or
smaller than `nb_components`.
*/
Alpha_iterator find_optimal_alpha(size_type nb_components) const;

View File

@ -9,20 +9,24 @@ The class `Alpha_shape_cell_base_3` is the default model for the concept
\tparam Traits is the geometric traits class that is provided
to the `Alpha_shape_3` class.
\tparam Cb must be a cell base class instantiated by default
with `Triangulation_cell_base_3<Traits>`.
\tparam Cb must be a cell base class adapted to the type of triangulation that is being used.
By default, it is instantiated with `Triangulation_cell_base_3<Traits>`,
which is appropriate for basic alpha shapes.
\tparam ExactAlphaComparisonTag is a tag that, when set to
`Tag_true`, triggers exact comparisons between alpha values. See the description
provided in the documentation of `Alpha_shape_3` for more details. The default value is `Tag_false`.
\tparam WeightedTag is used only if `ExactAlphaComparisonTag` is `Tag_true`. It
must be `Tag_true` if the underlying triangulation of the alpha shape to be used is a Regular triangulation
and `Tag_false` otherwise. The default is `Tag_false`.
\link Tag_true `Tag_true`\endlink, triggers exact comparisons between alpha values. See the description
provided in the documentation of `Alpha_shape_3` for more details. The default value is \link Tag_false `Tag_false`\endlink.
\tparam WeightedTag is used only if `ExactAlphaComparisonTag` is \link Tag_true `Tag_true`\endlink. It
must be \link Tag_true `Tag_true`\endlink if the underlying triangulation of the alpha shape to be used is a regular triangulation
and \link Tag_false `Tag_false`\endlink otherwise. The default is \link Tag_false `Tag_false`\endlink.
\cgalModels `AlphaShapeCell_3`
\sa `Triangulation_cell_base_3`
\sa `Regular_triangulation_cell_base_3`
\sa `Periodic_3_triangulation_ds_cell_base_3`
*/
template< typename Traits, typename Cb, typename ExactAlphaComparisonTag, typename WeightedTag >
class Alpha_shape_cell_base_3 : public Fb {
class Alpha_shape_cell_base_3 : public Cb {
public:
/// @}

View File

@ -7,19 +7,23 @@ namespace CGAL {
The class `Alpha_shape_vertex_base_3` is the default model for the concept
`AlphaShapeVertex_3`.
\tparam Traits must be a geometric traits class
which provides the type for the points or the weighted points.
\tparam Vb must be a vertex base class instantiated by default
with `CGAL::Triangulation_vertex_base_3<Traits>`.
\tparam ExactAlphaComparisonTag is a tag that, when set to
`Tag_true`, triggers exact comparisons between alpha values. See the description
provided in the documentation of `Alpha_shape_3` for more details. The default value is `Tag_false`.
\tparam WeightedTag is used only if `ExactAlphaComparisonTag` is `Tag_true`. It
must be `Tag_true` if the underlying triangulation of the alpha shape to be used is a regular triangulation
and `Tag_false` otherwise. The default is `Tag_false`.
\tparam Traits is the geometric traits class that is provided
to the `Alpha_shape_3` class.
\tparam Vb must be a vertex base class adapted to the type of triangulation that is being used.
By default, it is instantiated with `Triangulation_vertex_base_3<Traits>`,
which is appropriate for basic alpha shapes.
\tparam ExactAlphaComparisonTag is a tag that, when set to
\link Tag_true `Tag_true`\endlink, triggers exact comparisons between alpha values. See the description
provided in the documentation of `Alpha_shape_3` for more details. The default value is \link Tag_false `Tag_false`\endlink.
\tparam WeightedTag is used only if `ExactAlphaComparisonTag` is \link Tag_true `Tag_true`\endlink. It
must be \link Tag_true `Tag_true`\endlink if the underlying triangulation of the alpha shape to be used is a regular triangulation
and \link Tag_false `Tag_false`\endlink otherwise. The default is \link Tag_false `Tag_false`\endlink.
\cgalModels `AlphaShapeVertex_3`
\sa `Triangulation_vertex_base_3`
\sa `Regular_triangulation_vertex_base_3`
\sa `Periodic_3_triangulation_ds_vertex_base_3`
*/
template< typename Traits, typename Vb, typename ExactAlphaComparisonTag, typename WeightedTag >
class Alpha_shape_vertex_base_3 : public Vb {

View File

@ -12,8 +12,14 @@ represents connectivity and order among its faces. Each
\f$ k\f$-dimensional face of the `Dt` is associated with
a classification that specifies its status in the alpha complex, alpha being fixed.
Note that this class can be used at the same time to build a <I>basic</I> or
a <I>weighted</I> Alpha Shape.
\tparam Dt must be either `Delaunay_triangulation_3`, `Regular_triangulation_3`,
`Periodic_3_Delaunay_triangulation_3` or `Periodic_3_regular_triangulation_3`.
Note that `Dt::Geom_traits`, `Dt::Vertex`, and `Dt::Face`
must be model the concepts `AlphaShapeTraits_3`,
`AlphaShapeVertex_3` and `AlphaShapeFace_3`, respectively.
Note that this class is used for <I>basic</I>, <I>weighted</I>,
and <I>periodic</I>Alpha Shapes.
The modifying functions `insert` and `remove` will overwrite
the one inherited from the underlying triangulation class `Dt`.
@ -93,7 +99,7 @@ const FT& alpha = 0);
/*!
Inserts point p in the underlying triangulation and returns the corresponding vertex.
Inserts the point p in the underlying triangulation and returns the corresponding vertex.
The optional argument `start` is used as a starting place for the search.
The classification types of the new simplices are computed and that of the simplices incident
to the new ones are updated.

View File

@ -7,12 +7,18 @@ namespace CGAL {
The class `Fixed_alpha_shape_cell_base_3` is the default model for the concept
`FixedAlphaShapeCell_3`.
\tparam Traits provides the number type for alpha values.
\tparam Cb must be a cell base class and it is instantiated by default
with `Triangulation_cell_base_3<Traits>`.
\tparam Traits is the geometric traits class that is provided
to the `Alpha_shape_3` class.
\tparam Cb must be a cell base class adapted to the type of triangulation that is being used.
By default, it is instantiated with `Triangulation_cell_base_3<Traits>`,
which is appropriate for basic alpha shapes.
\cgalModels `FixedAlphaShapeCell_3`
\sa `Alpha_shape_cell_base_3`
\sa `Triangulation_cell_base_3`
\sa `Regular_triangulation_cell_base_3`
\sa `Periodic_3_triangulation_ds_cell_base_3`
*/
template< typename Traits, typename Cb >
class Fixed_alpha_shape_cell_base_3 : public Cb {

View File

@ -7,12 +7,18 @@ namespace CGAL {
The class `Fixed_alpha_shape_vertex_base_3` is the default model for the concept
`FixedAlphaShapeVertex_3`.
\tparam Traits must provide the type for the points or the weighted points.
\tparam Vb must be a vertex base class and it is instantiated by default
with `Triangulation_vertex_base_3<Traits>`.
\tparam Traits is the geometric traits class that is provided
to the `Alpha_shape_3` class.
\tparam Vb must be a vertex base class adapted to the type of triangulation that is being used.
By default, it is instantiated with `Triangulation_vertex_base_3<Traits>`,
which is appropriate for basic alpha shapes.
\cgalModels `FixedAlphaShapeVertex_3`
\sa `Alpha_shape_vertex_base_3`
\sa `Triangulation_vertex_base_3`
\sa `Regular_triangulation_vertex_base_3`
\sa `Periodic_3_triangulation_ds_vertex_base_3`
*/
template< typename Traits, typename Vb >
class Fixed_alpha_shape_vertex_base_3 : public Vb {

View File

@ -3,15 +3,17 @@
\ingroup PkgAlphaShapes3Concepts
\cgalConcept
This concept describes the requirements for the base cell of an alpha shape.
The concept `AlphaShapeCell_3` describes the requirements for the base cell of an alpha shape.
\sa `CGAL::Alpha_status`
\cgalRefines `TriangulationCellBase_3`, if the underlying triangulation of the alpha shape is a Delaunay triangulation.
\cgalRefines `RegularTriangulationCellBase_3`, if the underlying triangulation of the alpha shape is a regular triangulation.
\cgalRefines `Periodic_3TriangulationDSCellBase_3`, if the underlying triangulation of the alpha shape is a periodic triangulation.
\cgalRefines `TriangulationCellBase_3`
\cgalHasModel `CGAL::Alpha_shape_cell_base_3` (templated with the appropriate triangulation cell base class).
\sa `CGAL::Alpha_status`
\cgalHasModel `CGAL::Alpha_shape_cell_base_3`
*/
class AlphaShapeCell_3 {
public:

View File

@ -7,22 +7,16 @@ The concept `AlphaShapeTraits_3` describes the requirements
for the geometric traits class
of the underlying Delaunay triangulation of a basic alpha shape.
\cgalRefines `DelaunayTriangulationTraits_3`
\cgalRefines `DelaunayTriangulationTraits_3`
In addition to the requirements described in the concept
::DelaunayTriangulationTraits_3, the geometric traits class of a
Delaunay triangulation plugged in a basic alpha shapes provides the
following.
\cgalHasModel All %CGAL kernels.
\cgalHasModel `CGAL::Exact_predicates_inexact_constructions_kernel` (recommended)
\cgalHasModel `CGAL::Exact_predicates_exact_constructions_kernel`
\cgalHasModel `CGAL::Filtered_kernel`
\cgalHasModel `CGAL::Cartesian`
\cgalHasModel `CGAL::Simple_cartesian`
\cgalHasModel `CGAL::Homogeneous`
\cgalHasModel `CGAL::Simple_homogeneous`
\cgalHasModel All models of `Kernel`.
\sa `CGAL::Exact_predicates_inexact_constructions_kernel` (recommended kernel)
*/
class AlphaShapeTraits_3 {

View File

@ -3,17 +3,17 @@
\ingroup PkgAlphaShapes3Concepts
\cgalConcept
This concept describe the requirements for the base vertex of an alpha shape.
The concept `AlphaShapeVertex_3` describes the requirements for the base vertex of an alpha shape.
\cgalRefines `TriangulationVertexBase_3`
\cgalRefines `TriangulationVertexBase_3`, if the underlying triangulation of the alpha shape is a Delaunay triangulation.
\cgalRefines `RegularTriangulationVertexBase_3`, if the underlying triangulation of the alpha shape is a regular triangulation.
\cgalRefines `Periodic_3TriangulationDSVertexBase_3`, if the underlying triangulation of the alpha shape is a periodic triangulation.
\cgalHasModel `CGAL::Alpha_shape_vertex_base_3` (templated with the appropriate triangulation vertex base class).
\cgalHasModel `CGAL::Alpha_shape_vertex_base_3`
\sa `CGAL::Alpha_status`
\sa `CGAL::Alpha_status`
*/
class AlphaShapeVertex_3 {
public:

View File

@ -3,14 +3,14 @@
\ingroup PkgAlphaShapes3Concepts
\cgalConcept
This concept describes the requirements for the base cell of a alpha shape with a fixed value alpha.
The concept `FixedAlphaShapeCell_3` describes the requirements for the base cell of a alpha shape with a fixed value alpha.
\cgalRefines `TriangulationCellBase_3`
\cgalHasModel `CGAL::Fixed_alpha_shape_cell_base_3`
\cgalRefines `TriangulationCellBase_3`, if the underlying triangulation of the alpha shape is a Delaunay triangulation.
\cgalRefines `RegularTriangulationCellBase_3`, if the underlying triangulation of the alpha shape is a regular triangulation.
\cgalRefines `Periodic_3TriangulationDSCellBase_3`, if the underlying triangulation of the alpha shape is a periodic triangulation.
\cgalHasModel `CGAL::Fixed_alpha_shape_cell_base_3` (templated with the appropriate triangulation cell base class).
*/
class FixedAlphaShapeCell_3 {
public:

View File

@ -7,24 +7,17 @@ The concept `FixedAlphaShapeTraits_3` describes the requirements
for the geometric traits class
of the underlying Delaunay triangulation of a basic alpha shape with a fixed value alpha.
\cgalRefines `DelaunayTriangulationTraits_3`
\cgalRefines `DelaunayTriangulationTraits_3`
In addition to the requirements described in the concept
`DelaunayTriangulationTraits_3`, the geometric traits class of a
Delaunay triangulation plugged in a basic alpha shape with fixed alpha
value provides the following.
\cgalHasModel All CGAL kernels.
\cgalHasModel CGAL::Exact_predicates_inexact_constructions_kernel (recommended)
\cgalHasModel CGAL::Exact_predicates_exact_constructions_kernel
\cgalHasModel CGAL::Filtered_kernel
\cgalHasModel CGAL::Cartesian
\cgalHasModel CGAL::Simple_cartesian
\cgalHasModel CGAL::Homogeneous
\cgalHasModel CGAL::Simple_homogeneous
\cgalHasModel All models of `Kernel`.
\sa CGAL::Exact_predicates_inexact_constructions_kernel (recommended kernel)
*/
class FixedAlphaShapeTraits_3 {
public:

View File

@ -3,12 +3,13 @@
\ingroup PkgAlphaShapes3Concepts
\cgalConcept
This concept describes the requirements for the base vertex of a alpha shape with a fixed value alpha.
The concept `FixedAlphaShapeVertex_3` describes the requirements for the base vertex of a alpha shape with a fixed value alpha.
\cgalRefines `TriangulationVertexBase_3`
\cgalRefines `TriangulationVertexBase_3`, if the underlying triangulation of the alpha shape is a Delaunay triangulation.
\cgalRefines `RegularTriangulationVertexBase_3`, if the underlying triangulation of the alpha shape is a regular triangulation.
\cgalRefines `Periodic_3TriangulationDSVertexBase_3`, if the underlying triangulation of the alpha shape is a periodic triangulation.
\cgalHasModel `CGAL::Fixed_alpha_shape_vertex_base_3`
\cgalHasModel `CGAL::Fixed_alpha_shape_vertex_base_3` (templated with the appropriate triangulation vertex base class).
*/
class FixedAlphaShapeVertex_3 {

View File

@ -4,17 +4,18 @@
\cgalConcept
The concept `FixedWeightedAlphaShapeTraits_3` describes the requirements
for the geometric traits class of the underlying Regular triangulation of a weighted alpha shape with fixed alpha value.
for the geometric traits class of the underlying regular triangulation of a weighted alpha shape with fixed alpha value.
\cgalRefines `RegularTriangulationTraits_3`
In addition to the requirements described in the concept
::RegularTriangulationTraits_3, the geometric traits class of a
Regular triangulation plugged in a weighted alpha shape with fixed
regular triangulation plugged in a weighted alpha shape with fixed
alpha value provides the following.
\cgalHasModel `CGAL::Regular_triangulation_euclidean_traits_3<K>`
\cgalHasModel All models of `Kernel`.
\sa `CGAL::Exact_predicates_inexact_constructions_kernel` (recommended kernel)
*/
class FixedWeightedAlphaShapeTraits_3 {

View File

@ -5,17 +5,18 @@
The concept `WeightedAlphaShapeTraits_3` describes the requirements
for the geometric traits class
of the underlying Regular triangulation of a weighted alpha shape.
of the underlying regular triangulation of a weighted alpha shape.
\cgalRefines `RegularTriangulationTraits_3`
In addition to the requirements described in the concept
::RegularTriangulationTraits_3, the geometric traits class of a
Regular triangulation plugged in a basic alpha shapes provides the
`RegularTriangulationTraits_3`, the geometric traits class of a
regular triangulation plugged in a basic alpha shapes provides the
following.
\cgalHasModel `CGAL::Regular_triangulation_euclidean_traits_3<K>`
\cgalHasModel All models of `Kernel`.
\sa `CGAL::Exact_predicates_inexact_constructions_kernel` (recommended kernel)
*/
class WeightedAlphaShapeTraits_3 {

View File

@ -1,3 +1,6 @@
@INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS}
PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Alpha Shapes"
EXAMPLE_PATH = ${CGAL_Alpha_shapes_2_EXAMPLE_DIR} \
${CGAL_Alpha_shapes_3_EXAMPLE_DIR}

View File

@ -47,7 +47,7 @@ The alpha shapes of a set of points
\f$ S\f$ form a discrete family, even though they
are defined for all real numbers \f$ \alpha\f$.
The entire family of alpha shapes can be represented
through the underlying triangulation of \f$ S\f$. In this representation
through the underlying triangulation of \f$ S\f$. In this representation,
each \f$ k\f$-simplex of the underlying triangulation is associated with an
interval that specifies for which values of \f$ \alpha\f$ the \f$ k\f$-simplex
belongs to the alpha complex. Relying on this fact, the family of
@ -60,7 +60,7 @@ The definition is analog in the case of weighted alpha shapes.
The input set is now a set of weighted points (which can be regarded
as spheres) and the underlying triangulation
is the regular triangulation of this set.
Two spheres, or two weighted points , with centers \f$ C_1, C_2\f$
Two spheres, or two weighted points, with centers \f$ C_1, C_2\f$
and radii \f$ r_1, r_2 \f$ are said to be orthogonal iff
\f$ C_1C_2 ^2 = r_1^2 + r_2^2\f$ and suborthogonal
iff \f$ C_1C_2 ^2 < r_1^2 + r_2^2\f$.

View File

@ -8,3 +8,4 @@ Triangulation_3
Geomview
Periodic_3_triangulation_3
Number_types
Alpha_shapes_2

View File

@ -5,4 +5,6 @@
\example Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp
\example Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp
\example Alpha_shapes_3/ex_weighted_alpha_shapes_3.cpp
\example Alpha_shapes_3/ex_weighted_periodic_alpha_shapes_3.cpp
\example Alpha_shapes_2/ex_alpha_projection_traits.cpp
*/

View File

@ -1,10 +1,13 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Alpha_shape_3.h>
#include <CGAL/Alpha_shape_3.h>
#include <CGAL/Alpha_shape_cell_base_3.h>
#include <CGAL/Alpha_shape_vertex_base_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <cassert>
#include <fstream>
#include <list>
#include <cassert>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt;
@ -15,7 +18,7 @@ typedef CGAL::Delaunay_triangulation_3<Gt,Tds> Triangulation_3;
typedef CGAL::Alpha_shape_3<Triangulation_3> Alpha_shape_3;
typedef Gt::Point_3 Point;
typedef Alpha_shape_3::Alpha_iterator Alpha_iterator;
typedef Alpha_shape_3::Alpha_iterator Alpha_iterator;
int main()
{
@ -27,21 +30,22 @@ int main()
is >> n;
std::cout << "Reading " << n << " points " << std::endl;
Point p;
for( ; n>0 ; n--) {
for( ; n>0 ; n--)
{
is >> p;
lp.push_back(p);
}
// compute alpha shape
Alpha_shape_3 as(lp.begin(),lp.end());
std::cout << "Alpha shape computed in REGULARIZED mode by default"
<< std::endl;
std::cout << "Alpha shape computed in REGULARIZED mode by default" << std::endl;
// find optimal alpha value
Alpha_iterator opt = as.find_optimal_alpha(1);
std::cout << "Optimal alpha value to get one connected component is "
<< *opt << std::endl;
std::cout << "Optimal alpha value to get one connected component is " << *opt << std::endl;
as.set_alpha(*opt);
assert(as.number_of_solid_components() == 1);
return 0;
}

View File

@ -1,22 +1,25 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Alpha_shape_3.h>
#include <CGAL/Alpha_shape_3.h>
#include <CGAL/Alpha_shape_cell_base_3.h>
#include <CGAL/Alpha_shape_vertex_base_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <cassert>
#include <fstream>
#include <list>
#include <cassert>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt;
typedef CGAL::Tag_true Alpha_cmp_tag;
typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt;
typedef CGAL::Tag_true Alpha_cmp_tag;
//We use CGAL::Default to skip the complete declaration of base classes
typedef CGAL::Alpha_shape_vertex_base_3<Gt,CGAL::Default,Alpha_cmp_tag> Vb;
typedef CGAL::Alpha_shape_cell_base_3<Gt,CGAL::Default,Alpha_cmp_tag> Fb;
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_3<Gt,Tds> Triangulation_3;
typedef CGAL::Alpha_shape_vertex_base_3<Gt,CGAL::Default,Alpha_cmp_tag> Vb;
typedef CGAL::Alpha_shape_cell_base_3<Gt,CGAL::Default,Alpha_cmp_tag> Fb;
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_3<Gt,Tds> Triangulation_3;
//Alpha shape with ExactAlphaComparisonTag set to true (note that the tag is also
//set to true for Vb and Fb)
typedef CGAL::Alpha_shape_3<Triangulation_3,Alpha_cmp_tag> Alpha_shape_3;
typedef Gt::Point_3 Point;
typedef CGAL::Alpha_shape_3<Triangulation_3,Alpha_cmp_tag> Alpha_shape_3;
typedef Gt::Point_3 Point;
int main()
{
@ -27,8 +30,7 @@ int main()
lp.push_back(Point(49.3696,31.4775,5.33777));
lp.push_back(Point(49.4264,32.6279,4.6205));
lp.push_back(Point(49.3127,30.3271,6.05503));
// compute alpha shape
Alpha_shape_3 as(lp.begin(),lp.end(),0,Alpha_shape_3::GENERAL);

View File

@ -1,6 +1,9 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Alpha_shape_3.h>
#include <CGAL/Alpha_shape_cell_base_3.h>
#include <CGAL/Alpha_shape_vertex_base_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <fstream>
#include <list>
@ -14,9 +17,9 @@ typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_3<K,Tds,CGAL::Fast_location> Delaunay;
typedef CGAL::Alpha_shape_3<Delaunay> Alpha_shape_3;
typedef K::Point_3 Point;
typedef Alpha_shape_3::Alpha_iterator Alpha_iterator;
typedef Alpha_shape_3::NT NT;
typedef K::Point_3 Point;
typedef Alpha_shape_3::Alpha_iterator Alpha_iterator;
typedef Alpha_shape_3::NT NT;
int main()
{

Some files were not shown because too many files have changed in this diff Show More