Merge branch 'master' into BGL-LCC-gdamiand

This commit is contained in:
Guillaume Damiand 2017-06-15 10:03:53 -04:00 committed by GitHub
commit c8250c4570
612 changed files with 26728 additions and 10403 deletions

View File

@ -58,7 +58,9 @@ compiler:
- clang
- gcc
addons:
apt:
apt:
sources:
- sourceline: 'ppa:ppsspp/cmake'
packages:
- zsh
- cmake
@ -85,3 +87,7 @@ addons:
# - libglew1.5-dev
# - libipe-dev
# - libmpfi-dev
notifications:
email:
on_success: change # default: always
on_failure: always # default: always

View File

@ -1,14 +1,64 @@
#!/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=1 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=
if [ "$CC" = "clang" ]; then
EXTRA_CXX_FLAGS="-Werror=inconsistent-missing-override"
fi
if [ $NEED_3D = 1 ]; then
QGLVIEWERROOT=$PWD/qglviewer
export QGLVIEWERROOT
fi
cmake -DCGAL_DIR="$ROOT/build" -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 ../..
make -j2 check_headers
popd
#parse current matrix and check that no package has been forgotten
old_IFS=$IFS
IFS=$'\n'
@ -38,6 +88,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 +106,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 +128,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:

23
.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
@ -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

@ -18,7 +18,9 @@ compiler:
- clang
- gcc
addons:
apt:
apt:
sources:
- sourceline: 'ppa:ppsspp/cmake'
packages:
- zsh
- cmake
@ -45,3 +47,7 @@ addons:
# - libglew1.5-dev
# - libipe-dev
# - libmpfi-dev
notifications:
email:
on_success: change # default: always
on_failure: always # default: always

View File

@ -7,6 +7,10 @@ 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()

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

@ -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

@ -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

@ -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

@ -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

@ -24,17 +24,20 @@
#include <CGAL/license/Alpha_shapes_2.h>
// temporarily silenced
/*
#define CGAL_DEPRECATED_HEADER "<CGAL/Weighted_alpha_shape_euclidean_traits_2.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Regular_triangulation_euclidean_traits_2.h>"
#define CGAL_DEPRECATED_MESSAGE_DETAILS \
"The class Weighted_alpha_shape_euclidean_traits_2<K> is deprecated in favor of "\
"Regular_triangulation_euclidean_traits_2<K>."
#include <CGAL/internal/deprecation_warning.h>
*/
#include <CGAL/Regular_triangulation_euclidean_traits_2.h>
namespace CGAL {
//------------------ Traits class -------------------------------------
#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
template< class R >
class Weighted_alpha_shape_euclidean_traits_2 : public
Regular_triangulation_euclidean_traits_2<R, typename R::FT>

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,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

@ -8,6 +8,9 @@ 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()

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

@ -23,19 +23,20 @@
#include <CGAL/license/Alpha_shapes_3.h>
// temporarily silenced
/*
#define CGAL_DEPRECATED_HEADER "<CGAL/Weighted_alpha_shape_euclidean_traits_3.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Regular_triangulation_euclidean_traits_3.h>"
#define CGAL_DEPRECATED_MESSAGE_DETAILS \
"The class Weighted_alpha_shape_euclidean_traits_3<K> is deprecated in favor of "\
"Regular_triangulation_euclidean_traits_3<K>."
#include <CGAL/internal/deprecation_warning.h>
*/
#include <CGAL/Regular_triangulation_euclidean_traits_3.h>
namespace CGAL {
//------------------ Traits class -------------------------------------
#ifdef CGAL_NO_DEPRECATED_CODE
#error The class Weighted_alpha_shape_euclidean_traits_3<K> is deprecated in favor of Regular_triangulation_euclidean_traits_3<K>.
#endif
template <class K>
class Weighted_alpha_shape_euclidean_traits_3 : public
Regular_triangulation_euclidean_traits_3<K>

View File

@ -43,7 +43,7 @@
#include <CGAL/Apollonius_graph_vertex_base_2.h>
#include <CGAL/in_place_edge_list.h>
#include <CGAL/Segment_Delaunay_graph_2/edge_list.h>
#include <CGAL/internal/TDS_2/edge_list.h>
#include <CGAL/Apollonius_graph_2/Traits_wrapper_2.h>
#include <CGAL/Apollonius_graph_2/Constructions_C2.h>

View File

@ -3,6 +3,9 @@
project( Arrangement_on_surface_2_Demo )
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()

View File

@ -8,12 +8,11 @@
/// @}
namespace CGAL {
/*!
* \ingroup PkgArrangement2TraitsClasses
/*! \ingroup PkgArrangement2TraitsClasses
*
* Note: The `GeometryTraits_2` can comprise of Line_segments, Conic_arcs,
* Circular_arc, Bezier_curves or Linear_curves. A portion or a part
* of any of the above mentioned geometric traits is called a segment.
* Note: The `SubcurveTraits_2` can comprise of Line_segments, Conic_arcs,
* Circular_arc, Bezier_curves, or Linear_curves. A portion or a part
* of any of the above mentioned geometric traits is called a subcurve.
*
* The traits class `Arr_polycurve_traits_2` handles piecewise curves that are
* not necessarily linear, such as conic arcs, circular arcs, Bezier curves,
@ -21,22 +20,22 @@ namespace CGAL {
* is a chain of subcurves, where each two neighboring subcurves in the chain
* share a common endpoint; that is, the polycurve is continuous. Furthermore,
* the target of the \f$i\f$th segement of a polycurve has to coincide with
* the source of the \f$i+1\f$st segment; that is, the polycurve has to be \a
* well-oriented. Note that it is possible to construct general polycurves
* the source of the \f$i+1\f$st segment; that is, the polycurve has to be
* \a well-oriented. Note that it is possible to construct general polycurves
* that are neither continuous nor well-oriented, as it is impossible to
* enforce this precondition (using the set of predicates required by the
* relevant concepts, see below). However, such polycurves cannot be used for
* the actual computation of arrangements. The traits class template exploits
* the functionality of the `GeometryTraits_2` template-parameter to handle
* the functionality of the `SubcurveTraits_2` template-parameter to handle
* the subcurves that compose the polycurve.
*
* The type substituting the template parameter `GeometryTraits_2` when
* The type substituting the template parameter `SubcurveTraits_2` when
* the template Arr_polycurve_traits_2 is instantiated must be a model
* of the concepts
* - `ArrangementTraits_2` and
* - `ArrangementDirectionalXMonotoneTraits_2`.
*
* If, in addition, the GeometryTraits_2 models the concept
* If, in addition, the SubcurveTraits_2 models the concept
* `ArrangementApproximateTraits_2` then `Arr_polycurve_traits_2` models this
* concept as well. The same holds for the concept
* `ArrangementOpenBoundaryTraits_2`. If no type is provided, then
@ -53,22 +52,22 @@ namespace CGAL {
* `Arr_rational_function_traits_2<AlgebraicKernel_d_1>`,
* or any other model of the concepts above can be used.
*
* The number type used by the injected segment traits should support exact
* The number type used by the injected subcurve traits should support exact
* rational arithmetic (that is, the number type should support the arithmetic
* operations \f$ +\f$, \f$ -\f$, \f$ \times\f$ and \f$ \div\f$ carried out
* without loss of precision), in order to avoid robustness problems, although
* other inexact number types could be used at the user's own risk.
*
* A polycurve that comprises \f$n > 0\f$ segments has \f$ n+1 \f$ segment
* A polycurve that comprises \f$n > 0\f$ subcurves has \f$ n+1 \f$ subcurve
* end-points, and they are represented as objects of type
* `GeometryTraits_2::Point_2`. Since the notion of a \a vertex is reserved to
* `SubcurveTraits_2::Point_2`. Since the notion of a \a vertex is reserved to
* 0-dimensional elements of an arrangement, we use, in this context, the
* notion of \a points in order to refer to the vertices of a polycurve. For
* example, an arrangement induced by a single non-self intersecting polycurve
* has exactly two vertices regardless of the number of segment
* end-points. Finally, the types `Segment_2` and `X_monotone_segment_2`
* has exactly two vertices regardless of the number of subcurve
* end-points. Finally, the types `Subcurve_2` and `X_monotone_subcurve_2`
* nested in `Arr_polycurve_traits_2` are nothing but
* `GeometryTraits_2::Curve_2` and `GeometryTraits_2::X_monotone_curve_2`,
* `SubcurveTraits_2::Curve_2` and `SubcurveTraits_2::X_monotone_curve_2`,
* respectively.
*
* \cgalHeading{A note on Backwards compatibility} In \cgal version 4.2 (and
@ -85,10 +84,10 @@ namespace CGAL {
* \cgalModels `ArrangementTraits_2`
* \cgalModels `ArrangementDirectionalXMonotoneTraits_2`
* \cgalModels `ArrangementApproximateTraits_2` (if the type that substitutes
* the template parameter `GeometryTraits_2` models the concept as well)
* the template parameter `SubcurveTraits_2` models the concept as well)
*
* \sa `Arr_algebraic_segment_traits_2<Coefficient>`
* \sa `Arr_Bezier_curve_traits_2<RatKernel,AlgKernel,NtTraits>`
* \sa `Arr_Bezier_curve_traits_2<RatKernel, AlgKernel, NtTraits>`
* \sa `Arr_circle_segment_traits_2<Kernel>`
* \sa `Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>`
* \sa `Arr_linear_traits_2<Kernel>`
@ -98,7 +97,7 @@ namespace CGAL {
* \sa `CGAL_ALWAYS_LEFT_TO_RIGHT`
*/
template <typename GeometryTraits_2>
template <typename SubcurveTraits_2>
class Arr_polycurve_traits_2 {
public:
@ -108,12 +107,12 @@ namespace CGAL {
*/
// TODO: Have to turn these into links, so whenever I mention Point_2 it
// will point here and *not* to Kernel::Point_2 for instance.
typedef GeometryTraits_2::Point_2 Point_2;
typedef SubcurveTraits_2::Point_2 Point_2;
/*!
*/
typedef GeometryTraits_2::Curve_2 Segment_2;
typedef GeometryTraits_2::X_monotone_curve_2 X_monotone_segment_2;
typedef SubcurveTraits_2::Curve_2 Subcurve_2;
typedef SubcurveTraits_2::X_monotone_curve_2 X_monotone_subcurve_2;
/// @}
/*! Construction functor of a general (not necessarily \f$x\f$-monotone)
@ -122,7 +121,7 @@ namespace CGAL {
* This functor constructs general polycurve. Its `operator()` is
* oveloaded to support various input types.
*
* Note that the composing segments, depending on the `GeometryTraits_2`,
* Note that the composing subcurves, depending on the `SubcurveTraits_2`,
* might not be \f$x\f$-monotone.
*/
class Construct_curve_2 {
@ -130,15 +129,15 @@ namespace CGAL {
/// \name Operations
/// @{
/*! Obtain a polycurve that comprises of one given segment.
* \param seg input segment
* \pre `seg` is not degenerated (not tested)
* \return A polycurve with one segment, namely `seg`.
/*! Obtain a polycurve that comprises of one given subcurve.
* \param subcurve input subcurve.
* \pre `subcurve` is not degenerated (not tested).
* \return A polycurve with one subcurve, namely `subcurve`.
*/
Curve_2 operator()(const Segment_2& seg) const;
Curve_2 operator()(const Subcurve_2& subcurve) const;
/*! Construct a well-oriented polycurve from a range of either
* `GeometryTraits_2::Point_2` or `GeometryTraits_2::Curve_2`.
* `SubcurveTraits_2::Point_2` or `SubcurveTraits_2::Curve_2`.
*
* \param begin iterator pointing to the first element in the
* range.
@ -146,7 +145,7 @@ namespace CGAL {
* element in the range.
* \pre The given range form a continuous and well-oriented polycurve
* (not tested).
* \pre Contains no degenerated segments (not tested)
* \pre Contains no degenerated subcurves (not tested)
* \return A polycurve using the corresponding construction implementation.
*/
template <typename ForwardIterator>
@ -167,12 +166,12 @@ namespace CGAL {
*/
class Construct_x_monotone_curve_2 {};
/*! Function object which returns the number of segment end-points of a
/*! Function object which returns the number of subcurve end-points of a
* polycurve.
*/
class Number_of_points_2 {};
/*! Functor to augment a polycurve by either adding a vertex or a segment
/*! Functor to augment a polycurve by either adding a vertex or a subcurve
* at the back.
*/
class Push_back_2 {
@ -180,32 +179,31 @@ namespace CGAL {
/// \name Operations
/// @{
/*!
* Append a segment `seg` to an existing polycurve `cv` at the back.
* If `cv` is empty, `seg` will be its first segment.
/*! Append a subcurve `subcurve` to an existing polycurve `cv` at the back.
* If `cv` is empty, `subcurve` will be its first subcurve.
* \param cv a polycurve. Note, `cv` is (not necessarily) \f$x\f$-monotone.
* \param seg a segment (not necessarily \f$x\f$-monotone) to be appended
* to `cv`
* \param subcurve a subcurve (not necessarily \f$x\f$-monotone) to be
* appended to `cv`
*/
void operator()(Curve_2& cv, const Segment_2& seg) const;
void operator()(Curve_2& cv, const Subcurve_2& subcurve) const;
/*! Append a segment `seg` to an existing \f$x\f$-monotone polycurve `xcv`
* at the back. If `xcv` is empty, `seg` will be its first segment.
/*! Append a subcurve `subcurve` to an existing \f$x\f$-monotone polycurve
* `xcv` at the back. If `xcv` is empty, `subcurve` will be its first
* subcurve.
* \param xcv existing \f$x\f$-monotone polycurve
* \param seg the segment to be added
* \pre If `xcv` is not empty then `seg` extends `xcv` to the right if
* `xcv` is oriented right-to-left. Otherwise, `seg` extends `xcv` to
* the left.
* \pre `seg` is not degenerated.
* \pre `xcv` and `seg` should have the same orientation
* \param subcurve the subcurve to be added
* \pre If `xcv` is not empty then `subcurve` extends `xcv` to the right
* if `xcv` is oriented right-to-left. Otherwise, `subcurve` extends
* `xcv` to the left.
* \pre `subcurve` is not degenerated.
* \pre `xcv` and `subcurve` should have the same orientation
*/
void operator()(const X_monotone_curve_2& xcv, X_monotone_segment_2& seg)
const;
void operator()(X_monotone_curve_2& xcv,
const X_monotone_subcurve_2& subcurve) const;
/// @} /* end of operations */
}; /* end of Arr_polycurve_traits_2::Push_back_2 */
/*! Functor to augment a polycurve by either adding a vertex or a segment
/*! Functor to augment a polycurve by either adding a vertex or a subcurve
* at the front.
*/
class Push_front_2 {
@ -213,26 +211,27 @@ namespace CGAL {
/// \name Operations
/// @{
/*! Append a segment `seg` to an existing polycurve `cv` at the front.
* If `cv` is empty, `seg` will be its first segment.
/*! Append a subcurve `subcurve` to an existing polycurve `cv` at the
* front. If `cv` is empty, `subcurve` will be its first subcurve.
* \param cv a polycurve. Note, `cv` is (not necessarily) \f$x\f$-monotone.
* \param seg a segment (not necessarily \f$x\f$-monotone) to be appended
* to `cv`
* \param subcurve a subcurve (not necessarily \f$x\f$-monotone) to be
* appended to `cv`
*/
void operator()(Curve_2& cv, const Segment_2& seg) const;
void operator()(Curve_2& cv, const Subcurve_2& subcurve) const;
/*! Append a segment `seg` to an existing \f$x\f$-monotone polycurve `xcv`
* at the front. If `xcv` is empty, `seg` will be its first segment.
/*! Append a subcurve `subcurve` to an existing \f$x\f$-monotone polycurve
* `xcv` at the front. If `xcv` is empty, `subcurve` will be its first
* subcurve.
* \param xcv existing \f$x\f$-monotone polycurve
* \param seg the segment to be added
* \pre If `xcv` is not empty then `seg` extends `xcv` to the left if
* `xcv` is oriented right-to-left. Otherwise, `seg` extends `xcv` to
* the right.
* \pre `seg` is not degenerated.
* \pre `xcv` and `seg` should have the same orientation
* \param subcurve the subcurve to be added
* \pre If `xcv` is not empty then `subcurve` extends `xcv` to the left if
* `xcv` is oriented right-to-left. Otherwise, `subcurve` extends
* `xcv` to the right.
* \pre `subcurve` is not degenerated.
* \pre `xcv` and `subcurve` should have the same orientation
*/
void operator()(const X_monotone_curve_2& xcv, X_monotone_segment_2& seg)
const;
void operator()(X_monotone_curve_2& xcv,
const X_monotone_subcurve_2& subcurve) const;
/// @} /* end of operations */
}; /* end of Arr_polycurve_traits_2::Push_front_2 */
@ -249,8 +248,8 @@ namespace CGAL {
const Point_2& tgt) const;
};
/*! Subdivide the given segment into x-monotone sub-segments and insert them
* into the given output iterator. Since the segments that
/*! Subdivide the given subcurve into x-monotone subcurves and insert them
* into the given output iterator. Since the subcurves that
* constitute a general polycurve are not necessarily
* \f$x\f$-monotone, this functor may break them.
*/
@ -258,7 +257,7 @@ namespace CGAL {
public:
/*!
* \pre if `cv` is not empty then it must be continuous and well-oriented.
* \param cv The segment.
* \param cv The subcurve.
* \param oi The output iterator, whose value-type is Object. The output
* object is a wrapper of a X_monotone_curve_2 objects.
* \return The past-the-end iterator.
@ -268,25 +267,25 @@ namespace CGAL {
};
/*! The `Curve_2` type nested in the `Arr_polycurve_traits_2` represents
* general continuous piecewise-linear segments (a polycurve can be
* general continuous piecewise-linear subcurves (a polycurve can be
* self-intersecting) and support their construction from range of
* segments. Construction of polycurves in various ways is supported using
* subcurves. Construction of polycurves in various ways is supported using
* the construction functors. <em>It is strongly recommended to avoid
* construction of `Curve_2` objects directly and prefer the usage of the
* construction functors.</em> The type `Curve_2` has two template
* parameters, namely `Segment_type_T` and `Point_type_T`, which are
* `GeometryTraits_2::Curve_2` and `GeometryTraits_2::Point_2` types. Thus,
* in general, the segments that a `Curve_2` instance comprises could be
* parameters, namely `SubcurveType_2` and `PointType_2`, which are
* `SubcurveTraits_2::Curve_2` and `SubcurveTraits_2::Point_2` types. Thus,
* in general, the subcurves that a `Curve_2` instance comprises could be
* either \f$x\f$-monotone or not!
*
* The copy and default constructor as well as the assignment operator are
* provided for polycurve segments. In addition, an \link
* PkgArrangement2op_left_shift `operator<<` \endlink for the segments is
* provided for polycurve subcurves. In addition, an \link
* PkgArrangement2op_left_shift `operator<<` \endlink for the subcurves is
* defined for standard output streams, and an \link
* PkgArrangement2op_right_shift `operator>>` \endlink for the segments is
* PkgArrangement2op_right_shift `operator>>` \endlink for the subcurves is
* defined for standard input streams.
*/
template <typename Segment_type_T, typename Point_type_T>
template <typename SubcurveType_2, typename PointType_2>
class Curve_2 {
public:
@ -294,36 +293,37 @@ namespace CGAL {
/// \name Types
/// @{
/*! The container of the segments that comprises the polycurve.
/*! The container of the subcurves that comprises the polycurve.
*/
typedef typename std::vector<Segment_2> Segments_container;
typedef typename std::vector<Subcurve_2> Subcurves_container;
public:
/*! The size of the container that comprises the polycurve.
*/
typedef typename Segments_container::size_type Segments_size_type;
typedef typename Subcurves_container::size_type Size;
typedef typename Subcurves_container::size_type size_type;
/*! \deprecated
* A bidirectional iterator that allows traversing the points
* that comprise a polycurve's segments.
* that comprise a polycurve's subcurves.
*/
typedef unspecified_type const_iterator;
/*! \deprecated
* A bidirectional iterator that allows traversing the points
* that comprise a polycurve's segments.
* that comprise a polycurve's subcurves.
*/
typedef unspecified_type const_reverse_iterator;
/*! A bidirectional constant iterator that allows traversing
* the segments that comprise the polycurve.
* the subcurves that comprise the polycurve.
*/
typedef unspecified_type Segment_const_iterator;
typedef unspecified_type Subcurve_const_iterator;
/*! A bidirectional constant iterator that allows traversing
* the segments that comprise the polycurve.
* the subcurves that comprise the polycurve.
*/
typedef unspecified_type Segment_const_reverse_iterator;
typedef unspecified_type Subcurve_const_reverse_iterator;
/// @} /* End of Types */
@ -334,25 +334,25 @@ namespace CGAL {
*/
Curve_2();
/*! Construct a polycurve from one segment.
/*! Construct a polycurve from one subcurve.
*/
Curve_2(const Segment_2 seg);
Curve_2(const Subcurve_2 subcurve);
/*! Construct a polycurve defined by the given range of segments
/*! Construct a polycurve defined by the given range of subcurves
* `[first, last)` (the value-type of `InputIterator` must be
* `GeometryTraits_2::Curve_2`. In general, the segments might not
* `SubcurveTraits_2::Curve_2`. In general, the subcurves might not
* be \f$x\f$-monotone, furthermore, they might not form a
* continuous polycurve.
*
* \pre The segments in the range should form a continuous and
* \pre The subcurves in the range should form a continuous and
* well-oriented polycurve.
*
* \deprecated For backwards compatibility, it is
* possible to call this constructor with a range whose
* value-type is `GeometryTraits_2::Point_2`. In this case, the
* value-type is `SubcurveTraits_2::Point_2`. In this case, the
* constructed polycurve will concatenate the \f$n\f$th point
* with the \f$(n+1)\f$-st point in the range (using a
* `GeometryTraits_2::Segment_2`'s). This functionality is \a deprecated.
* `SubcurveTraits_2::Subcurve_2`'s). This functionality is \a deprecated.
* Instead use the `Construct_curve_2` functors.
*/
template <typename InputIterator>
@ -364,9 +364,9 @@ namespace CGAL {
/// @{
/*! \deprecated
* Obtain the number of segment end-points that comprise the polycurve.
* Obtain the number of subcurve end-points that comprise the polycurve.
* Note that for a bounded polycurve, if there are \f$ n\f$ points in the
* polycurve, it is comprised of \f$ (n - 1)\f$ segments.
* polycurve, it is comprised of \f$ (n - 1)\f$ subcurves.
* Currently, only bounded polycurves are supported.
*/
unsigned_int points() const;
@ -376,53 +376,53 @@ namespace CGAL {
*/
const_iterator begin() const;
/*! Obtain an iterator pointing at the first segment of the polycurve.
/*! Obtain an iterator pointing at the first subcurve of the polycurve.
*/
Segment_const_iterator begin_segments() const;
Subcurve_const_iterator begin_subcurves() const;
/*! \deprecated
* Obtain an iterator pointing after the end of the polycurve.
*/
const_iterator end() const;
/*! Get an iterator pointing at the past-the-end segment of the polycurve.
/*! Get an iterator pointing at the past-the-end subcurve of the polycurve.
*/
Segment_const_iterator end_segments() const;
Subcurve_const_iterator end_subcurves() const;
/*! \deprecated
* Obtain an iterator pointing at the target point of the polycurve.
*/
const_iterator rbegin() const;
/*! Obtain an iterator pointing at the last segment of the polycurve.
/*! Obtain an iterator pointing at the last subcurve of the polycurve.
*/
Segment_const_reverse_iterator rbegin_segments() const;
Subcurve_const_reverse_iterator rbegin_subcurves() const;
/*! \deprecated
* Obtain an iterator pointing before the beginning of the polycurve.
*/
const_iterator rend() const;
/*! Obtain an iterator pointing at the past-the-end segment of
/*! Obtain an iterator pointing at the past-the-end subcurve of
* the polycurve in reverse order.
*/
Segment_const_reverse_iterator rend_segments() const;
Subcurve_const_reverse_iterator rend_subcurves() const;
/*! \deprecated
* Obtain the number of segments composing the polycurve
* (equivalent to `pi.points() - 1`). Was replaced by number_of_segments()
* Obtain the number of subcurves composing the polycurve
* (equivalent to `pi.points() - 1`). Was replaced by number_of_subcurves()
*/
Segments_size_type size() const;
size_type size() const;
/*! Obtain the number of segments that comprise the polycurve.
/*! Obtain the number of subcurves that comprise the polycurve.
*/
Segments_container_size number_of_segments() const;
size_type number_of_subcurves() const;
/*! Obtain the \f$ k\f$th segment of the polycurve.
/*! Obtain the \f$ k\f$th subcurve of the polycurve.
* \pre \f$k\f$ is not greater then or equal to \f$n-1\f$, where
* \f$n\f$ is the number of segments.
* \f$n\f$ is the number of subcurves.
*/
typename GeometryTraits_2::X_monotone_curve_2
typename SubcurveTraits_2::X_monotone_curve_2
operator[](size_t k) const;
/*! Obtain the bounding box of the polycurve.
@ -434,30 +434,32 @@ namespace CGAL {
/// \name Operations
/// @{
/*! Append a segment to the polycurve at the back.
/*! Append a subcurve to the polycurve at the back.
* \a Warning: This function does not preform the precondition test
* that the `Push_back_2` functor does. Thus, it is
* recommended to use the latter.
* \param seg The new segment to be appended to the polycurve.
* \pre If the polycurve is not empty, the source of `seg` must coincide
* with the target point of the last segment in the polycurve.
* \param subcurve The new subcurve to be appended to the polycurve.
* \pre If the polycurve is not empty, the source of `subcurve` must
* coincide with the target point of the last subcurve in the
* polycurve.
*/
inline void push_back(const Segment_2& seg);
inline void push_back(const Subcurve_2& subcurve);
/*! Append a segment to the polycurve at the front.
/*! Append a subcurve to the polycurve at the front.
* \a Warning: This is a risky function! Don't use it! Prefer the
* corresponding functor which is provided in the traits
* class.
* \param seg The new segment to be appended to the polycurve.
* \pre If the polycurve is not empty, the target of `seg` must coincide
* with the source point of the first segment in the polycurve.
* \param subcurve The new subcurve to be appended to the polycurve.
* \pre If the polycurve is not empty, the target of `subcurve` must
* coincide with the source point of the first subcurve in the
* polycurve.
*/
inline void push_front(const Segment_2& seg);
inline void push_front(const Subcurve_2& subcurve);
/*! \deprecated
* Add a new point to the polycurvs, which becomes the new target point
* of `pi`.
* \pre GeometryTraits_2 is a model of
* \pre SubcurveTraits_2 is a model of
* ArrangementConstructXMonotoneCurveTraits_2.
*/
void push_back(const Point_2 & p);
@ -472,15 +474,15 @@ namespace CGAL {
/*! The `X_monotone_curve_2` class nested within the polycurve
* traits is used to represent \f$ x\f$-monotone piecewise linear segments.
* traits is used to represent \f$ x\f$-monotone piecewise linear subcurves.
*
* It inherits from the `Curve_2` type. `X_monotone_curve_2` can be
* constructed just like `Curve_2`. However, there is precondition
* (which is not tested) that the input defines an \f$
* x\f$-monotone polycurve. Furthermore, in contrast to the general
* `Curve_2` type, in this case, the segments that an
* `Curve_2` type, in this case, the subcurves that an
* `X_monotone_curve_2` comprises have to be instances of the type
* `GeometryTraits_2::X_monotone_curve_2`. Note that the \f$
* `SubcurveTraits_2::X_monotone_curve_2`. Note that the \f$
* x\f$-monotonicity ensures that an \f$ x\f$-monotone polycurve
* is not self-intersecting. (A self-intersecting polycurve is
* subdivided into several interior-disjoint \f$x\f$-monotone subcurves).
@ -490,7 +492,7 @@ namespace CGAL {
* lexicographical \f$ xy\f$-order) or left-to-right (and in this case the
* vertices are stored in a descending lexicographical \f$ xy\f$-order).
*/
template <typename Segment_type_2_T, typename Point_type_2_T>
template <typename SubcurveType_2, typename PointType_2>
class X_monotone_curve_2 {
}; /* end Arr_polycurve_traits_2::X_monotone_curve_2 */

View File

@ -84,7 +84,8 @@ namespace CGAL {
* \cgalModels `ArrangementApproximateTraits_2` (if the type that substitutes
* the template parameter `SegmentTraits_2` models the concept as well)
*
* \sa `Arr_Bezier_curve_traits_2<RatKernel,AlgKernel,NtTraits>`
* \sa `Arr_polycurve_traits_2<SubcurveTraits_2>`
* \sa `Arr_Bezier_curve_traits_2<RatKernel, AlgKernel, NtTraits>`
* \sa `Arr_circle_segment_traits_2<Kernel>`
* \sa `Arr_conic_traits_2<RatKernel, AlgKernel, NtTraits>`
* \sa `Arr_linear_traits_2<Kernel>`
@ -94,21 +95,22 @@ namespace CGAL {
*/
template <typename SegmentTraits_2>
class Arr_polyline_traits_2 {
class Arr_polyline_traits_2 : public Arr_polycurve_traits_2<SegmentTraits_2>{
public:
/// \name Types
/// @{
/*!
*/
typedef SegmentTraits_2 Segment_traits_2;
// TODO: Have to turn these into links, so whenever I mention Point_2 it
// will point here and *not* to Kernel::Point_2 for instance.
typedef SegmentTraits_2::Point_2 Point_2;
typedef SegmentTraits_2::Point_2 Point_2;
/*!
*/
typedef SegmentTraits_2::Curve_2 Segment_2;
typedef SegmentTraits_2::X_monotone_curve_2 X_monotone_segment_2;
typedef SegmentTraits_2::Curve_2 Segment_2;
typedef SegmentTraits_2::X_monotone_curve_2 X_monotone_segment_2;
/// @}
/*! Construction functor of a general (not necessarily \f$x\f$-monotone)
@ -168,12 +170,7 @@ namespace CGAL {
*/
class Construct_x_monotone_curve_2 {};
/*! Function object which returns the number of points of a polyline.
*/
class Number_of_points_2 {};
/*!
* Functor to augment a polyline by either adding a vertex or a segment
/*! Functor to augment a polyline by either adding a vertex or a segment
* at the back.
*/
class Push_back_2 {
@ -273,260 +270,6 @@ namespace CGAL {
/// @} /* end of operations */
}; /* end of Arr_polyline_traits_2::Push_front_2 */
class Trim_2 {
public:
/*! Obtain a trimmed version of the polycurve with src and tgt as end
* vertices.
* Src and tgt will be swaped if they do not conform to the direction of
* the polycurve.
*/
X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv,
const Point_2& src,
const Point_2& tgt) const;
};
/*! Subdivide the given curve into x-monotone sub-curves and insert them
* into the given output iterator. Since the segments that
* constitute a general polyline are not necessarily
* \f$x\f$-monotone, this functor may break them.
*/
class Make_x_monotone_2 {
public:
/*! \pre if `cv` is not empty then it must be continuous and well-oriented.
* \param cv The curve.
* \param oi The output iterator, whose value-type is Object. The output
* object is a wrapper of a X_monotone_curve_2 objects.
* \return The past-the-end iterator.
*/
template <typename OutputIterator>
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const;
};
/*! The `Curve_2` type nested in the `Arr_polyline_traits_2` represents
* general continuous piecewise-linear curves (a polyline can be
* self-intersecting) and support their construction from range of
* segments. Construction of polylines in various ways is supported using the
* construction functors. <em>It is strongly recommended to avoid
* construction of `Curve_2` objects directly and prefer the usage of the
* construction functors.</em> The type `Curve_2` has two template
* parameters, namely `Segment_type_T` and `Point_type_T`, which are
* `SegmentTraits_2::Curve_2` and `SegmentTraits_2::Point_2` types. Thus, in
* general, the segments that a `Curve_2` instance comprises could be either
* \f$x\f$-monotone or not!
*
* The copy and default constructor as well as the assignment
* operator are provided for polyline curves. In addition, an \link
* PkgArrangement2op_left_shift `operator<<` \endlink for the
* curves is defined for standard output streams, and an \link
* PkgArrangement2op_right_shift `operator>>` \endlink for the
* curves is defined for standard input streams.
*/
template <typename Segment_type_T, typename Point_type_T>
class Curve_2 {
public:
protected:
/// \name Types
/// @{
/*! The container of the segments that comprises the polyline.
*/
typedef typename std::vector<Segment_2> Segments_container;
public:
/*! The size of the container that comprises the polylines.
*/
typedef typename Segments_container::size_type Segments_size_type;
/*! \deprecated
* A bidirectional iterator that allows traversing the points
* that comprise a polyline curve.
*/
typedef unspecified_type const_iterator;
/*! \deprecated
* A bidirectional iterator that allows traversing the points
* that comprise a polyline curve.
*/
typedef unspecified_type const_reverse_iterator;
/*! A bidirectional constant iterator that allows traversing
* the segments the comprise the polyline.
*/
typedef unspecified_type Segment_const_iterator;
/*! A bidirectional constant iterator that allows traversing
* the segments the comprise the polyline.
*/
typedef unspecified_type Segment_const_reverse_iterator;
/// @} /* End of Types */
/// \name Creation
/// @{
/*! Default constructor that constructs an empty polyline.
*/
Curve_2();
/*! Construct a polyline from one segment.
*/
Curve_2(const Segment_2 seg);
/*! Construct a polyline defined by the given range of segments
* `[first, last)` (the value-type of `InputIterator` must be
* `SegmentTraits_2::Curve_2`. In general, the segments might not be
* \f$x\f$-monotone, furthermore, they might not form a continuous
* polyline.
*
* \pre The segments in the range should form a continuous and
* well-oriented polyline.
*
* \deprecated For backwards compatibility, it is
* possible to call this constructor with a range whose
* value-type is `SegmentTraits_2::Point_2`. In this case, the
* constructed polyline will concatenate the \f$n\f$th point
* with the \f$(n+1)\f$-st point in the range (using a
* `SegmentTraits_2::Segment_2`'s). This functionality is \a deprecated.
* Instead use the `Construct_curve_2` functors.
*/
template <typename InputIterator>
Curve_2(Iterator first, Iterator last);
/// @} /* End of Creation */
/// \name Access Functions
/// @{
/*! \deprecated Obtain the number of points that comprise the polyline.
* Note that for a bounded polyline, if there are \f$ n\f$ points in the
* polyline, it is comprised of \f$ (n - 1)\f$ segments.
* Currently, only bounded polylines are supported.
*/
unsigned_int points() const;
/*! \deprecated Obtain an iterator pointing at the source point of the
* polyline.
*/
const_iterator begin() const;
/*! Obtain an iterator pointing at the first segment of the polyline.
*/
Segment_const_iterator begin_segments() const;
/*! \deprecated Obtain an iterator pointing after the end of the polyline.
*/
const_iterator end() const;
/*! Obtain an iterator pointing at the past-the-end segment of the
* polyline.
*/
Segment_const_iterator end_segments() const;
/*! \deprecated Obtain an iterator pointing at the target point of the
* polyline.
*/
const_iterator rbegin() const;
/*! Obtain an iterator pointing at the last segment of the polyline.
*/
Segment_const_reverse_iterator rbegin_segments() const;
/*! \deprecated Obtain an iterator pointing before the beginning of the
* polyline.
*/
const_iterator rend() const;
/*!
* Obtain an iterator pointing at the past-the-end segment of
* the polyline in reverse order.
*/
Segment_const_reverse_iterator rend_segments() const;
/*! \deprecated Obtain the number of line segments composing the polyline
* (equivalent to `pi.points() - 1`). Was replaced by number_of_segments()
*/
Segments_size_type size() const;
/*! Obtain the number of segments that comprise the polyline.
*/
Segments_container_size number_of_segments() const;
/*! Obtain the \f$ k\f$th segment of the polyline.
* \pre \f$k\f$ is not greater then or equal to \f$n-1\f$, where
* \f$n\f$ is the number of segments.
*/
typename SegmentTraits_2::X_monotone_curve_2 operator[](size_t k) const;
/*!
* the bounding box of the polyline.
*/
Bbox_2 bbox() const;
/// @} /* End of Access functions */
/// \name Operations
/// @{
/*! Append a segment to the polyline at the back.
* \a Warning: This function does not preform the precondition test
that the `Push_back_2` functor does. Thus, it is
recommended to use the latter.
* \param seg The new segment to be appended to the polyline.
* \pre If the polyline is not empty, the source of `seg` must coincide
* with the target point of the last segment in the polyline.
*/
inline void push_back(const Segment_2& seg);
/*! Append a segment to the polyline at the front.
* \a Warning: This is a risky function! Don't use it! Prefer the
* corresponding functor which is provided in the traits
* class.
* \param seg The new segment to be appended to the polyline.
* \pre If the polyline is not empty, the target of `seg` must coincide
* with the source point of the first segment in the polyline.
*/
inline void push_front(const Segment_2& seg);
/*! \deprecated adds a new point to the polyline, which becomes the new
* target point of `pi`.
*/
void push_back(const Point_2& p);
/*! Reset the polyline.
*/
void clear();
/// @} /* End of Operations */
}; /* end Arr_polyline_traits_2::Curve_2 */
/*! The `X_monotone_curve_2` class nested within the polyline
* traits is used to represent \f$ x\f$-monotone piecewise linear
* curves.
*
* It inherits from the `Curve_2` type. `X_monotone_curve_2` can be
* constructed just like `Curve_2`. However, there is precondition
* (which is not tested) that the input defines an \f$
* x\f$-monotone polyline. Furthermore, in contrast to the general
* `Curve_2` type, in this case, the segments that an
* `X_monotone_curve_2` comprises have to be instances of the type
* `SegmentTraits_2::X_monotone_curve_2`. Note that the \f$
* x\f$-monotonicity ensures that an \f$ x\f$-monotone polyline
* is not self-intersecting. (A self-intersecting polyline is
* subdivided into several interior-disjoint \f$x\f$-monotone subcurves).
*
* The defined \f$ x\f$-monotone polyline can be directed either from
* right-to-left (and in turn its vertices are stored in an ascending
* lexicographical \f$ xy\f$-order) or left-to-right (and in this case the
* vertices are stored in a descending lexicographical \f$ xy\f$-order).
*/
template <typename Segment_type_2_T, typename Point_type_2_T>
class X_monotone_curve_2 {
}; /* end Arr_polyline_traits_2::X_monotone_curve_2 */
/// \name Accessing Functor Objects
/// @{
@ -538,10 +281,6 @@ namespace CGAL {
*/
Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const;
/*!
*/
Number_of_points_2 number_of_points_2_object() const;
/*!
*/
Push_back_2 push_back_2_object() const;
@ -550,10 +289,6 @@ namespace CGAL {
*/
Push_front_2 push_front_2_object() const;
/*!
*/
Make_x_monotone_2 make_x_monotone_2_object() const;
/// @} /* End Accessing Functor Objects */
}; /* end Arr_polyline_traits_2 */

View File

@ -545,6 +545,10 @@ returning constant iterators instead of mutable ones.
*/
Vertex_iterator vertices_end();
/*!
returns a range over handles of the arrangement vertices .
*/
unspecified_type vertex_handles();
/*!
returns the number of arrangement vertices that lie at infinity and
are not associated with valid points. Such vertices are not considered
@ -578,6 +582,11 @@ returning constant iterators instead of mutable ones.
*/
Halfedge_iterator halfedges_end();
/*!
returns a range over handles of the arrangement halfedges .
*/
unspecified_type halfedge_handles();
/*!
returns the number of edges in the arrangement (equivalent to
`arr.number_of_halfedges() / 2`).
@ -594,6 +603,10 @@ returning constant iterators instead of mutable ones.
*/
Edge_iterator edges_end();
/*!
returns a range over handles of the arrangement edges .
*/
unspecified_type edge_handles();
/// @}
@ -627,6 +640,11 @@ returning constant iterators instead of mutable ones.
*/
Face_iterator faces_end();
/*!
returns a range over handles of the arrangement faces .
*/
unspecified_type face_handles();
/*!
returns the number of unbounded faces in the arrangement.
Note `arr.number_of_faces()` also counts the unbounded faces

View File

@ -163,6 +163,11 @@ returns a past-the-end iterator of the vertices in `dcel`.
*/
Vertex_iterator vertices_end();
/*!
returns a range over handles of the vertices in `dcel`.
*/
unspecified_type vertex_handles();
/*!
returns a begin-iterator of the vertices in `dcel`.
*/
@ -173,6 +178,11 @@ returns a past-the-end iterator of the vertices in `dcel`.
*/
Vertex_const_iterator vertices_end() const;
/*!
returns a const range (model of `ConstRange`) over handles of the vertices in `dcel`.
*/
unspecified_type vertex_handles() const;
/*!
returns a begin-iterator of the halfedges in `dcel`.
*/
@ -183,6 +193,11 @@ returns a past-the-end iterator of the halfedges in `dcel`.
*/
Halfedge_iterator halfedges_end();
/*!
returns a range over handles of the halfedges in `dcel`.
*/
unspecified_type halfedge_handles();
/*!
returns a begin-iterator of the halfedges in `dcel`.
*/
@ -193,6 +208,11 @@ returns a past-the-end iterator of the halfedges in `dcel`.
*/
Halfedge_const_iterator halfedges_end() const;
/*!
returns a const range (model of `ConstRange`) over handles of the halfedges in `dcel`.
*/
unspecified_type halfedge_handles() const;
/*!
returns a begin-iterator of the faces in `dcel`.
*/
@ -203,6 +223,11 @@ returns a past-the-end iterator of the faces in `dcel`.
*/
Face_iterator faces_end();
/*!
returns a range over handles of the faces in `dcel`.
*/
unspecified_type face_handles();
/*!
returns a begin-iterator of the faces in `dcel`.
*/
@ -213,6 +238,10 @@ returns a past-the-end iterator of the faces in `dcel`.
*/
Face_const_iterator faces_end() const;
/*!
returns a const range (model of `ConstRange`) over handles of the faces in `dcel`.
*/
unspecified_type face_handles() const;
/// @}

View File

@ -1011,24 +1011,64 @@ public:
//@{
Vertex_iterator vertices_begin() { return vertices.begin(); }
Vertex_iterator vertices_end() { return vertices.end(); }
Iterator_range<Prevent_deref<Vertex_iterator> >
vertex_handles()
{
return make_prevent_deref_range(vertices_begin(), vertices_end());
}
Halfedge_iterator halfedges_begin() { return halfedges.begin();}
Halfedge_iterator halfedges_end() { return halfedges.end(); }
Iterator_range<Prevent_deref<Halfedge_iterator> >
halfedge_handles()
{
return make_prevent_deref_range(halfedges_begin(), halfedges_end());
}
Face_iterator faces_begin() { return faces.begin(); }
Face_iterator faces_end() { return faces.end(); }
Iterator_range<Prevent_deref<Face_iterator> >
face_handles()
{
return make_prevent_deref_range(faces_begin(), faces_end());
}
Edge_iterator edges_begin() { return halfedges.begin(); }
Edge_iterator edges_end() { return halfedges.end(); }
Iterator_range<Prevent_deref<Edge_iterator> >
edge_handles()
{
return make_prevent_deref_range(edges_begin(), edges_end());
}
//@}
/// \name Obtaining constant iterators.
//@{
Vertex_const_iterator vertices_begin() const { return vertices.begin(); }
Vertex_const_iterator vertices_end() const { return vertices.end(); }
Iterator_range<Prevent_deref<Vertex_const_iterator> >
vertex_handles() const
{
return make_prevent_deref_range(vertices_begin(), vertices_end());
}
Halfedge_const_iterator halfedges_begin() const { return halfedges.begin(); }
Halfedge_const_iterator halfedges_end() const { return halfedges.end(); }
Iterator_range<Prevent_deref<Halfedge_const_iterator> >
halfedge_handles() const
{
return make_prevent_deref_range(halfedges_begin(), halfedges_end());
}
Face_const_iterator faces_begin() const { return faces.begin(); }
Face_const_iterator faces_end() const { return faces.end(); }
Iterator_range<Prevent_deref<Face_const_iterator> >
face_handles() const
{
return make_prevent_deref_range(faces_begin(), faces_end());
}
Edge_const_iterator edges_begin() const { return halfedges.begin(); }
Edge_const_iterator edges_end() const { return halfedges.end(); }
Iterator_range<Prevent_deref<Edge_const_iterator> >
edge_handles() const
{
return make_prevent_deref_range(edges_begin(), edges_end());
}
//@}
// \name Creation of new DCEL features.

View File

@ -23,17 +23,15 @@
#include <CGAL/license/Arrangement_on_surface_2.h>
/*! \file
* Definition of the Arr_face_index_map<Arrangement> class.
*/
#if (defined __GNUC__)
#warning Arr_face_map.h is DEPRECATED, please include Arr_face_index_map.h instead
#elif (defined _MSC_VER)
#pragma message("Arr_face_map.h is DEPRECATED, please include Arr_face_index_map.h instead")
#endif
#define CGAL_DEPRECATED_HEADER "<CGAL/Arr_face_map.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Arr_face_index_map.h>"
#include <CGAL/internal/deprecation_warning.h>
#include <CGAL/Arr_face_index_map.h>
/*! \file
* Definition of the Arr_face_index_map<Arrangement> class.
*/
#endif

View File

@ -2936,7 +2936,7 @@ public:
CGAL_precondition(!kernel.equal_3_object()(source, target));
CGAL_precondition(!kernel.equal_3_object()
(kernel.construct_opposite_direction_3_object()(source),
target));
static_cast<const Direction_3&>(target)));
this->m_normal = this->construct_normal_3(source, target);
// Check whether one of the endpoints coincides with a pole: */

View File

@ -401,7 +401,7 @@ public:
NT y3 = p3.y();
// Make sure that the source and the taget are not the same.
// Make sure that the source and the target are not the same.
CGAL_precondition (Kernel().compare_xy_2_object() (p1, p3) != EQUAL);
// Compute the lines: A1*x + B1*y + C1 = 0,
@ -532,7 +532,7 @@ public:
/*!
* Get the vertical tangency points the arc contains.
* \param vpts Output: The vertical tagnecy points.
* \param vpts Output: The vertical tangency points.
* \pre The curve is circular.
* \return The number of points (0, 1, or 2).
*/
@ -593,8 +593,8 @@ private:
/*!
* Get the vertical tangency points the arc contains, assuming it is
* counterclockwise oreinted.
* \param vpts Output: The vertical tagnecy points.
* counterclockwise oriented.
* \param vpts Output: The vertical tangency points.
* \return The number of points (0, 1, or 2).
*/
unsigned int _ccw_vertical_tangency_points (const Point_2& src,

View File

@ -19,6 +19,11 @@
#include <CGAL/license/Arrangement_on_surface_2.h>
#define CGAL_DEPRECATED_HEADER "<CGAL/Arr_geometry_traits/Polyline_2.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Arr_geometry_traits/Polycurve_2.h>"
#include <CGAL/internal/deprecation_warning.h>
#include <CGAL/Arr_geometry_traits/Polycurve_2.h>
/*! \file
* Header file for the polyline classes used by the
@ -26,12 +31,6 @@
* Arr_polyline_traits_2 classes.
*/
#if (defined __GNUC__)
#warning Polyline_2.h is DEPRECATED, please include Polycurve_2.h instead
#elif (defined _MSC_VER)
#pragma message("Polyline_2.h is DEPRECATED, please include Polycurve_2.h instead")
#endif
#include <CGAL/Arr_geometry_traits/Polycurve_2.h>
namespace CGAL {

View File

@ -23,17 +23,16 @@
#include <CGAL/license/Arrangement_on_surface_2.h>
#define CGAL_DEPRECATED_HEADER "<CGAL/Arr_overlay.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Arr_overlay_2.h>"
#include <CGAL/internal/deprecation_warning.h>
#include <CGAL/Arr_overlay_2.h>
/*! \file
* Helping file to include Arr_overlay_2 for backward compatibility.
*/
#if (defined __GNUC__)
#warning Arr_overlay.h is DEPRECATED, please include Arr_overlay_2.h instead
#elif (defined _MSC_VER)
#pragma message("Arr_overlay.h is DEPRECATED, please include Arr_overlay_2.h instead")
#endif
#include <CGAL/Arr_overlay_2.h>
#endif

View File

@ -50,6 +50,10 @@ class Arr_polyline_traits_2 : public Arr_polycurve_traits_2<SegmentTraits_2> {
public:
typedef SegmentTraits_2 Segment_traits_2;
// For completeness
typedef typename Segment_traits_2::Curve_2 Segment_2;
typedef typename Segment_traits_2::X_monotone_curve_2 X_monotone_segment_2;
private:
typedef Arr_polyline_traits_2<Segment_traits_2> Self;
typedef Arr_polycurve_traits_2<Segment_traits_2> Base;
@ -72,7 +76,7 @@ public:
typedef typename Base::Are_all_sides_oblivious_tag
Are_all_sides_oblivious_tag;
typedef typename Base::X_monotone_subcurve_2 X_monotone_subcurve_2;
typedef typename Base::X_monotone_subcurve_2 X_monotone_subcurve_2;
typedef typename Base::Subcurve_2 Subcurve_2;
typedef typename Base::Point_2 Point_2;
@ -133,7 +137,7 @@ public:
*/
class Push_back_2 : public Base::Push_back_2 {
protected:
typedef Arr_polyline_traits_2<SegmentTraits_2> Polyline_traits_2;
typedef Arr_polyline_traits_2<Segment_traits_2> Polyline_traits_2;
public:
/*! Constructor. */
@ -246,7 +250,7 @@ public:
*/
class Push_front_2 : public Base::Push_front_2 {
protected:
typedef Arr_polyline_traits_2<SegmentTraits_2> Polyline_traits_2;
typedef Arr_polyline_traits_2<Segment_traits_2> Polyline_traits_2;
public:
/*! Constructor. */
@ -300,7 +304,7 @@ public:
/*! Append a point `p` to an existing polyline `xcv` at the front. */
void operator()(const X_monotone_curve_2& xcv, Point_2& p) const
{
const SegmentTraits_2* geom_traits =
const Segment_traits_2* geom_traits =
this->m_poly_traits.subcurve_traits_2();
CGAL_precondition_code
(

View File

@ -335,7 +335,6 @@ private:
virtual void handle_new_edge(typename Base::Halfedge_handle edge)
{
typedef typename Base::Face_handle Arr_face_handle;
typedef typename Base::Vertex_handle Arr_vertex_handle;
Arr_face_handle src_face = edge->twin()->face();
Arr_face_handle trg_face = edge->face();

View File

@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Efi Fogel <efif@post.tau.ac.il>
@ -160,7 +160,7 @@ public:
/*! Set the vertex */
void set_vertex(Arr_vertex_handle vertex) { m_vertex = vertex; }
/*! Set the "marked" flag */
void set_marked(bool marked) { m_marked = marked; }
@ -218,4 +218,22 @@ struct Arr_polyhedral_sgm_polyhedron_3 :
} //namespace CGAL
//! Make the polyhedron a model of FaceGraph
namespace boost {
template <typename Sgm, typename Traits>
struct graph_traits<CGAL::Arr_polyhedral_sgm_polyhedron_3<Sgm, Traits> > :
public graph_traits<CGAL::Polyhedron_3
<Traits, CGAL::Arr_polyhedral_sgm_polyhedron_items<Sgm> > >
{};
template <typename Sgm, typename Traits, typename Tag>
struct property_map<CGAL::Arr_polyhedral_sgm_polyhedron_3<Sgm, Traits>, Tag> :
public property_map<CGAL::Polyhedron_3
<Traits, CGAL::Arr_polyhedral_sgm_polyhedron_items<Sgm> >,
Tag>
{};
}
#endif

View File

@ -24,17 +24,16 @@
#include <CGAL/license/Arrangement_on_surface_2.h>
#define CGAL_DEPRECATED_HEADER "<CGAL/Arr_vertex_map.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Arr_vertex_index_map.h>"
#include <CGAL/internal/deprecation_warning.h>
#include <CGAL/Arr_vertex_index_map.h>
/*! \file
* Definition of the Arr_vertex_index_map<Arrangement> class.
*/
#if (defined __GNUC__)
#warning Arr_vertex_map.h is DEPRECATED, please include Arr_vertex_index_map.h instead
#elif (defined _MSC_VER)
#pragma message("Arr_vertex_map.h is DEPRECATED, please include Arr_vertex_index_map.h instead")
#endif
#include <CGAL/Arr_vertex_index_map.h>
#endif

View File

@ -1024,6 +1024,15 @@ public:
_Is_concrete_vertex(&m_topol_traits)));
}
/*!
returns a range over handles of the arrangement vertices .
*/
Iterator_range<Prevent_deref<Vertex_iterator> >
vertex_handles()
{
return make_prevent_deref_range(vertices_begin(), vertices_end());
}
/*! Get a const iterator for the first vertex in the arrangement. */
Vertex_const_iterator vertices_begin() const
{
@ -1039,6 +1048,16 @@ public:
_dcel().vertices_end(),
_Is_concrete_vertex(&m_topol_traits)));
}
/*!
returns a const range (model of `ConstRange`) over handles of the arrangement vertices .
*/
Iterator_range<Prevent_deref<Vertex_iterator> >
vertex_handles() const
{
return make_prevent_deref_range(vertices_begin(), vertices_end());
}
//@}
/// \name Traversal functions for the arrangement halfedges.
@ -1060,6 +1079,15 @@ public:
_Is_valid_halfedge(&m_topol_traits)));
}
/*!
returns a range over handles of the arrangement halfedges .
*/
Iterator_range<Prevent_deref<Halfedge_iterator> >
halfedge_handles()
{
return make_prevent_deref_range(halfedges_begin(), halfedges_end());
}
/*! Get a const iterator for the first halfedge in the arrangement. */
Halfedge_const_iterator halfedges_begin() const
{
@ -1075,6 +1103,14 @@ public:
_dcel().halfedges_end(),
_Is_valid_halfedge(&m_topol_traits)));
}
/*!
returns a const range (model of `ConstRange`) over handles of the arrangement halfedges .
*/
Iterator_range<Prevent_deref<Halfedge_iterator> >
halfedge_handles() const
{
return make_prevent_deref_range(halfedges_begin(), halfedges_end());
}
//@}
/// \name Traversal functions for the arrangement edges.
@ -1094,6 +1130,15 @@ public:
_Is_valid_halfedge(&m_topol_traits)));
}
/*!
returns a range over handles of the arrangement edges .
*/
Iterator_range<Prevent_deref<Edge_iterator> >
edge_handles()
{
return make_prevent_deref_range(edges_begin(), edges_end());
}
/*! Get a const iterator for the first edge in the arrangement. */
Edge_const_iterator edges_begin() const
{
@ -1107,6 +1152,15 @@ public:
return (Edge_const_iterator(_dcel().edges_end(), _dcel().edges_end(),
_Is_valid_halfedge(&m_topol_traits)));
}
/*!
returns a const range (model of `ConstRange`) over handles of the arrangement edges .
*/
Iterator_range<Prevent_deref<Edge_iterator> >
edge_handles() const
{
return make_prevent_deref_range(edges_begin(), edges_end());
}
//@}
/// \name Traversal functions for the arrangement faces.
@ -1126,6 +1180,14 @@ public:
_Is_valid_face(&m_topol_traits)));
}
/*!
returns a range over handles of the arrangement faces .
*/
Iterator_range<Prevent_deref<Face_iterator> >
face_handles()
{
return make_prevent_deref_range(faces_begin(), faces_end());
}
/*! Get a const iterator for the first face in the arrangement. */
Face_const_iterator faces_begin() const
{
@ -1140,6 +1202,14 @@ public:
_Is_valid_face(&m_topol_traits)));
}
/*!
returns a const range (model of `ConstRange`) over handles of the arrangement faces .
*/
Iterator_range<Prevent_deref<Face_iterator> >
face_handles() const
{
return make_prevent_deref_range(faces_begin(), faces_end());
}
//! reference_face (const version).
/*! The function returns a reference face of the arrangement.
* All reference faces of arrangements of the same type have a common

View File

@ -581,8 +581,8 @@ function(test_segment_traits_adaptor)
compile_test_with_flags(test_traits_adaptor segments "${flags}")
# if [ -n "${SUCCESS}" ] ; then
execute_commands_traits_adaptor( segments segments_traits_adaptor
COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT
execute_commands_traits_adaptor( segments segments_traits_adaptor
COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT
ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW)
endfunction()
@ -597,8 +597,8 @@ function(test_linear_traits_adaptor)
compile_test_with_flags( test_traits_adaptor linear "${flags}")
execute_commands_traits_adaptor( linear linear_traits_adaptor
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
execute_commands_traits_adaptor( linear linear_traits_adaptor
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT)
endfunction()
@ -614,8 +614,8 @@ function(test_spherical_arcs_traits_adaptor)
compile_test_with_flags( test_traits_adaptor geodesic_arcs_on_sphere "${flags}")
execute_commands_traits_adaptor( spherical_arcs spherical_arcs_traits_adaptor
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
execute_commands_traits_adaptor( spherical_arcs spherical_arcs_traits_adaptor
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT)
endfunction()
@ -1365,3 +1365,5 @@ compile_and_run(test_unbounded_removal)
compile_and_run(test_spherical_removal)
compile_and_run(test_io)
compile_and_run(test_sgm)

View File

@ -1711,6 +1711,8 @@ compile_and_run test_spherical_removal
compile_and_run test_io
compile_and_run test_sgm
# if any error occured then append the full error description file to error file
if [ -f $FULL_ERROR_DESCRIPTION_FILE ] ; then

View File

@ -0,0 +1,69 @@
#define CGAL_IDENTIFICATION_XY 2
// Testing the spherical gaussian map
#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h>
#include <CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h>
#include <CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Arr_polyhedral_sgm_traits<Kernel> Gm_traits;
typedef CGAL::Arr_polyhedral_sgm<Gm_traits> Gm;
typedef CGAL::Arr_polyhedral_sgm_polyhedron_3<Gm, Kernel> Gm_polyhedron;
typedef CGAL::Arr_polyhedral_sgm_initializer<Gm, Gm_polyhedron> Gm_initializer;
int main()
{
// Construct the Gaussian map of a tetrahedron
Point_3 points[] = {
Point_3(1.0, 0.0, 0.0),
Point_3(0.0, 1.0, 0.0),
Point_3(0.0, 0.0, 1.0),
Point_3(0.0, 0.0, 0.0)
};
Gm_polyhedron P1;
CGAL::convex_hull_3(points, &points[4], P1);
Gm gm1;
Gm_initializer gm_initializer1(gm1);
gm_initializer1(P1);
if (! gm1.is_valid()) return -1;
// Construct the Gaussian map of the reflection of a tetrahedron
Gm_polyhedron P2;
for (Point_3* p = points; p != &points[4]; ++p) {
Kernel::Vector_3 v = CGAL::ORIGIN - *p;
*p = CGAL::ORIGIN + v;
}
CGAL::convex_hull_3(points, &points[4], P2);
Gm gm2;
Gm_initializer gm_initializer2(gm2);
gm_initializer2(P2);
if (! gm2.is_valid()) return -1;
// Compute the Minowski sum of the Gaussian maps
Gm gm;
gm.minkowski_sum(gm1, gm2);
if (! gm.is_valid()) return -1;
Kernel::FT sw(16);
Gm::Vertex_const_handle it;
for (it = gm.vertices_begin(); it != gm.vertices_end(); ++it) {
if (it->degree() < 3) continue;
Gm::Halfedge_around_vertex_const_circulator hec3(it->incident_halfedges());
Gm::Halfedge_around_vertex_const_circulator hec1 = hec3++;
Gm::Halfedge_around_vertex_const_circulator hec2 = hec3++;
Kernel::Plane_3 plane((*hec1).face()->point(), (*hec2).face()->point(),
(*hec3).face()->point());
Kernel::Vector_3 v(CGAL::ORIGIN, plane.projection(CGAL::ORIGIN));
Kernel::FT tmp = v.squared_length();
if (tmp < sw) sw = tmp;
}
// std::cout << sw << std::endl;
CGAL::Gmpq res(1,3);
if (sw.exact() != res) return -1;
return 0;
}

View File

@ -85,9 +85,8 @@ bool test_one_file(std::ifstream& in_file, bool /* verbose */)
std::cout.flush();
CGAL::insert_non_intersecting_curves(arr, xcurves.begin(), xcurves.end());
std::cout << "inserted" << std::endl;
for (Halfedge_iterator hit = arr.halfedges_begin(); hit != arr.halfedges_end(); hit++) {
halfedges.push_back(hit);
}
BOOST_FOREACH(Halfedge_handle hh, arr.halfedge_handles())
halfedges.push_back(hh);
#endif
curves.clear();
@ -102,7 +101,6 @@ bool test_one_file(std::ifstream& in_file, bool /* verbose */)
}
isolated_points.clear();
points.clear();
std::cout << "The arrangement size:" << std::endl
<< " V = " << arr.number_of_vertices()
<< ", E = " << arr.number_of_edges()
@ -110,16 +108,16 @@ bool test_one_file(std::ifstream& in_file, bool /* verbose */)
{
std::cout << "Faces:" << std::endl;
Arrangement_2::Face_const_iterator fit;
for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) {
BOOST_FOREACH(Arrangement_2::Face_handle fh, arr.face_handles())
{
std::cout << " Face: "
<< &(*fit)
<< &(fh)
<< std::endl;
std::cout << " Outer CCBs: "
<< std::distance(fit->outer_ccbs_begin(), fit->outer_ccbs_end())
<< std::distance(fh->outer_ccbs_begin(), fh->outer_ccbs_end())
<< std::endl;
std::cout << " Inner CCBs: "
<< std::distance(fit->inner_ccbs_begin(), fit->inner_ccbs_end())
<< std::distance(fh->inner_ccbs_begin(), fh->inner_ccbs_end())
<< std::endl;
std::cout << std::endl;
}

View File

@ -0,0 +1,48 @@
/*!
\ingroup PkgBGLConcepts
\cgalConcept
The concept `EdgeListGraph` refines the concept `Graph` and adds
the requirement for traversal of all edges in a graph.
\cgalRefines `Graph`
\cgalHasModel `CGAL::Polyhedron_3`
\cgalHasModel `CGAL::Surface_mesh`
*/
class EdgeListGraph{};
/*! \relates EdgeListGraph
* returns an iterator range over all edges.
*/
template <typename EdgeListGraph>
std::pair<boost::graph_traits<EdgeListGraph>::edge_iterator,
boost::graph_traits<EdgeListGraph>::edge_iterator>
edges(const EdgeListGraph& g);
/*! \relates EdgeListGraph
returns an upper bound of the number of edges of the graph.
\attention `num_edges()` may return a number larger than `std::distance(edges(g).first, edges(g).second)`.
This is the case for implementations only marking edges deleted in the edge container.
*/
template <typename EdgeListGraph>
boost::graph_traits<EdgeListGraph>::ver_size_type
num_edges(const EdgeListGraph& g);
/*! \relates EdgeListGraph
returns the source vertex of `h`.
*/
template <typename EdgeListGraph>
boost::graph_traits<EdgeListGraph>::vertex_descriptor
source(boost::graph_traits<EdgeListGraph>::halfedge_descriptor h, const EdgeListGraph& g);
/*! \relates EdgeListGraph
returns the target vertex of `h`.
*/
template <typename EdgeListGraph>
boost::graph_traits<EdgeListGraph>::vertex_descriptor
target(boost::graph_traits<EdgeListGraph>::halfedge_descriptor h, const EdgeListGraph& g);

View File

@ -13,32 +13,33 @@ face.
\cgalHasModel `CGAL::Surface_mesh`
\cgalHasModel `CGAL::Linear_cell_complex_for_combinatorial_map`
\cgalHeading{Notations}
<dl>
<dt>`G`</dt> <dd>A type that is a model of `FaceGraph`.</dd>
<dt>`g`</dt> <dd>An object of type `G`.</dd>
<dt>`e`</dt> <dd>An edge descriptor.</dd>
<dt>`f`</dt> <dd>A face descriptor.</dd>
<dt>`h`</dt> <dd>A halfedge descriptor.</dd>
</dl>
\cgalHeading{Associated Types}
Type | Description
-------------------- | ------------
`boost::graph_traits<G>::%face_descriptor` | A `face_descriptor` corresponds to a unique face in a graph. Must be `DefaultConstructible`, `Assignable`, `EqualityComparable` and `LessThanComparable`.
\cgalHeading{Valid Expressions}
Expression | Returns | Description
-------------------------------------- | ------------------------------------------------------------------------ | ------------------------
`face(h, g)` | `face_descriptor` | The face incident to halfedge `h`.
`halfedge(f, g)` | `halfedge_descriptor` | A halfedge incident to face `f`.
`degree(f,g)` | `degree_size_type` | The number of halfedges, incident to face `f`.
`boost::graph_traits<G>::%null_face()` | `face_descriptor` | Returns a special face that is not equal to any other face.
*/
class FaceGraph {};
/*! \relates FaceGraph
returns the face incident to halfedge `h`.
*/
template <typename FaceGraph>
boost::graph_traits<FaceGraph>::face_descriptor
face(boost::graph_traits<FaceGraph>::halfedge_descriptor h, const FaceGraph& g);
/*! \relates FaceGraph
returns the halfedge incident to face `f`.
*/
template <typename FaceGraph>
boost::graph_traits<FaceGraph>::halfedge_descriptor
halfedge(boost::graph_traits<FaceGraph>::face_descriptor f, const FaceGraph& g);
/*! \relates FaceGraph
returns the number of halfedges incident to face `f`.
*/
template <typename FaceGraph>
boost::graph_traits<FaceGraph>::degree_size_type
degree(boost::graph_traits<FaceGraph>::face_descriptor f, const FaceGraph& g);
/*! \relates FaceGraph
returns a special face that is not equal to any other face.
*/
template <typename FaceGraph>
boost::graph_traits<FaceGraph>::face_descriptor
null_face(const FaceGraph& g);

View File

@ -10,33 +10,25 @@ the requirement for traversal of all faces in a graph.
\cgalHasModel `CGAL::Surface_mesh`
\cgalHasModel `CGAL::Linear_cell_complex_for_combinatorial_map`
\cgalHeading{Notations}
<dl>
<dt>`G`</dt> <dd>A type that is a model of `FaceListGraph`.</dd>
<dt>`g`</dt> <dd>An object of type `G`.</dd>
</dl>
\cgalHeading{Associated Types}
Type | Description
----------------- | -----------
`boost::graph_traits<G>::%face_iterator` | %Iterator over all faces.
`boost::graph_traits<G>::%faces_size_type` | Unsigned integer type for number of faces.
\cgalHeading{Valid Expressions}
Expression | returns | Description
----------------- | --------------- | -----------------------
`faces(g)` | `std::pair<face_iterator, face_iterator>` | An iterator range over all faces.
`num_faces(g)` | `faces_size_type` | An upper bound of the number of faces of the graph.
\attention `num_faces()` may return a number larger than `std::distance(faces(g).first, faces(g).second)`.
This is the case for implementations only marking faces deleted in the face container.
<!--
This is for example the case for `CGAL::Surface_mesh` or `OpenMesh::PolyMesh_ArrayKernelT`.
-->
*/
class FaceListGraph{};
/*! \relates FaceListGraph
* returns an iterator range over all faces.
*/
template <typename FaceListGraph>
std::pair<boost::graph_traits<FaceListGraph>::face_iterator,
boost::graph_traits<FaceListGraph>::face_iterator>
faces(const FaceListGraph& g);
/*! \relates FaceListGraph
returns an upper bound of the number of faces of the graph.
\attention `num_faces()` may return a number larger than `std::distance(faces(g).first, faces(g).second)`.
This is the case for implementations only marking faces deleted in the face container.
*/
template <typename FaceListGraph>
boost::graph_traits<FaceListGraph>::face_size_type
num_faces(const FaceListGraph& g);

View File

@ -23,43 +23,78 @@ A model of `HalfedgeGraph` must have the interior property `vertex_point` attach
\cgalHasModel `CGAL::Polyhedron_3`
\cgalHasModel `CGAL::Surface_mesh`
\cgalHeading{Notations}
<dl>
<dt>`G`</dt> <dd>A type that is a model of `HalfedgeGraph`.</dd>
<dt>`g`</dt> <dd>An object of type `G`.</dd>
<dt>`u`, `v`</dt> <dd>Vertex descriptors.</dd>
<dt>`e`</dt> <dd>An edge descriptor.</dd>
<dt>`h`</dt> <dd>A halfedge descriptor.</dd>
</dl>
\cgalHeading{Associated Types}
Type | Description
--------------------------------------------------------- | ------------
`boost::graph_traits<G>::%halfedge_descriptor` | A `halfedge_descriptor` corresponds to a halfedge in a graph. Must be `DefaultConstructible`, `Assignable`, `EqualityComparable` and `LessThanComparable`.
\cgalHeading{Valid Expressions}
Expression | Returns | Description
--------------------------------------- | ---------------------------------------------------------------------------- | -----------
`edge(h, g)` | `edge_descriptor` | The edge corresponding to `h` and `opposite(h)`.
`halfedge(e, g)` | `halfedge_descriptor` | One of the halfedges corresponding to `e`.
`halfedge(v, g)` | `halfedge_descriptor` | A halfedge with target `v`.
`halfedge(u, v, g)` | `std::pair<halfedge_descriptor,bool>` | The halfedge with source `u` and target `v`. The Boolean is `true`, iff this halfedge exists.
`opposite(h, g)` | `halfedge_descriptor` | The halfedge with source and target swapped.
`source(h,g)` | `vertex_descriptor` | The source vertex of `h`.
`target(h,g)` | `vertex_descriptor` | The target vertex of `h`.
`next(h, g)` | `halfedge_descriptor` | The next halfedge around its face.
`prev(h, g)` | `halfedge_descriptor` | The previous halfedge around its face.
`boost::graph_traits<G>::%null_halfedge()` | `halfedge_descriptor` | Returns a special halfedge that is not equal to any other halfedge.
\cgalHeading{Invariants}
`halfedge(edge(h,g))==h`
*/
class HalfedgeGraph {};
/*! \relates HalfedgeGraph
returns the edge corresponding to halfedges `h` and `opposite(h,g)`.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::edge_descriptor
edge(boost::graph_traits<HalfedgeGraph>::halfedge_descriptor h, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns one of the halfedges corresponding to `e`.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::halfedge_descriptor
halfedge(boost::graph_traits<HalfedgeGraph>::edge_descriptor f, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns a halfedge with target `v`.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::halfedge_descriptor
halfedge(boost::graph_traits<HalfedgeGraph>::vertex_descriptor v, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns the halfedge with source `u` and target `v`. The Boolean is `true`, iff this halfedge exists.
*/
template <typename HalfedgeGraph>
std::pair<boost::graph_traits<HalfedgeGraph>::halfedge_descriptor,bool>
halfedge(boost::graph_traits<HalfedgeGraph>::vertex_descriptor u,
boost::graph_traits<HalfedgeGraph>::vertex_descriptor v,
const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns the halfedge with source and target swapped.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::halfedge_descriptor
opposite(boost::graph_traits<HalfedgeGraph>::halfedge_descriptor h, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns the source vertex of `h`.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::vertex_descriptor
source(boost::graph_traits<HalfedgeGraph>::halfedge_descriptor h, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns the target vertex of `h`.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::vertex_descriptor
target(boost::graph_traits<HalfedgeGraph>::halfedge_descriptor h, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns the next halfedge around its face.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::halfedge_descriptor
next(boost::graph_traits<HalfedgeGraph>::halfedge_descriptor h, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns the previous halfedge around its face.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::halfedge_descriptor
prev(boost::graph_traits<HalfedgeGraph>::halfedge_descriptor h, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph
returns a special halfedge that is not equal to any other halfedge.
*/
template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::halfedge_descriptor
null_halfedge(const HalfedgeGraph& g);

View File

@ -9,35 +9,25 @@ and adds the requirements for traversal of all halfedges in the graph.
\cgalHasModel `CGAL::Polyhedron_3`
\cgalHasModel `CGAL::Surface_mesh`
\cgalHeading{Notations}
<dl>
<dt>`G`</dt> <dd>A type that is a model of `HalfedgeListGraph`.</dd>
<dt>`g`</dt> <dd>An object of type `G`.</dd>
</dl>
\cgalHeading{Associated Types}
Type | Description
-------------------- | ------------
`boost::graph_traits<G>::%halfedge_iterator` | A `BidirectionalIterator` over all halfedges in a graph. Must be `DefaultConstructible`, `Assignable`, `EqualityComparable`.
`boost::graph_traits<G>::%halfedges_size_type` | A size type.
\cgalHeading{Valid Expressions}
Expression | Returns | Description
------------------------------------- | ------------------------------------------| -----------
`num_halfedges(g)` | `halfedges_size_type` | An upper bound of the number of halfedges of the graph.
`halfedges(g)` | `std::pair<halfedge_iterator,halfedge_iterator>` | An iterator range over the halfedges of the graph.
\attention `num_halfedges()` may return a number larger than `std::distance(halfedges(g).first,halfedges(g).second)`.
This is the case for implementations only marking halfedges deleted in the halfedge container.
<!--
This is for example the case for `CGAL::Surface_mesh` or `OpenMesh::PolyMesh_ArrayKernelT`.
-->
*/
class HalfedgeListGraph {};
/*! \relates HalfedgeListGraph
* returns an iterator range over all halfedges.
*/
template <typename HalfedgeListGraph>
std::pair<boost::graph_traits<HalfedgeListGraph>::halfedge_iterator,
boost::graph_traits<HalfedgeListGraph>::halfedge_iterator>
halfedges(const HalfedgeListGraph& g);
/*! \relates HalfedgeListGraph
returns an upper bound of the number of halfedges of the graph.
\attention `num_halfedges()` may return a number larger than `std::distance(halfedges(g).first, halfedges(g).second)`.
This is the case for implementations only marking halfedges deleted in the halfedge container.
*/
template <typename HalfedgeListGraph>
boost::graph_traits<HalfedgeListGraph>::halfedge_size_type
num_halfedges(const HalfedgeListGraph& g);

View File

@ -11,23 +11,40 @@ the requirement for operations to add faces and to modify face-halfedge relation
\cgalHasModel `CGAL::Surface_mesh`
\cgalHasModel `CGAL::Linear_cell_complex_for_combinatorial_map`
\cgalHeading{Notations}
<dl>
<dt>`G`</dt> <dd>A type that is a model of `MutableFaceGraph`.</dd>
<dt>`g`</dt> <dd>An object of type `G`.</dd>
<dt>`h`</dt> <dd>A halfedge descriptor.</dd>
<dt>`f`</dt> <dd>A face descriptor.</dd>
</dl>
\cgalHeading{Valid Expressions}
Expression | returns | Description
----------------------- | ------------ | -----------
`add_face(g)` | `face_descriptor` | Adds a new face to the graph without initializing the connectivity.
`remove_face(f, g)` | `void` | Removes `f` from the graph.
`set_face(h, f, g)` | `void` | Sets the corresponding face of `h` to `f`.
`set_halfedge(f, h, g)` | `void` | Sets the corresponding halfedge of `f` to `h`.
`reserve(g, nv, ne, nf)`| `void` | Called to indicate the expected size of vertices (`nv`), edges (`ed`) and faces (`nf`)
*/
class MutableFaceGraph{};
/*! \relates MutableFaceGraph
Adds a new face to the graph without initializing the connectivity.
*/
template <typename MutableFaceGraph>
boost::graph_traits<MutableFaceGraph>::face_descriptor
add_face(MutableFaceGraph& g);
/*! \relates MutableFaceGraph
Removes `f` from the graph.
*/
template <typename MutableFaceGraph>
boost::graph_traits<MutableFaceGraph>::face_descriptor
remove_face(boost::graph_traits<MutableFaceGraph>::face_descriptor f, MutableFaceGraph& g);
/*! \relates MutableFaceGraph
Sets the corresponding face of `h` to `f`.
*/
template <typename MutableFaceGraph>
void
set_face(boost::graph_traits<MutableFaceGraph>::halfedge_descriptor h, boost::graph_traits<MutableFaceGraph>::face_descriptor f, MutableFaceGraph& g);
/*! \relates MutableFaceGraph
Sets the corresponding halfedge of `f` to `h`.
*/
template <typename MutableFaceGraph>
void
set_halfedge(boost::graph_traits<MutableFaceGraph>::face_descriptor f, boost::graph_traits<MutableFaceGraph>::halfedge_descriptor h, MutableFaceGraph& g);
/*! \relates MutableFaceGraph
Indicates the expected size of vertices (`nv`), edges (`ed`) and faces (`nf`).
*/
template <typename MutableFaceGraph>
void
reserve(MutableFaceGraph& g, boost::graph_traits<MutableFaceGraph>::vertices_size_type nv, boost::graph_traits<MutableFaceGraph>::vertices_size_type ne, boost::graph_traits<MutableFaceGraph>::vertices_size_type nf);

View File

@ -12,28 +12,57 @@ update the incidence information between vertices and halfedges.
\cgalHasModel `CGAL::Surface_mesh`
\cgalHasModel `CGAL::Linear_cell_complex_for_combinatorial_map`
\cgalHeading{Notations}
<dl>
<dt>`G`</dt> <dd>A type that is a model of `MutableHalfedgeGraph`.</dd>
<dt>`g`</dt> <dd>An object of type `G`.</dd>
<dt>`v`</dt> <dd>A vertex descriptor.</dd>
<dt>`h`, `h1`, `h2`</dt> <dd>Halfedge descriptors.</dd>
<dt>`e`</dt> <dd>An edge descriptor.</dd>
</dl>
\cgalHeading{Valid Expressions}
Expression | returns | Description
------------------------- | ------------ | -----------
`add_vertex(g)` | `vertex_descriptor` | Adds a new vertex to the graph without initializing the connectivity.
`remove_vertex(v, g)` | `void` | Removes `v` from the graph.
`add_edge(g)` | `edge_descriptor` | Adds two opposite halfedges to the graph without initializing the connectivity.
`remove_edge(e, g)` | `void` | Removes the two halfedges corresponding to `e` from the graph.
`set_target(h, v, g)` | `void` | Sets the target vertex of `h` and the source of `opposite(h)` to `v`.
`set_halfedge(v, h, g)` | `void` | Sets the halfedge of `v` to `h`. The target vertex of `h` must be `v`.
`set_next(h1, h2, g)` | `void` | Sets the successor of `h1` around a face to `h2`, and the prededecessor of `h2` to `h1`.
*/
class MutableHalfedgeGraph{};
/*! \relates MutableFaceGraph
Adds a new vertex to the graph without initializing the connectivity.
*/
template <typename MutableHalfedgeGraph>
boost::graph_traits<MutableHalfedgeGraph>::face_descriptor
add_vertex(MutableHalfedgeGraph& g);
/*! \relates MutableHalfedgeGraph
Removes `v` from the graph.
*/
template <typename MutableHalfedgeGraph>
boost::graph_traits<MutableHalfedgeGraph>::face_descriptor
remove_vertex(boost::graph_traits<MutableHalfedgeGraph>::vertex_descriptor v, MutableHalfedgeGraph& g);
/*! \relates MutableFaceGraph
Adds two opposite halfedges to the graph without initializing the connectivity.
*/
template <typename MutableHalfedgeGraph>
boost::graph_traits<MutableHalfedgeGraph>::edge_descriptor
add_edge(MutableHalfedgeGraph& g);
/*! \relates MutableHalfedgeGraph
Removes the two halfedges corresponding to `e` from the graph.
*/
template <typename MutableHalfedgeGraph>
boost::graph_traits<MutableHalfedgeGraph>::face_descriptor
remove_edge(boost::graph_traits<MutableHalfedgeGraph>::edge_descriptor e, MutableHalfedgeGraph& g);
/*! \relates MutableHalfedgeGraph
Sets the target vertex of `h` and the source of `opposite(h)` to `v`.
*/
template <typename MutableHalfedgeGraph>
void
set_target(boost::graph_traits<MutableHalfedgeGraph>::halfedge_descriptor h, boost::graph_traits<MutableHalfedgeGraph>::vertex_descriptor v, MutableHalfedgeGraph& g);
/*! \relates MutableHalfedgeGraph
Sets the halfedge of `v` to `h`. The target vertex of `h` must be `v`.
*/
template <typename MutableHalfedgeGraph>
void
set_halfedge(boost::graph_traits<MutableHalfedgeGraph>::vertex_descriptor v, boost::graph_traits<MutableHalfedgeGraph>::halfedge_descriptor h, MutableHalfedgeGraph& g);
/*! \relates MutableHalfedgeGraph
Sets the successor of `h1` around a face to `h2`, and the prededecessor of `h2` to `h1`.
*/
template <typename MutableHalfedgeGraph>
void
set_next(boost::graph_traits<MutableHalfedgeGraph>::halfedge_descriptor h1, boost::graph_traits<MutableHalfedgeGraph>::halfede_descriptor h2, MutableHalfedgeGraph& g);

View File

@ -0,0 +1,33 @@
/*!
\ingroup PkgBGLConcepts
\cgalConcept
The concept `VertexListGraph` refines the concept `Graph` and adds
the requirement for traversal of all vertices in a graph.
\cgalRefines `Graph`
\cgalHasModel `CGAL::Polyhedron_3`
\cgalHasModel `CGAL::Surface_mesh`
*/
class VertexListGraph{};
/*! \relates VertexListGraph
* returns an iterator range over all vertices.
*/
template <typename VertexListGraph>
std::pair<boost::graph_traits<VertexListGraph>::vertex_iterator,
boost::graph_traits<VertexListGraph>::vertex_iterator>
vertices(const VertexListGraph& g);
/*! \relates VertexListGraph
returns an upper bound of the number of vertices of the graph.
\attention `num_vertices()` may return a number larger than `std::distance(vertices(g).first, vertices(g).second)`.
This is the case for implementations only marking vertices deleted in the vertex container.
*/
template <typename VertexListGraph>
boost::graph_traits<VertexListGraph>::ver_size_type
num_vertices(const VertexListGraph& g);

View File

@ -1,33 +1,195 @@
/// \defgroup PkgBGL CGAL and the Boost Graph Library Reference
/// \defgroup PkgBGLConcepts Concepts
/// \ingroup PkgBGL
///
/// We extend the Boost Graph Library(\sc{Bgl} for short) with a set of new concepts.
/// The documentation of the concepts lists at the same time the functions
/// related to it. Models of the concept and their related functions
/// must be in the same namespace (they will be found by Koenig lookup).
///
///\dot
///digraph example {
/// node [shape=record, fontname=Helvetica, fontsize=10];
/// rankdir=BT
///
/// "boost Graph" [ URL="http://www.boost.org/libs/graph/doc/Graph.html" ];
/// HalfedgeGraph [ URL="\ref HalfedgeGraph"];
/// HalfedgeListGraph [ URL="\ref HalfedgeListGraph"];
/// MutableHalfedgeGraph [ URL="\ref MutableHalfedgeGraph"];
/// FaceGraph [ URL="\ref FaceGraph"];
/// FaceListGraph [ URL="\ref FaceListGraph"];
/// MutableFaceGraph [ URL="\ref MutableFaceGraph"];
///
/// MutableHalfedgeGraph -> HalfedgeGraph -> "boost Graph" [ arrowhead="open", label="refines" ];
/// FaceListGraph -> FaceGraph -> HalfedgeGraph [ arrowhead="open", label="refines" ];
/// MutableFaceGraph -> MutableHalfedgeGraph [ arrowhead="open", label="refines" ];
/// MutableFaceGraph -> FaceGraph [ arrowhead="open", label="refines" ];
/// HalfedgeListGraph -> HalfedgeGraph [ arrowhead="open", label="refines" ];
///}
///\enddot
/*! \defgroup PkgBGLConcepts Concepts
\ingroup PkgBGL
We extend the Boost Graph Library (\sc{Bgl} for short) with a set of new concepts.
In order to make this documentation self-contained we here also document
concepts that are defined in the original version of the \sc{Bgl}.
The documentation of the concepts lists at the same time the functions
related to it. Models of the concept and their related functions
must be in the same namespace (they will be found by Koenig lookup).
\dot
digraph example {
node [shape=record, fontname=Helvetica, fontsize=10];
rankdir=BT
"boost Graph" [ URL="http://www.boost.org/libs/graph/doc/Graph.html" ];
HalfedgeGraph [ URL="\ref HalfedgeGraph"];
HalfedgeListGraph [ URL="\ref HalfedgeListGraph"];
MutableHalfedgeGraph [ URL="\ref MutableHalfedgeGraph"];
FaceGraph [ URL="\ref FaceGraph"];
FaceListGraph [ URL="\ref FaceListGraph"];
MutableFaceGraph [ URL="\ref MutableFaceGraph"];
MutableHalfedgeGraph -> HalfedgeGraph -> "boost Graph" [ arrowhead="open", label="refines" ];
FaceListGraph -> FaceGraph -> HalfedgeGraph [ arrowhead="open", label="refines" ];
MutableFaceGraph -> MutableHalfedgeGraph [ arrowhead="open", label="refines" ];
MutableFaceGraph -> FaceGraph [ arrowhead="open", label="refines" ];
HalfedgeListGraph -> HalfedgeGraph [ arrowhead="open", label="refines" ];
}
\enddot
\cgalHeading{Notations}
<dl>
<dt>`G`</dt> <dd>A type that is a model of a graph concept.</dd>
<dt>`g`</dt> <dd>An object of type `G`.</dd>
<dt>`u`, `v`</dt> <dd>An object of type `boost::graph_traits<G>::%vertex_descriptor`.</dd>
<dt>`h`</dt> <dd>An object of type `boost::graph_traits<G>::%halfedge_descriptor`.</dd>
<dt>`e`</dt> <dd>An object of type `boost::graph_traits<G>::%edge_descriptor`.</dd>
<dt>`f`</dt> <dd>An object of type `boost::graph_traits<G>::%face_descriptor`.</dd>
</dl>
\cgalHeading{%VertexListGraph}
The concept `VertexListGraph` refines the concept `Graph` and adds
the requirement for traversal of all vertices in a graph.
Associated Type | Description
----------------- | -----------
`boost::graph_traits<G>::%vertex_iterator` | %Iterator over all vertices.
`boost::graph_traits<G>::%vertices_size_type` | Unsigned integer type for number of vertices.
Valid Expression | returns | Description
----------------- | --------------- | -----------------------
`vertices(g)` | `std::pair<vertex_iterator, vertex_iterator>` | An iterator range over all vertices.
`num_vertices(g)` | `vertices_size_type` | An upper bound of the number of vertices of the graph.
\cgalHeading{%EdgeListGraph}
The concept `EdgeListGraph` refines the concept `Graph` and adds
the requirement for traversal of all edges in a graph.
Associated Type | Description
----------------- | -----------
`boost::graph_traits<G>::%edge_iterator` | %Iterator over all edges.
`boost::graph_traits<G>::%edges_size_type` | Unsigned integer type for number of edges.
Valid Expression | returns | Description
----------------- | --------------- | -----------------------
`edges(g)` | `std::pair<edge_iterator, edge_iterator>` | An iterator range over all edges.
`num_edges(g)` | `edges_size_type` | An upper bound of the number of edges of the graph.
`source(e,g)` | `vertex_descriptor` | The source vertex of `e`.
`target(e,g)` | `vertex_descriptor` | The target vertex of `e`.
\cgalHeading{%HalfedgeGraph}
The concept `HalfedgeGraph` refines the concept `Graph` and adds
the notion of halfedges, where each edge corresponds to two opposite halfedges.
Associated Type | Description
--------------------------------------------------------- | ------------
`boost::graph_traits<G>::%halfedge_descriptor` | A `halfedge_descriptor` corresponds to a halfedge in a graph. Must be `DefaultConstructible`, `Assignable`, `EqualityComparable` and `LessThanComparable`.
Valid Expression | Returns | Description
--------------------------------------- | --------------------------------------------| -----------
`edge(h, g)` | `edge_descriptor` | The edge corresponding to halfedges `h` and `opposite(h)`.
`halfedge(e, g)` | `halfedge_descriptor` | One of the halfedges corresponding to `e`.
`halfedge(v, g)` | `halfedge_descriptor` | A halfedge with target `v`.
`halfedge(u, v, g)` | `std::pair<halfedge_descriptor,bool>` | The halfedge with source `u` and target `v`. The Boolean is `true`, iff this halfedge exists.
`opposite(h, g)` | `halfedge_descriptor` | The halfedge with source and target swapped.
`source(h,g)` | `vertex_descriptor` | The source vertex of `h`.
`target(h,g)` | `vertex_descriptor` | The target vertex of `h`.
`next(h, g)` | `halfedge_descriptor` | The next halfedge around its face.
`prev(h, g)` | `halfedge_descriptor` | The previous halfedge around its face.
`boost::graph_traits<G>::%null_halfedge()` | `halfedge_descriptor` | Returns a special halfedge that is not equal to any other halfedge.
The `HalfedgeGraph` has the invariant `halfedge(edge(h,g))==h`.
\cgalHeading{%MutableHalfedgeGraph}
The concept `MutableHalfedgeGraph` refines the concept `HalfedgeGraph`
and adds the requirements for operations to add vertices and edges, and to
update the incidence information between vertices and halfedges.
Valid Expression | returns | Description
------------------------- | ------------ | -----------
`add_vertex(g)` | `vertex_descriptor` | Adds a new vertex to the graph without initializing the connectivity.
`remove_vertex(v, g)` | `void` | Removes `v` from the graph.
`add_edge(g)` | `edge_descriptor` | Adds two opposite halfedges to the graph without initializing the connectivity.
`remove_edge(e, g)` | `void` | Removes the two halfedges corresponding to `e` from the graph.
`set_target(h, v, g)` | `void` | Sets the target vertex of `h` and the source of `opposite(h)` to `v`.
`set_halfedge(v, h, g)` | `void` | Sets the halfedge of `v` to `h`. The target vertex of `h` must be `v`.
`set_next(h1, h2, g)` | `void` | Sets the successor of `h1` around a face to `h2`, and the prededecessor of `h2` to `h1`.
\cgalHeading{%HalfedgeListGraph}
The concept `HalfedgeListGraph` refines the concept `HalfedgeGraph`
and adds the requirements for traversal of all halfedges in the graph.
Associated Type | Description
-------------------- | ------------
`boost::graph_traits<G>::%halfedge_iterator` | A `BidirectionalIterator` over all halfedges in a graph. Must be `DefaultConstructible`, `Assignable`, `EqualityComparable`.
`boost::graph_traits<G>::%halfedges_size_type` | A size type.
Valid Expression | Returns | Description
------------------------------------- | ------------------------------------------| -----------
`num_halfedges(g)` | `halfedges_size_type` | An upper bound of the number of halfedges of the graph.
`halfedges(g)` | `std::pair<halfedge_iterator,halfedge_iterator>` | An iterator range over the halfedges of the graph.
\cgalHeading{%FaceGraph}
The concept `FaceGraph` refines the concept `HalfedgeGraph`.
It adds the requirements for a graph to explicitly
maintain faces described by halfedges, to provide access from a face to
an incident halfedge, and to provide access from a halfedge to its incident
face.
Associated Type | Description
-------------------------------------------- | ------------
`boost::graph_traits<G>::%face_descriptor` | A `face_descriptor` corresponds to a unique face in a graph. Must be `DefaultConstructible`, `Assignable`, `EqualityComparable` and `LessThanComparable`.
Valid Expression | Returns | Description
-------------------------------------- | ------------------------------------------------------------------------ | ------------------------
`face(h, g)` | `face_descriptor` | The face incident to halfedge `h`.
`halfedge(f, g)` | `halfedge_descriptor` | A halfedge incident to face `f`.
`degree(f,g)` | `degree_size_type` | The number of halfedges incident to face `f`.
`boost::graph_traits<G>::%null_face()` | `face_descriptor` | A special face that is not equal to any other face.
\cgalHeading{%MutableFaceGraph}
The concept `MutableFaceGraph` refines the concepts `FaceGraph` and `MutableHalfedgeGraph` and adds
the requirement for operations to add faces and to modify face-halfedge relations.
Valid Expression | returns | Description
----------------------- | ------------ | -----------
`add_face(g)` | `face_descriptor` | Adds a new face to the graph without initializing the connectivity.
`remove_face(f, g)` | `void` | Removes `f` from the graph.
`set_face(h, f, g)` | `void` | Sets the corresponding face of `h` to `f`.
`set_halfedge(f, h, g)` | `void` | Sets the corresponding halfedge of `f` to `h`.
`reserve(g, nv, ne, nf)`| `void` | Called to indicate the expected size of vertices (`nv`), edges (`ed`) and faces (`nf`)
\cgalHeading{%FaceListGraph}
The concept `FaceListGraph` refines the concept `FaceGraph` and adds
the requirement for traversal of all faces in a graph.
Associated Type | Description
------------------------------------------ | -----------
`boost::graph_traits<G>::%face_iterator` | %Iterator over all faces.
`boost::graph_traits<G>::%faces_size_type` | Unsigned integer type for number of faces.
Valid Expression | returns | Description
----------------- | --------------- | -----------------------
`faces(g)` | `std::pair<face_iterator, face_iterator>` | An iterator range over all faces.
`num_faces(g)` | `faces_size_type` | An upper bound of the number of faces of the graph.
*/
/// The property tags model of the boost concept <a href="http://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>.
/// These tags are used to retrieve default property maps using the traits class <a href="http://www.boost.org/libs/graph/doc/property_map.html">boost::property_map</a>.
@ -46,10 +208,27 @@
/// \defgroup PkgBGLSelectionFct Selection Functions
/// \ingroup PkgBGL
/// \defgroup PkgBGLEulerOperations Euler Operations
/// \ingroup PkgBGL
/*!
\addtogroup PkgBGLHelper
Several classes that enable to store ids in vertices/halfedges/faces of a `CGAL::Polyhedron_3`, as well as adapters such as `CGAL::Dual`.
*/
/*!
\addtogroup PkgBGLHelperFct
Generic convenience functions for testing if an edge is a border edge, if a mesh is triangular,
for conversion between models of different `FaceGraph` concepts, etc.
Most functions are in the header file `<CGAL/boost/graph/helpers.h>`
*/
/*!
\addtogroup PkgBGLIterators
Several iterators and circulators are provided that enable to iterate through the halfedges incident to a given face or vertex.
Several iterators and circulators are provided that enable, for example,
to iterate through the halfedges incident to a given face or vertex.
Starting at a halfedge `h`, applying several times `next(h,g)` brings us back
to the halfedge where we started. All halfedges traversed on the way are
@ -59,10 +238,14 @@ in another cycle, namely the cycle of halfedges which are incident to
the same vertex.
For convenience, two iterator and circulator types enable iterating through all the halfedges
incident to a given face, and all the halfedges having a given vertex as target.
All functions are in the header file `<CGAL/boost/graph/iterator.h>
*/
/// \defgroup PkgBGLEulerOperations Euler Operations
/// \ingroup PkgBGL
/*!
\addtogroup PkgBGLSelectionFct
Several functions to enlarge or reduce a k-ring selection of vertices, edges, or faces.
*/
/*!
\addtogroup PkgBGLTraits
@ -91,6 +274,8 @@ incident to a given face, and all the halfedges having a given vertex as target.
\cgalClassifedRefPages
## Concepts ##
- `VertexListGraph`
- `EdgeListGraph`
- `HalfedgeGraph`
- `HalfedgeListGraph`
- `MutableHalfedgeGraph`

View File

@ -12,6 +12,8 @@
\example BGL_triangulation_2/dijkstra.cpp
\example BGL_triangulation_2/dijkstra_with_internal_properties.cpp
\example BGL_triangulation_2/emst.cpp
\example BGL_triangulation_2/emst_regular.cpp
\example BGL_triangulation_2/emst_cdt_plus_hierarchy.cpp
\example BGL_surface_mesh/prim.cpp
\example BGL_surface_mesh/surface_mesh_dual.cpp
\example Surface_mesh_skeletonization/simple_mcfskel_example.cpp

View File

@ -16,7 +16,7 @@ Defined in `<CGAL/boost/graph/graph_traits_Surface_mesh.h>`
We provide partial specialization for the class `CGAL::Surface_mesh` so that it is a model
of the graph concepts
<A HREF="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">`BidirectionalGraph`</A> and
<A HREF="http://www.boost.org/libs/graph/doc/EdgeAndVertexListGraph.html">`EdgeAndVertexListGraph`</A>
<A HREF="http://www.boost.org/libs/graph/doc/VertexAndEdgeListGraph.html">`VertexAndEdgeListGraph`</A>
and of the concept `MutableFaceGraph`.
The const specialization, `boost::graph_traits< CGAL::Surface_mesh<Traits> const>`
@ -53,7 +53,7 @@ Defined in `<CGAL/boost/graph/graph_traits_Polyhedron_3.h>`
We provide partial specialization for the class `CGAL::Polyhedron_3` so that it is a model
of the graph concepts
<A HREF="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">`BidirectionalGraph`</A> and
<A HREF="http://www.boost.org/libs/graph/doc/EdgeAndVertexListGraph.html">`EdgeAndVertexListGraph`</A>
<A HREF="http://www.boost.org/libs/graph/doc/VertexAndEdgeListGraph.html">`VertexAndEdgeListGraph`</A>
and of the concept `MutableFaceGraph`.
The const specialization, `boost::graph_traits< CGAL::Polyhedron_3<Traits> const>`
@ -148,7 +148,7 @@ Defined in `<CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>`
We provide partial specialization for the class `OpenMesh::PolyMesh_ArrayKernelT` so that it is a model
of the graph concepts
<A HREF="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">`BidirectionalGraph`</A> and
<A HREF="http://www.boost.org/libs/graph/doc/EdgeAndVertexListGraph.html">`EdgeAndVertexListGraph`</A>
<A HREF="http://www.boost.org/libs/graph/doc/VertexAndEdgeListGraph.html">`VertexAndEdgeListGraph`</A>
and of the concept `MutableFaceGraph`.
The traits class `boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >` provides the following types:
@ -181,7 +181,7 @@ Defined in `<CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h>`
We provide partial specialization for the class `OpenMesh::TriMesh_ArrayKernelT` so that it is a model
of the graph concepts
<A HREF="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">`BidirectionalGraph`</A> and
<A HREF="http://www.boost.org/libs/graph/doc/EdgeAndVertexListGraph.html">`EdgeAndVertexListGraph`</A>
<A HREF="http://www.boost.org/libs/graph/doc/VertexAndEdgeListGraph.html">`VertexAndEdgeListGraph`</A>
and of the concept `MutableFaceGraph`.
The traits class `boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >` provides the following types:
@ -210,12 +210,22 @@ The traits class `boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >` provi
\section BGLT2GT Specializations for the 2D Triangulation Classes
Defined in `<CGAL/boost/graph/graph_traits_Triangulation_2.h>` and `<CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h>`
Defined in `<CGAL/boost/graph/graph_traits_Triangulation_2.h>`,
`<CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h>`,
`<CGAL/boost/graph/graph_traits_Regular_triangulation_2.h>`,
`<CGAL/boost/graph/graph_traits_Constrained_Delaunay_triangulation_2.h>`,
`<CGAL/boost/graph/graph_traits_Constrained_triangulation_2.h>`,
`<CGAL/boost/graph/graph_traits_Constrained_triangulation_plus_2.h>`, and
`<CGAL/boost/graph/graph_traits_Triangulation_hierarchy_2.h>`.
We provide partial specialization for the classes `CGAL::Triangulation_2` and `CGAL::Delaunay_triangulation_2`
We provide partial specialization for the classes
`CGAL::Triangulation_2`, `CGAL::Delaunay_triangulation_2`,
`CGAL::Regular_triangulation_2` `CGAL::Constrained_triangulation_2`,
`CGAL::Constrained_Delaunay_triangulation_2`, `CGAL::Constrained_triangulation_plus_2`,
and `CGAL::Triangulation_hierarchy_2`
so that they are model of the graph concepts
<A HREF="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">`BidirectionalGraph`</A> and
<A HREF="http://www.boost.org/libs/graph/doc/EdgeAndVertexListGraph.html">`EdgeAndVertexListGraph`</A>.
<A HREF="http://www.boost.org/libs/graph/doc/VertexAndEdgeListGraph.html">`VertexAndEdgeListGraph`</A>.
The mapping between vertices and edges of the triangulation and the
@ -266,7 +276,7 @@ Defined in `<CGAL/boost/graph/graph_traits_Arrangement_2.h>`
We provide partial specialization for the class `Arrangement_2`
so that it is model of the graph concepts
<A HREF="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">`BidirectionalGraph`</A> and
<A HREF="http://www.boost.org/libs/graph/doc/EdgeAndVertexListGraph.html">`EdgeAndVertexListGraph`</A>.
<A HREF="http://www.boost.org/libs/graph/doc/VertexAndEdgeListGraph.html">`VertexAndEdgeListGraph`</A>.
The const specialization, `boost::graph_traits< CGAL::Arrangement_2<Traits,Dcel> const>`
is also defined, using the constant handles in the arrangement.

View File

@ -2,11 +2,7 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#if defined(CGAL_USE_OPENMESH)
#include <OpenMesh/Core/IO/MeshIO.hh>
@ -80,7 +76,7 @@ int main(int argc, char* argv[])
CGAL::copy_face_graph(T1, S, std::inserter(v2v, v2v.end()), std::inserter(h2h, h2h.end()));
std::ofstream out("reverse.off");
out << T1;
out << S;
}
return 0;
}

View File

@ -1,8 +1,6 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <boost/graph/breadth_first_search.hpp>

View File

@ -1,7 +1,5 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/iterator.h>
#include <iostream>
#include <fstream>

View File

@ -1,7 +1,5 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <iostream>
#include <list>

View File

@ -1,8 +1,6 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <iostream>
#include <list>

View File

@ -9,12 +9,8 @@
// Polyhedron
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
// Graph traits adaptors
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
typedef CGAL::Cartesian<double> Kernel;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;

View File

@ -1,8 +1,6 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Iterator_range.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <boost/foreach.hpp>

View File

@ -1,11 +1,10 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/iterator.h>
#include <fstream>
#include <CGAL/boost/graph/iterator.h>
#include <boost/iterator/transform_iterator.hpp>
#include <fstream>
#include <algorithm>
typedef CGAL::Simple_cartesian<double> Kernel;

View File

@ -0,0 +1,112 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_hierarchy_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
#include <CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h>
#include <CGAL/boost/graph/graph_traits_Constrained_Delaunay_triangulation_2.h>
#include <CGAL/boost/graph/graph_traits_Constrained_triangulation_plus_2.h>
#include <CGAL/boost/graph/graph_traits_Triangulation_hierarchy_2.h>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point;
typedef CGAL::Triangulation_vertex_base_2<K> Vbb;
typedef CGAL::Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<K,TDS,Itag> CDT;
typedef CGAL::Triangulation_hierarchy_2<CDT> CDTH;
typedef CGAL::Constrained_triangulation_plus_2<CDTH> Triangulation;
// As we only consider finite vertices and edges
// we need the following filter
template <typename T>
struct Is_finite {
const T* t_;
Is_finite()
: t_(NULL)
{}
Is_finite(const T& t)
: t_(&t)
{ }
template <typename VertexOrEdge>
bool operator()(const VertexOrEdge& voe) const {
return ! t_->is_infinite(voe);
}
};
typedef Is_finite<Triangulation> Filter;
typedef boost::filtered_graph<Triangulation,Filter,Filter> Finite_triangulation;
typedef boost::graph_traits<Finite_triangulation>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterator;
typedef boost::graph_traits<Finite_triangulation>::edge_descriptor edge_descriptor;
// The BGL makes use of indices associated to the vertices
// We use a std::map to store the index
typedef std::map<vertex_descriptor,int> VertexIndexMap;
VertexIndexMap vertex_id_map;
// A std::map is not a property map, because it is not lightweight
typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
int
main(int argc,char* argv[])
{
const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
std::ifstream input(filename);
Triangulation t;
Filter is_finite(t);
Finite_triangulation ft(t, is_finite, is_finite);
Point p ;
while(input >> p){
t.insert(p);
}
vertex_iterator vit, ve;
// Associate indices to the vertices
int index = 0;
// boost::tie assigns the first and second element of the std::pair
// returned by boost::vertices to the variables vit and ve
for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
vertex_descriptor vd = *vit;
vertex_id_map[vd]= index++;
}
// We use the default edge weight which is the squared length of the edge
// This property map is defined in graph_traits_Triangulation_2.h
// In the function call you can see a named parameter: vertex_index_map
std::list<edge_descriptor> mst;
boost::kruskal_minimum_spanning_tree(ft,
std::back_inserter(mst),
vertex_index_map(vertex_index_pmap));
std::cout << "The edges of the Euclidean mimimum spanning tree:" << std::endl;
for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it){
edge_descriptor ed = *it;
vertex_descriptor svd = source(ed,t);
vertex_descriptor tvd = target(ed,t);
Triangulation::Vertex_handle sv = svd;
Triangulation::Vertex_handle tv = tvd;
std::cout << "[ " << sv->point() << " | " << tv->point() << " ] " << std::endl;
}
return 0;
}

View File

@ -0,0 +1,98 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Regular_triangulation_2.h>
#include <CGAL/boost/graph/graph_traits_Regular_triangulation_2.h>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point;
typedef CGAL::Regular_triangulation_2<K> Triangulation;
// As we only consider finite vertices and edges
// we need the following filter
template <typename T>
struct Is_finite {
const T* t_;
Is_finite()
: t_(NULL)
{}
Is_finite(const T& t)
: t_(&t)
{ }
template <typename VertexOrEdge>
bool operator()(const VertexOrEdge& voe) const {
return ! t_->is_infinite(voe);
}
};
typedef Is_finite<Triangulation> Filter;
typedef boost::filtered_graph<Triangulation,Filter,Filter> Finite_triangulation;
typedef boost::graph_traits<Finite_triangulation>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterator;
typedef boost::graph_traits<Finite_triangulation>::edge_descriptor edge_descriptor;
// The BGL makes use of indices associated to the vertices
// We use a std::map to store the index
typedef std::map<vertex_descriptor,int> VertexIndexMap;
VertexIndexMap vertex_id_map;
// A std::map is not a property map, because it is not lightweight
typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
int
main(int argc,char* argv[])
{
const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
std::ifstream input(filename);
Triangulation t;
Filter is_finite(t);
Finite_triangulation ft(t, is_finite, is_finite);
Point p ;
while(input >> p){
t.insert(p);
}
vertex_iterator vit, ve;
// Associate indices to the vertices
int index = 0;
// boost::tie assigns the first and second element of the std::pair
// returned by boost::vertices to the variables vit and ve
for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
vertex_descriptor vd = *vit;
vertex_id_map[vd]= index++;
}
// We use the default edge weight which is the squared length of the edge
// This property map is defined in graph_traits_Triangulation_2.h
// In the function call you can see a named parameter: vertex_index_map
std::list<edge_descriptor> mst;
boost::kruskal_minimum_spanning_tree(ft,
std::back_inserter(mst),
vertex_index_map(vertex_index_pmap));
std::cout << "The edges of the Euclidean mimimum spanning tree:" << std::endl;
for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it){
edge_descriptor ed = *it;
vertex_descriptor svd = source(ed,t);
vertex_descriptor tvd = target(ed,t);
Triangulation::Vertex_handle sv = svd;
Triangulation::Vertex_handle tv = tvd;
std::cout << "[ " << sv->point() << " | " << tv->point() << " ] " << std::endl;
}
return 0;
}

View File

@ -30,10 +30,13 @@ namespace CGAL
{
template<typename Graph,typename Descriptor>
template<typename Graph_, typename Descriptor_>
struct Gwdwg_descriptor
{
public:
typedef Graph_ Graph;
typedef Descriptor_ Descriptor;
Graph* graph;
Descriptor descriptor;
@ -124,9 +127,10 @@ Property maps can be wrapped with `Graph_with_descriptor_with_graph_property_map
\cgalModels `MutableFaceGraph` if `Graph` is a model of `MutableFaceGraph`
*/
template<typename Graph>
template<typename Graph_>
struct Graph_with_descriptor_with_graph
{
typedef Graph_ Graph;
Graph* graph;
typedef boost::graph_traits<Graph> gt;
@ -135,11 +139,13 @@ struct Graph_with_descriptor_with_graph
typedef Gwdwg_descriptor<Graph, typename gt::edge_descriptor> edge_descriptor;
typedef Gwdwg_descriptor<Graph, typename gt::face_descriptor> face_descriptor;
Graph_with_descriptor_with_graph()
: graph(NULL)
{}
Graph_with_descriptor_with_graph(Graph& graph)
: graph(&graph)
{}
private:
Graph_with_descriptor_with_graph(const Graph_with_descriptor_with_graph&){} // disable copy-constructor to avoid non-wanted copies
};

View File

@ -0,0 +1,22 @@
// Copyright (c) 2017 GeometryFactory (France). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Maxime Gimeno
// List the named parameters imported from boost we are using in CGAL
CGAL_add_named_parameter(vertex_index_t, vertex_index, vertex_index_map)
CGAL_add_named_parameter(graph_visitor_t, visitor, visitor)

View File

@ -697,6 +697,32 @@ make_tetrahedron(const P& p0, const P& p1, const P& p2, const P& p3, Graph& g)
return opposite(h2,g);
}
/// \cond SKIP_IN_DOC
template <class Traits, class TriangleMesh, class VertexPointMap>
bool is_degenerate_triangle_face(
typename boost::graph_traits<TriangleMesh>::halfedge_descriptor hd,
TriangleMesh& tmesh,
const VertexPointMap& vpmap,
const Traits& traits)
{
CGAL_assertion(!is_border(hd, tmesh));
const typename Traits::Point_3& p1 = get(vpmap, target( hd, tmesh) );
const typename Traits::Point_3& p2 = get(vpmap, target(next(hd, tmesh), tmesh) );
const typename Traits::Point_3& p3 = get(vpmap, source( hd, tmesh) );
return traits.collinear_3_object()(p1, p2, p3);
}
template <class Traits, class TriangleMesh, class VertexPointMap>
bool is_degenerate_triangle_face(
typename boost::graph_traits<TriangleMesh>::face_descriptor fd,
TriangleMesh& tmesh,
const VertexPointMap& vpmap,
const Traits& traits)
{
return is_degenerate_triangle_face(halfedge(fd,tmesh), tmesh, vpmap, traits);
}
/// \endcond
namespace internal {
@ -725,7 +751,7 @@ clear_impl(FaceGraph& g)
}
}
}
} //end of internal namespace
/**
* \ingroup PkgBGLHelperFct
@ -751,6 +777,7 @@ void clear(FaceGraph& g)
CGAL_postcondition(num_faces(g) == 0);
}
} // namespace CGAL
// Include "Euler_operations.h" at the end, because its implementation

View File

@ -101,17 +101,26 @@ namespace boost{
} //end of namespace boost
#endif
namespace CGAL {
enum vertex_is_fixed_t { vertex_is_fixed } ;
enum set_cache_policy_t { set_cache_policy } ;
enum get_cost_policy_t { get_cost_policy } ;
enum get_cost_policy_params_t { get_cost_policy_params } ;
enum get_placement_policy_t { get_placement_policy } ;
enum get_placement_policy_params_t { get_placement_policy_params } ;
enum edge_is_constrained_t { edge_is_constrained } ;
enum edge_is_constrained_params_t { edge_is_constrained_params } ;
namespace CGAL {
namespace internal_np{
// for uniformity we import them in this namespace. Note that
// it is an import so that if we use the named parameter function
// from boost it will work
using boost::vertex_index_t;
using boost::vertex_index;
using boost::graph_visitor_t;
using boost::visitor;
// define enum types and values for new named parameters
#define CGAL_add_named_parameter(X, Y, Z) \
enum X { Y };
#include <CGAL/boost/graph/parameters_interface.h>
#undef CGAL_add_named_parameter
}//internal_np
template <typename T, typename Tag, typename Base = boost::no_property>
struct cgal_bgl_named_params : boost::bgl_named_params<T, Tag, Base>
{
@ -121,232 +130,35 @@ namespace CGAL {
cgal_bgl_named_params(T v = T()) : base(v) {}
cgal_bgl_named_params(T v, const Base& b) : base(v, b) {}
template <typename IndexMap>
cgal_bgl_named_params<IndexMap, boost::vertex_index_t, self>
vertex_index_map(const IndexMap& p) const
{
typedef cgal_bgl_named_params<IndexMap, boost::vertex_index_t, self> Params;
return Params(p, *this);
}
template <typename PointMap>
cgal_bgl_named_params<PointMap, vertex_point_t, self>
vertex_point_map(const PointMap& p) const
{
typedef cgal_bgl_named_params<PointMap, vertex_point_t, self> Params;
return Params(p, *this);
}
template <typename IsFixedMap>
cgal_bgl_named_params<IsFixedMap, vertex_is_fixed_t, self>
vertex_is_fixed_map(const IsFixedMap& p) const
{
typedef cgal_bgl_named_params<IsFixedMap, vertex_is_fixed_t, self> Params;
return Params(p, *this);
}
template <typename IndexMap>
cgal_bgl_named_params<IndexMap, boost::edge_index_t, self>
edge_index_map(const IndexMap& p) const
{
typedef cgal_bgl_named_params<IndexMap, boost::edge_index_t, self> Params;
return Params(p, *this);
}
template <typename IndexMap>
cgal_bgl_named_params<IndexMap, boost::halfedge_index_t, self>
halfedge_index_map(const IndexMap& p) const
{
typedef cgal_bgl_named_params<IndexMap, boost::halfedge_index_t, self> Params;
return Params(p, *this);
}
template <typename IndexMap>
cgal_bgl_named_params<IndexMap, boost::face_index_t, self>
face_index_map(const IndexMap& p) const
{
typedef cgal_bgl_named_params<IndexMap, boost::face_index_t, self> Params;
return Params(p, *this);
}
template <typename Visitor>
cgal_bgl_named_params<Visitor, boost::graph_visitor_t, self>
visitor(const Visitor& p) const
{
typedef cgal_bgl_named_params<Visitor, boost::graph_visitor_t, self> Params;
return Params(p, *this);
}
template <typename SetCache>
cgal_bgl_named_params<SetCache, set_cache_policy_t, self>
set_cache(const SetCache& p) const
{
typedef cgal_bgl_named_params<SetCache, set_cache_policy_t, self> Params;
return Params(p, *this);
}
template <typename GetCost>
cgal_bgl_named_params<GetCost, get_cost_policy_t, self>
get_cost(const GetCost& p) const
{
typedef cgal_bgl_named_params<GetCost, get_cost_policy_t, self> Params;
return Params(p, *this);
}
template <typename GetCostParams>
cgal_bgl_named_params<GetCostParams, get_cost_policy_params_t, self>
get_cost_params(const GetCostParams& p) const
{
typedef cgal_bgl_named_params<GetCostParams, get_cost_policy_params_t, self> Params;
return Params(p, *this);
}
template <typename GetPlacement>
cgal_bgl_named_params<GetPlacement, get_placement_policy_t, self>
get_placement(const GetPlacement& p) const
{
typedef cgal_bgl_named_params<GetPlacement, get_placement_policy_t, self> Params;
return Params(p, *this);
}
template <typename GetPlacementParams>
cgal_bgl_named_params<GetPlacementParams, get_placement_policy_params_t, self>
get_placement_params(const GetPlacementParams& p) const
{
typedef cgal_bgl_named_params<GetPlacementParams, get_placement_policy_params_t, self> Params;
return Params(p, *this);
}
template <typename EdgeIsConstrained>
cgal_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t, self>
edge_is_constrained_map(const EdgeIsConstrained& em) const
{
typedef cgal_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t, self> Params;
return Params(em, *this);
}
template <typename EdgeIsConstrainedParams>
cgal_bgl_named_params<EdgeIsConstrainedParams, edge_is_constrained_params_t, self>
edge_is_constrained_map_params(const EdgeIsConstrainedParams& em) const
{
typedef cgal_bgl_named_params<EdgeIsConstrainedParams, edge_is_constrained_params_t, self> Params;
return Params(em, *this);
}
// create the functions for new named parameters and the one imported boost
// used to concatenate several parameters
#define CGAL_add_named_parameter(X, Y, Z) \
template<typename K> \
cgal_bgl_named_params<K, internal_np::X, self> \
Z(const K& k) const \
{ \
typedef cgal_bgl_named_params<K, internal_np::X, self> Params;\
return Params(k, *this); \
}
#include <CGAL/boost/graph/parameters_interface.h>
#include <CGAL/boost/graph/boost_parameters_interface.h>
#undef CGAL_add_named_parameter
};
namespace parameters {
template <typename IndexMap>
cgal_bgl_named_params<IndexMap, boost::vertex_index_t>
vertex_index_map(IndexMap const& p)
{
typedef cgal_bgl_named_params<IndexMap, boost::vertex_index_t> Params;
return Params(p);
}
template <typename IndexMap>
cgal_bgl_named_params<IndexMap, boost::halfedge_index_t>
halfedge_index_map(IndexMap const& p)
{
typedef cgal_bgl_named_params<IndexMap, boost::halfedge_index_t> Params;
return Params(p);
}
template <typename IndexMap>
cgal_bgl_named_params<IndexMap, boost::face_index_t>
face_index_map(IndexMap const& p)
{
typedef cgal_bgl_named_params<IndexMap, boost::face_index_t> Params;
return Params(p);
}
template <typename PointMap>
cgal_bgl_named_params<PointMap, vertex_point_t>
vertex_point_map(PointMap const& p)
{
typedef cgal_bgl_named_params<PointMap, vertex_point_t> Params;
return Params(p);
}
template <typename IsFixedMap>
cgal_bgl_named_params<IsFixedMap, vertex_is_fixed_t>
vertex_is_fixed_map(IsFixedMap const& p)
{
typedef cgal_bgl_named_params<IsFixedMap, vertex_is_fixed_t> Params;
return Params(p);
}
template <typename IndexMap>
cgal_bgl_named_params<IndexMap, boost::edge_index_t>
edge_index_map(IndexMap const& pmap)
{
typedef cgal_bgl_named_params<IndexMap, boost::edge_index_t> Params;
return Params(pmap);
}
template <typename Visitor>
cgal_bgl_named_params<Visitor, boost::graph_visitor_t>
visitor(const Visitor& p)
{
typedef cgal_bgl_named_params<Visitor, boost::graph_visitor_t> Params;
return Params(p);
}
template <typename SetCache>
cgal_bgl_named_params<SetCache, set_cache_policy_t>
set_cache(const SetCache& p)
{
typedef cgal_bgl_named_params<SetCache, set_cache_policy_t> Params;
return Params(p);
}
template <typename GetCost>
cgal_bgl_named_params<GetCost, get_cost_policy_t>
get_cost(const GetCost& p)
{
typedef cgal_bgl_named_params<GetCost, get_cost_policy_t> Params;
return Params(p);
}
template <typename GetCostParams>
cgal_bgl_named_params<GetCostParams, get_cost_policy_params_t>
get_cost_params(const GetCostParams& p)
{
typedef cgal_bgl_named_params<GetCostParams, get_cost_policy_params_t> Params;
return Params(p);
}
template <typename GetPlacement>
cgal_bgl_named_params<GetPlacement, get_placement_policy_t>
get_placement(const GetPlacement& p)
{
typedef cgal_bgl_named_params<GetPlacement, get_placement_policy_t> Params;
return Params(p);
}
template <typename GetPlacementParams>
cgal_bgl_named_params<GetPlacementParams, get_placement_policy_params_t>
get_placement_params(const GetPlacementParams& p)
{
typedef cgal_bgl_named_params<GetPlacementParams, get_placement_policy_params_t> Params;
return Params(p);
}
template <typename EdgeIsConstrained>
cgal_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t>
edge_is_constrained_map(const EdgeIsConstrained& em)
{
typedef cgal_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t> Params;
return Params(em);
}
template <typename EdgeIsConstrainedParams>
cgal_bgl_named_params<EdgeIsConstrainedParams, edge_is_constrained_params_t>
edge_is_constrained_map_params(const EdgeIsConstrainedParams& em)
{
typedef cgal_bgl_named_params<EdgeIsConstrainedParams, edge_is_constrained_params_t> Params;
return Params(em);
// define free functions for named parameters
#define CGAL_add_named_parameter(X, Y, Z) \
template <typename K> \
cgal_bgl_named_params<K, internal_np::X> \
Z(K const& p) \
{ \
typedef cgal_bgl_named_params<K, internal_np::X> Params;\
return Params(p); \
}
#include <CGAL/boost/graph/parameters_interface.h>
#include <CGAL/boost/graph/boost_parameters_interface.h>
#undef CGAL_add_named_parameter
} // namespace parameters

View File

@ -0,0 +1,30 @@
// Copyright (c) 2017 GeometryFactory (France). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Maxime Gimeno
// List of named parameters that we use in CGAL
CGAL_add_named_parameter(vertex_point_t, vertex_point, vertex_point_map)
CGAL_add_named_parameter(face_index_t, face_index, face_index_map)
CGAL_add_named_parameter(edge_index_t, edge_index, edge_index_map)
CGAL_add_named_parameter(halfedge_index_t, halfedge_index, halfedge_index_map)
CGAL_add_named_parameter(edge_is_constrained_t, edge_is_constrained, edge_is_constrained_map)
CGAL_add_named_parameter(set_cache_policy_t, set_cache_policy, set_cache)
CGAL_add_named_parameter(get_cost_policy_t, get_cost_policy, get_cost)
CGAL_add_named_parameter(get_cost_policy_params_t, get_cost_policy_params, get_cost_params)
CGAL_add_named_parameter(get_placement_policy_t, get_placement_policy, get_placement)
CGAL_add_named_parameter(get_placement_policy_params_t, get_placement_policy_params, get_placement_params)

View File

@ -213,7 +213,7 @@ reduce_face_selection(
/*!
\ingroup PkgBGLSelectionFct
discovers and puts in `out` all faces incident to the target vertex
Discovers and puts in `out` all faces incident to the target vertex
of a halfedge in `hedges`. Faces are put exactly once in `out`.
\tparam HalfedgeRange a range of halfedge descriptors, model of `Range`.
Its iterator type is `InputIterator`.
@ -252,7 +252,6 @@ select_incident_faces(
return out;
}
// Operations on edges
/*!
\ingroup PkgBGLSelectionFct
Augments a selection with edges of `fg` that are adjacent
@ -406,7 +405,6 @@ reduce_edge_selection(
return out;
}
// Operations on vertices
/*!
\ingroup PkgBGLSelectionFct
Augments a selection with vertices of `fg` that are adjacent

View File

@ -21,11 +21,12 @@
#define CGAL_SPLIT_GRAPH_INTO_POLYLINES
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <boost/foreach.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <iostream>
#include <CGAL/assertions.h>
#include <CGAL/tags.h>
namespace CGAL {
@ -318,10 +319,11 @@ split_graph_into_polylines(const Graph& graph,
polyline_visitor.add_node(g_copy[v]);
internal::bgl_sgip_maybe_call_visitor_add_edge(polyline_visitor,
g_copy[*b]);
if (degree(v, g_copy)==1)
terminal.erase(v);
remove_edge(b, g_copy);
u = v;
}
terminal.erase(u);
polyline_visitor.end_polyline();
}

View File

@ -1,10 +1,21 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/graph_traits_Triangulation_2.h>
#include <CGAL/boost/graph/graph_traits_Constrained_triangulation_2.h>
#include <CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h>
#include <CGAL/boost/graph/graph_traits_Constrained_Delaunay_triangulation_2.h>
#include <CGAL/boost/graph/graph_traits_Constrained_triangulation_plus_2.h>
#include <CGAL/boost/graph/graph_traits_Triangulation_hierarchy_2.h>
#include <CGAL/boost/graph/graph_concepts.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Triangulation_2<Kernel> Triangulation;
typedef CGAL::Delaunay_triangulation_2<Kernel> DT2;
typedef CGAL::Constrained_triangulation_2<Kernel> CT2;
typedef CGAL::Constrained_Delaunay_triangulation_2<Kernel> CDT2;
typedef CGAL::Constrained_triangulation_plus_2<CDT2> CDTP2;
typedef CGAL::Triangulation_hierarchy_2<DT2> THDT2;
typedef CGAL::Triangulation_hierarchy_2<CDTP2> THCDTP2;
template<typename T>
void concept_check_triangulation() {
@ -15,5 +26,11 @@ void concept_check_triangulation() {
int main()
{
concept_check_triangulation<Triangulation>();
concept_check_triangulation<DT2>();
concept_check_triangulation<CT2>();
concept_check_triangulation<CDT2>();
concept_check_triangulation<CDTP2>();
concept_check_triangulation<THDT2>();
concept_check_triangulation<THCDTP2>();
return 0;
}

View File

@ -1,52 +0,0 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/graph_traits_Triangulation_2.h>
#include <boost/graph/graph_test.hpp>
#include <boost/graph/random.hpp>
#include <boost/assign.hpp>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Triangulation_2<Kernel> Triangulation;
typedef typename Triangulation::Point Point;
typedef typename Triangulation::Vertex Vertex;
typedef typename Triangulation::Vertex Vertex_handle;
int test_main(int, char*[])
{
using namespace boost::assign;
Triangulation t;
{
std::vector<Point> v;
// taken from the triangulation test cases, should be randomly generated
v += Point(5,6,1), Point(1,9,1), Point(6,14,1), Point(4,12,1), Point(3,29,1), Point(6,7,1),
Point(6,39,1), Point(8,9,1), Point(10,18,1), Point(75625,155625,10000),
Point(10,50,2), Point(6,15,2), Point(6,16,2), Point(10,11,1),
Point(10,40,1), Point(60,-10,1);
t.insert(v.begin(), v.end());
}
typedef typename boost::graph_traits<Triangulation>::vertex_descriptor vertex_t;
std::vector<vertex_t> vv;
for(typename Triangulation::Finite_vertices_iterator it = t.finite_vertices_begin();
it != t.finite_vertices_end(); ++it) {
vv.push_back(it);
}
std::vector< std::pair<vertex_t, vertex_t> > e;
for(Triangulation::All_edges_iterator it = t.all_edges_begin();
it != t.all_edges_end(); ++it) {
e.push_back(
std::make_pair(
it->first->vertex((it->second + 2) % 3)
, it->first->vertex((it->second + 1) % 3)));
}
boost::graph_test<Triangulation> gt;
gt.test_bidirectional_graph(vv, e, t);
return 0;
}

View File

@ -2,6 +2,8 @@
#include <CGAL/assertions.h>
#include <boost/type_traits/is_same.hpp>
template <int i>
struct A{
A(int v):v(v){}
@ -20,36 +22,33 @@ template<class NamedParameters>
void test(const NamedParameters& np)
{
// test values
assert( get_param(np,boost::vertex_index).v == 0 );
assert( get_param(np,boost::halfedge_index).v == 1 );
assert( get_param(np,boost::face_index).v == 2 );
assert( get_param(np,boost::vertex_point).v == 3 );
assert( get_param(np,CGAL::vertex_is_fixed).v == 4 );
assert( get_param(np,boost::edge_index).v == 5 );
assert( get_param(np,CGAL::internal_np::vertex_index).v == 0 );
assert( get_param(np,CGAL::internal_np::halfedge_index).v == 1 );
assert( get_param(np,CGAL::internal_np::face_index).v == 2 );
assert( get_param(np,CGAL::internal_np::vertex_point).v == 3 );
assert( get_param(np,CGAL::internal_np::edge_index).v == 5 );
assert( get_param(np,boost::graph_visitor).v == 6 );
assert( get_param(np,CGAL::set_cache_policy).v == 7 );
assert( get_param(np,CGAL::get_cost_policy).v == 8 );
assert( get_param(np,CGAL::get_cost_policy_params).v == 9 );
assert( get_param(np,CGAL::get_placement_policy).v == 10 );
assert( get_param(np,CGAL::get_placement_policy_params).v == 11 );
assert( get_param(np,CGAL::edge_is_constrained).v == 12 );
assert( get_param(np,CGAL::edge_is_constrained_params).v == 13 );
assert( get_param(np,CGAL::internal_np::set_cache_policy).v == 7 );
assert( get_param(np,CGAL::internal_np::get_cost_policy).v == 8 );
assert( get_param(np,CGAL::internal_np::get_cost_policy_params).v == 9 );
assert( get_param(np,CGAL::internal_np::get_placement_policy).v == 10 );
assert( get_param(np,CGAL::internal_np::get_placement_policy_params).v == 11 );
assert( get_param(np,CGAL::internal_np::edge_is_constrained).v == 12 );
//test types
check_same_type<0>( get_param(np,boost::vertex_index) );
check_same_type<1>( get_param(np,boost::halfedge_index) );
check_same_type<2>( get_param(np,boost::face_index) );
check_same_type<3>( get_param(np,boost::vertex_point) );
check_same_type<4>( get_param(np,CGAL::vertex_is_fixed) );
check_same_type<5>( get_param(np,boost::edge_index) );
check_same_type<1>( get_param(np,CGAL::internal_np::halfedge_index) );
check_same_type<2>( get_param(np,CGAL::internal_np::face_index) );
check_same_type<3>( get_param(np,CGAL::internal_np::vertex_point) );
check_same_type<5>( get_param(np,CGAL::internal_np::edge_index) );
check_same_type<6>( get_param(np,boost::graph_visitor) );
check_same_type<7>( get_param(np,CGAL::set_cache_policy) );
check_same_type<8>( get_param(np,CGAL::get_cost_policy) );
check_same_type<9>( get_param(np,CGAL::get_cost_policy_params) );
check_same_type<10>( get_param(np,CGAL::get_placement_policy) );
check_same_type<11>( get_param(np,CGAL::get_placement_policy_params) );
check_same_type<12>( get_param(np,CGAL::edge_is_constrained) );
check_same_type<13>( get_param(np,CGAL::edge_is_constrained_params) );
check_same_type<7>( get_param(np,CGAL::internal_np::set_cache_policy) );
check_same_type<8>( get_param(np,CGAL::internal_np::get_cost_policy) );
check_same_type<9>( get_param(np,CGAL::internal_np::get_cost_policy_params) );
check_same_type<10>( get_param(np,CGAL::internal_np::get_placement_policy) );
check_same_type<11>( get_param(np,CGAL::internal_np::get_placement_policy_params) );
check_same_type<12>( get_param(np,CGAL::internal_np::edge_is_constrained) );
}
int main()
@ -59,7 +58,6 @@ int main()
halfedge_index_map(A<1>(1)).
face_index_map(A<2>(2)).
vertex_point_map(A<3>(3)).
vertex_is_fixed_map(A<4>(4)).
edge_index_map(A<5>(5)).
visitor(A<6>(6)).
set_cache(A<7>(7)).
@ -67,7 +65,6 @@ int main()
get_cost_params(A<9>(9)).
get_placement(A<10>(10)).
get_placement_params(A<11>(11)).
edge_is_constrained_map(A<12>(12)).
edge_is_constrained_map_params(A<13>(13))
edge_is_constrained_map(A<12>(12))
);
}

View File

@ -9,9 +9,8 @@
typedef boost::unordered_set<std::size_t> id_map;
template <typename Graph>
void test_isolated_vertex(const Graph& g)
void test_isolated_vertex()
{
std::cerr << typeid(g).name() << std::endl;
Graph G;
typedef boost::graph_traits< Graph > Traits;
typedef typename Traits::vertex_descriptor vertex_descriptor;
@ -273,8 +272,8 @@ test(const std::vector<Graph>& graphs)
test_faces(p);
test_halfedge_around_vertex_iterator(p);
test_halfedge_around_face_iterator(p);
test_isolated_vertex(p);
}
test_isolated_vertex<Graph>();
}
int

View File

@ -4,6 +4,9 @@
project( Boolean_set_operations_2_GraphicsView_Demo )
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()

View File

@ -43,7 +43,7 @@ Polygon_2 construct_polygon (const Circle_2& circle)
return pgn;
}
// Construct a point from a rectangle.
// Construct a polygon from a rectangle.
Polygon_2 construct_polygon (const Point_2& p1, const Point_2& p2,
const Point_2& p3, const Point_2& p4)
{

View File

@ -1187,6 +1187,13 @@ protected:
// accessor for low-level arrangement fonctionalities
CGAL::Arr_accessor<Aos_2> accessor(*arr);
// the face field of outer and inner ccb are used in the loop to access the old face an halfedge
// used to contribute to. These two vectors are used to delay the association to the new face to
// avoid overwriting a field that is still needed
typedef std::pair<typename Aos_2::Dcel::Outer_ccb*, typename Aos_2::Dcel::Face*> Outer_ccb_and_face;
typedef std::pair<typename Aos_2::Dcel::Inner_ccb*, typename Aos_2::Dcel::Face*> Inner_ccb_and_face;
std::vector<Outer_ccb_and_face> outer_ccb_and_new_face_pairs;
std::vector<Inner_ccb_and_face> inner_ccb_and_new_face_pairs;
// update halfedge ccb pointers
for (Halfedge_iterator itr = arr->halfedges_begin(); itr != arr->halfedges_end(); ++itr)
{
@ -1208,11 +1215,12 @@ protected:
f = *(face_handles[
(*uf_faces.find(face_handles[f->id()]))->id()
]);
if (h->flag()==ON_INNER_CCB || h->flag()==NOT_VISITED)
if (h->flag()==ON_INNER_CCB)
{
typename Aos_2::Dcel::Inner_ccb* inner_ccb = inner_ccbs_to_remove.empty()?
bool reuse_inner_ccb = !inner_ccbs_to_remove.empty();
typename Aos_2::Dcel::Inner_ccb* inner_ccb = !reuse_inner_ccb?
accessor.new_inner_ccb():inner_ccbs_to_remove.back();
if ( !inner_ccbs_to_remove.empty() ) inner_ccbs_to_remove.pop_back();
if ( reuse_inner_ccb ) inner_ccbs_to_remove.pop_back();
Halfedge_handle hstart=h;
do{
@ -1222,9 +1230,13 @@ protected:
}while(hstart!=h);
f->add_inner_ccb(inner_ccb,_halfedge(h));
inner_ccb->set_halfedge(_halfedge(h));
inner_ccb->set_face(f);
if (!reuse_inner_ccb)
inner_ccb->set_face(f);
else
inner_ccb_and_new_face_pairs.push_back( std::make_pair(inner_ccb, f) );
}
else{
// we never create more outer ccb than what was available
CGAL_assertion(!outer_ccbs_to_remove.empty());
typename Aos_2::Dcel::Outer_ccb* outer_ccb = outer_ccbs_to_remove.back();
outer_ccbs_to_remove.pop_back();
@ -1236,11 +1248,17 @@ protected:
}while(hstart!=h);
f->add_outer_ccb(outer_ccb,_halfedge(h));
outer_ccb->set_halfedge(_halfedge(h));
outer_ccb->set_face(f);
outer_ccb_and_new_face_pairs.push_back( std::make_pair(outer_ccb, f) );
}
}
}
// now set the new face for all ccbs
BOOST_FOREACH(Outer_ccb_and_face& ccb_and_face, outer_ccb_and_new_face_pairs)
ccb_and_face.first->set_face(ccb_and_face.second);
BOOST_FOREACH(Inner_ccb_and_face& ccb_and_face, inner_ccb_and_new_face_pairs)
ccb_and_face.first->set_face(ccb_and_face.second);
//remove no longer used edges, vertices and faces
accessor.delete_vertices( vertices_to_remove );
accessor.delete_edges( edges_to_remove );

View File

@ -24,10 +24,11 @@
#include <CGAL/license/Bounding_volumes.h>
#define CGAL_DEPRECATED_HEADER "<CGAL/Minimum_enclosing_quadrilateral_traits_2.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Min_quadrilateral_traits_2.h>"
#include <CGAL/internal/deprecation_warning.h>
#ifndef CGAL_NO_DEPRECATED_CODE
#include <CGAL/Min_quadrilateral_traits_2.h>
#endif // CGAL_NO_DEPRECATED_CODE
#endif // ! (CGAL_MINIMUM_ENCLOSING_QUADRILATERAL_TRAITS_2_H)

View File

@ -24,10 +24,11 @@
#include <CGAL/license/Bounding_volumes.h>
#define CGAL_DEPRECATED_HEADER "<CGAL/minimum_enclosing_quadrilateral_2.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/min_quadrilateral_2.h>"
#include <CGAL/internal/deprecation_warning.h>
#ifndef CGAL_NO_DEPRECATED_CODE
#include <CGAL/min_quadrilateral_2.h>
#endif // CGAL_NO_DEPRECATED_CODE
#endif // ! (CGAL_MINIMUM_ENCLOSING_QUADRILATERAL_2_H)

View File

@ -137,7 +137,7 @@ BigFloatRep::BigFloatRep(double d) : m(0), err(0), exp(0) {
exp--;
stop++;
}
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion (s >= 0);
#endif
@ -277,7 +277,7 @@ void BigFloatRep::normal() {
// bits of error
long f = chunkFloor(--le); // f is roughly equal to floor(le/CHUNK_BIT)
long bits_f = bits(f); // f chunks will have bits_f many bits
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion (bits_f >= 0);
#endif
@ -305,7 +305,7 @@ void BigFloatRep::bigNormal(BigInt& bigErr) {
} else {
long f = chunkFloor(--le);
long bits_f = bits(f);
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion(bits_f >= 0);
#endif
@ -684,7 +684,7 @@ void BigFloatRep::sqrt(const BigFloatRep& x, const extLong& a, const BigFloat& A
} else { // p > 0
m = chunkShift(z.m, chunkCeil(p));
long r = CHUNK_BIT - 1 - (p + CHUNK_BIT - 1) % CHUNK_BIT;
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion(r >= 0);
#endif
@ -727,7 +727,7 @@ void BigFloatRep::sqrt(const BigFloatRep& x, const extLong& a, const BigFloat& A
} else { // q > 0
m = chunkShift(z.m, chunkCeil(q));
long r = CHUNK_BIT - 1 - (q + CHUNK_BIT - 1) % CHUNK_BIT;
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion(r >= 0);
#endif
@ -961,7 +961,7 @@ BigFloatRep::toDecimal(unsigned int width, bool Scientific) const {
}
decOut.isScientific = false;
}
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion(decOut.noSignificant >= 0);
#endif
@ -1025,7 +1025,7 @@ void BigFloatRep :: fromString(const char *str, extLong prec ) {
// i.e., input is A/10^{e10}.
else {
e = str + strlen(str);
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion(*e == '\0');
#endif
@ -1116,7 +1116,7 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
p = str + size;
size *= 2;
}
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion((p-str) < size);
#endif
@ -1142,7 +1142,7 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
p = str + len;
}
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion(p - str < size);
#endif
@ -1229,7 +1229,7 @@ BigInt BigFloatRep::toBigInt() const {
long le = clLg(err);
if (le == -1)
le = 0;
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion (le >= 0);
#endif
@ -1249,7 +1249,7 @@ long BigFloatRep :: toLong() const {
// convert a BigFloat to a long integer, rounded toward -\infty.
long e2 = bits(exp);
long le = clLg(err);
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
CGAL_assertion (le >= 0);
#endif

View File

@ -82,7 +82,7 @@ public:
Expr(float f) : RCExpr(NULL) { // check for valid numbers
// (i.e., not infinite and not NaN)
if (! CGAL_CORE_finite(f)) {
std::cerr << " ERROR : constructed an invalid float! " << std::endl;
core_error(" ERROR : constructed an invalid float! ", __FILE__, __LINE__, false);
if (get_static_AbortFlag())
abort();
get_static_InvalidFlag() = -1;
@ -93,7 +93,7 @@ public:
Expr(double d) : RCExpr(NULL) { // check for valid numbers
// (i.e., not infinite and not NaN)
if (! CGAL_CORE_finite(d)) {
std::cerr << " ERROR : constructed an invalid double! " << std::endl;
core_error(" ERROR : constructed an invalid double! ", __FILE__, __LINE__, false);
if (get_static_AbortFlag())
abort();
get_static_InvalidFlag() = -2;
@ -183,7 +183,7 @@ public:
/// /= operator
Expr& operator/=(const Expr& e) {
if ((e.rep)->getSign() == 0) {
std::cerr << " ERROR : division by zero ! " << std::endl;
core_error(" ERROR : division by zero ! ",__FILE__, __LINE__, false);
if (get_static_AbortFlag())
abort();
get_static_InvalidFlag() = -3;
@ -386,7 +386,7 @@ inline Expr operator*(const Expr& e1, const Expr& e2) {
/// division
inline Expr operator/(const Expr& e1, const Expr& e2) {
if (e2.sign() == 0) {
std::cerr << " ERROR : division by zero ! " << std::endl;
core_error(" ERROR : division by zero ! ", __FILE__, __LINE__, false);
if (get_static_AbortFlag())
abort();
get_static_InvalidFlag() = -4;
@ -489,7 +489,7 @@ inline bool isDivisible(const Expr& e1, const Expr& e2) {
/// square root
inline Expr sqrt(const Expr& e) {
if (e.sign() < 0) {
std::cerr << " ERROR : sqrt of negative value ! " << std::endl;
core_error(" ERROR : sqrt of negative value ! ", __FILE__, __LINE__, false);
if (get_static_AbortFlag())
abort();
get_static_InvalidFlag() = -5;

View File

@ -42,6 +42,7 @@
#include <CGAL/CORE/Real.h>
#include <CGAL/CORE/Filter.h>
#include <CGAL/CORE/poly/Sturm.h>
#include <sstream>
#if defined(BOOST_MSVC)
# pragma warning(push)
@ -51,7 +52,7 @@
namespace CORE {
#if defined(CORE_DEBUG_BOUND) && !defined(CGAL_HEADER_ONLY)
#if defined(CGAL_CORE_DEBUG_BOUND) && !defined(CGAL_HEADER_ONLY)
// These counters are incremented each time each bound is recognized as equal
// to the best one in computeBound().
extern unsigned int BFMSS_counter;
@ -91,7 +92,7 @@ struct NodeInfo {
bool flagsComputed; ///< true if rootBound parameters have been computed
extLong knownPrecision; ///< Precision achieved by current approx value
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
extLong relPrecision;
extLong absPrecision;
unsigned long numNodes;
@ -229,7 +230,7 @@ public:
return nodeInfo->knownPrecision;
}
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
const extLong& relPrecision() const {
return nodeInfo->relPrecision;
}
@ -463,7 +464,7 @@ public:
/// reset the flag "visited"
virtual void clearFlag() = 0;
//@}
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
virtual unsigned long dagSize() = 0;
virtual void fullClearFlag() = 0;
#endif
@ -502,7 +503,7 @@ protected:
void clearFlag() {
visited() = false;
}
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
unsigned long dagSize();
void fullClearFlag();
#endif
@ -746,7 +747,7 @@ protected:
/// clear visited flag
void clearFlag();
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
unsigned long dagSize();
void fullClearFlag();
#endif
@ -854,7 +855,7 @@ protected:
/** This is now a misnomer, but historically accurate.
*/
extLong count();
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
unsigned long dagSize();
void fullClearFlag();
#endif
@ -1024,12 +1025,12 @@ void AddSubRep<Operator>::computeExactFlags() {
extLong l = core_max(lf, ls);
extLong u = core_max(uf, us);
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "INSIDE Add/sub Rep: " << std::endl;
#endif
if (Op(sf, ss) != 0) { // can't possibly cancel out
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Add/sub Rep: Op(sf, ss) non-zero" << std::endl;
#endif
@ -1037,38 +1038,38 @@ void AddSubRep<Operator>::computeExactFlags() {
lMSB() = l; // lMSB = core_min(lf, ls)+1 better
sign() = sf;
} else { // might cancel out
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Add/sub Rep: Op(sf, ss) zero" << std::endl;
#endif
uMSB() = u + EXTLONG_ONE;
uMSB() = u;
if (lf >= us + EXTLONG_TWO) {// one is at least 1 order of magnitude larger
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Add/sub Rep: Can't cancel" << std::endl;
#endif
lMSB() = lf - EXTLONG_ONE; // can't possibly cancel out
sign() = sf;
} else if (ls >= uf + EXTLONG_TWO) {
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Add/sub Rep: Can't cancel" << std::endl;
#endif
lMSB() = ls - EXTLONG_ONE;
sign() = Op(ss);
} else if (ffVal.isOK()) {// begin filter computation
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Add/sub Rep: filter used" << std::endl;
#endif
#ifdef CORE_DEBUG_FILTER
#ifdef CGAL_CORE_DEBUG_FILTER
std::cout << "call filter in " << op() << "Rep" << std::endl;
#endif
sign() = ffVal.sign();
lMSB() = ffVal.lMSB();
uMSB() = ffVal.uMSB();
} else { // about the same size, might cancel out
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Add/sub Rep: iteration start" << std::endl;
#endif
@ -1108,7 +1109,7 @@ void AddSubRep<Operator>::computeExactFlags() {
sign() = 0;
}
} else { // else do progressive evaluation
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Add/sub Rep: progressive eval" << std::endl;
#endif
// Oct 30, 2002: fixed a bug here! Old versions used relative
@ -1124,7 +1125,7 @@ void AddSubRep<Operator>::computeExactFlags() {
extLong ua = lowBound.asLong() + EXTLONG_ONE;
// NOTE: ua is allowed to be CORE_INFTY
#ifdef CORE_DEBUG_BOUND
#ifdef CGAL_CORE_DEBUG_BOUND
std::cout << "DebugBound:" << "ua = " << ua << std::endl;
#endif
// We initially set the lMSB and sign as if the value is zero:
@ -1135,7 +1136,7 @@ void AddSubRep<Operator>::computeExactFlags() {
// Now we try to determine the real lMSB and sign,
// in case it is not really zero:
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Upper bound (ua) for iteration is " << ua << std::endl;
std::cout << "Starting iteration at i = " << i << std::endl;
#endif
@ -1156,7 +1157,7 @@ void AddSubRep<Operator>::computeExactFlags() {
Real newValue = Op(first->getAppValue(CORE_INFTY, i),
second->getAppValue(CORE_INFTY, i));
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
if (newValue.getRep().ID() == REAL_BIGFLOAT)
std::cout << "BigFloat! newValue->rep->ID() = "
<< newValue.getRep().ID() << std::endl;
@ -1180,10 +1181,10 @@ void AddSubRep<Operator>::computeExactFlags() {
lMSB() = newValue.lMSB();
uMSB() = newValue.uMSB();
sign() = newValue.sign();
#ifdef CORE_DEBUG_BOUND
#ifdef CGAL_CORE_DEBUG_BOUND
std::cout << "DebugBound(Exit Loop): " << "i=" << i << std::endl;
#endif
#ifdef CORE_TRACE
#ifdef CGAL_CORE_TRACE
std::cout << "Zero is not in, lMSB() = " << lMSB()
<< ", uMSB() = " << uMSB()
<< ", sign() = " << sign() << std::endl;
@ -1200,7 +1201,7 @@ void AddSubRep<Operator>::computeExactFlags() {
if (get_static_EscapePrecWarning())
std::cout<< "Escape Precision triggered at "
<< get_static_EscapePrec() << " bits" << std::endl;
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
std::cout << "EscapePrecFlags=" << get_static_EscapePrecFlag() << std::endl;
std::cout << "ua =" << ua << ",lowBound=" << lowBound << std::endl;
#endif
@ -1208,7 +1209,7 @@ void AddSubRep<Operator>::computeExactFlags() {
}// if
}// for (long i=1...)
#if defined(CORE_DEBUG_BOUND) && !defined(CGAL_HEADER_ONLY)
#if defined(CGAL_CORE_DEBUG_BOUND) && !defined(CGAL_HEADER_ONLY)
rootBoundHitCounter++;
#endif
@ -1243,8 +1244,9 @@ void AddSubRep<Operator>::computeApproxValue(const extLong& relPrec,
// handling overflow and underflow
if (lMSB() >= EXTLONG_BIG || lMSB() <= EXTLONG_SMALL)
{
std::cerr << "lMSB = " << lMSB() << std::endl; // should be in core_error
core_error("CORE WARNING: a huge lMSB in AddSubRep",
std::ostringstream oss;
oss << "CORE WARNING: a huge lMSB in AddSubRep: " << lMSB();
core_error(oss.str(),
__FILE__, __LINE__, false);
}
@ -1338,7 +1340,7 @@ inline int ExprRep::getExactSign() {
if (!flagsComputed()) {
degreeBound();
#ifdef CORE_DEBUG
#ifdef CGAL_CORE_DEBUG
dagSize();
fullClearFlag();
#endif

View File

@ -42,6 +42,7 @@
#include <CGAL/CORE/Expr.h>
#include <cmath>
#include <sstream>
namespace CORE {
@ -1028,8 +1029,9 @@ void MultRep::computeApproxValue(const extLong& relPrec,
// handling overflow and underflow
if (lMSB() >= EXTLONG_BIG || lMSB() <= EXTLONG_SMALL)
{
std::cerr << "lMSB = " << lMSB() << std::endl; // should be in core_error
core_error("CORE WARNING: a huge lMSB in AddSubRep",
std::ostringstream oss;
oss << "CORE WARNING: a huge lMSB in AddSubRep " << lMSB();
core_error(oss.str(),
__FILE__, __LINE__, false);
}
@ -1050,8 +1052,9 @@ void DivRep::computeApproxValue(const extLong& relPrec,
// handling overflow and underflow
if (lMSB() >= EXTLONG_BIG || lMSB() <= EXTLONG_SMALL)
{
std::cerr << "lMSB = " << lMSB() << std::endl; // should be in core_error
core_error("CORE WARNING: a huge lMSB in AddSubRep",
std::ostringstream oss;
oss << "CORE WARNING: a huge lMSB in AddSubRep " << lMSB();
core_error(oss.str(),
__FILE__, __LINE__, false);
}

View File

@ -34,6 +34,7 @@
* $Id$
***************************************************************************/
#include <sstream>
//CONSTRUCTORS FOR THE BIPOLY CLASS
////////////////////////////////////////////////////////
@ -306,7 +307,9 @@ int BiPoly<NT>::getbasicterm(string s, BiPoly<NT> & P){
Polynomial<NT> q(0, cs);
P.coeffX.push_back(q);
}else{
#ifdef CGAL_CORE_TRACE
std::cout <<"ERROR IN PARSING BASIC TERM" << std::endl;
#endif
}
//i+1 points to the beginning of next syntaxtic object in the string.
if(cstr[i+1] == '^'){
@ -404,8 +407,11 @@ BiPoly<NT> BiPoly<NT>::getbipoly(string s){
P += R;
else if(cstr[oind + 1] == '-')
P -= R;
else
else{
#ifdef CGAL_CORE_TRACE
std::cout << "ERROR IN PARSING BIPOLY! " << std::endl;
#endif
}
}
return P;
@ -1337,7 +1343,11 @@ cout <<"Number of roots at " << xCurr << " are " << numRoots<<endl;
numPoints++;
}//if
xCurr += eps;
if (!xCurr.isExact()) std::cout<<"xCurr has error! xCurr=" << xCurr << std::endl;
if (!xCurr.isExact()){
std::ostringstream oss;
oss << "xCurr has error! xCurr=" << xCurr;
core_error(oss.str(), __FILE__, __LINE__, false);
}
}//main while loop
// Need to flush out the final x-interval:

View File

@ -257,7 +257,9 @@ int Polynomial<NT>::getbasicterm(string & s, Polynomial<NT> & P){
string t = s.substr(oldi+1, i -oldi -1);
P = getpoly(t);
}else{
#ifdef CGAL_CORE_TRACE
std::cout <<"ERROR IN PARSING BASIC TERM" << std::endl;
#endif
}
//i+1 points to the beginning of next syntactic object in the string.
if(cstr[i+1] == '^'){
@ -352,8 +354,11 @@ Polynomial<NT> Polynomial<NT>::getpoly(string & s){
P += R;
else if(cstr[oind + 1] == '-')
P -= R;
else
else{
#ifdef CGAL_CORE_TRACE
std::cout << "ERROR IN PARSING POLY! " << std::endl;
#endif
}
}
return (P);
@ -677,8 +682,7 @@ Polynomial<NT> Polynomial<NT>::pseudoRemainder (
tmpB.contract(); // local copy of B
C = NT(1); // Initialized to C=1.
if (B.degree == -1) {
std::cout << "ERROR in Polynomial<NT>::pseudoRemainder :\n" <<
" -- divide by zero polynomial" << std::endl;
core_error("ERROR in Polynomial<NT>::pseudoRemainder :\n -- divide by zero polynomial", __FILE__, __LINE__, false);
return Polynomial(0); // Unit Polynomial (arbitrary!)
}
if (B.degree > degree) {

View File

@ -1,6 +1,9 @@
project(CGALimageIO_Demo)
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()

View File

@ -1,6 +1,9 @@
project(CGAL_ipelets_Demo)
cmake_minimum_required(VERSION 3.1)
if(POLICY CMP0053)
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()

View File

@ -3,9 +3,6 @@
#include <cassert>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Weighted_point.h>
#include <CGAL/grabbers.h>
typedef CGAL::Simple_cartesian<double> Kernel;

View File

@ -29,7 +29,6 @@ typedef unsigned int uint;
#include <ipelib.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Weighted_point.h>
#include <CGAL/iterator.h>
#include <CGAL/Triangulation_2.h>
#include <CGAL/grabbers.h>

View File

@ -1,9 +1,9 @@
// Copyright (c) 1999, 2016
// Copyright (c) 1999, 2016
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
@ -18,7 +18,6 @@
//
// $URL$
// $Id$
//
//
// Author(s) : Mariette Yvinec
// Sylvain Pion
@ -26,28 +25,34 @@
#ifndef CGAL_CARTESIAN_WEIGHTED_POINT_2_H
#define CGAL_CARTESIAN_WEIGHTED_POINT_2_H
#include <iostream>
#include <CGAL/Handle_for.h>
#include <CGAL/Origin.h>
#include <boost/tuple/tuple.hpp>
#include <iostream>
namespace CGAL {
template < class R_ >
class Weighted_pointC2
{
typedef typename R_::Point_2 Point_2;
typedef typename R_::FT FT;
typedef typename R_::FT Weight;
typedef boost::tuple<Point_2, Weight> Rep;
typedef typename R_::Point_2 Point_2;
typedef typename R_::FT FT;
typedef FT Weight;
typedef boost::tuple<Point_2, Weight> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
public:
Weighted_pointC2 ()
{}
//explicit
Weighted_pointC2(const Origin &o)
: base(o, 0) {}
Weighted_pointC2 (const Point_2 &p)
: base(p,0)
{}
@ -56,31 +61,27 @@ public:
: base(p,w)
{}
// Constructors from coordinates are also provided for convenience, except
// that they are only from Cartesian coordinates, and with no weight, so as
// to avoid any potential ambiguity between the homogeneous weight and the
// power weight (it should be easy enough to pass a Point explicitly in those
// power weight (it should be easy enough to pass a Point_2 explicitly in those
// cases).
Weighted_pointC2(const FT& x, const FT& y)
: base(Point_2(x,y),0)
Weighted_pointC2 (const FT& x, const FT& y)
: base(Point_2(x,y), 0)
{}
const Point_2 & point() const
{
return get_pointee_or_identity(base).template get<0>();
return get_pointee_or_identity(base).template get<0>();
}
const Weight & weight() const
{
return get_pointee_or_identity(base).template get<1>();
return get_pointee_or_identity(base).template get<1>();
}
};
template < class R_ >
std::ostream &
operator<<(std::ostream &os, const Weighted_pointC2<R_> &p)
@ -94,7 +95,7 @@ operator<<(std::ostream &os, const Weighted_pointC2<R_> &p)
write(os, p.weight());
return os;
default:
return os << "Weighted_point(" << p.point() << ", " << p.weight() << ")";
return os << "Weighted_point_2(" << p.point() << ", " << p.weight() << ")";
}
}
@ -103,7 +104,7 @@ std::istream &
operator>>(std::istream &is, Weighted_pointC2<R_> &wp)
{
typename Weighted_pointC2<R_>::Weight w;
typename Weighted_pointC2<R_>::Point p;
typename Weighted_pointC2<R_>::Point_2 p;
is >> p;
if(!is) return is;
if(is_ascii(is))

View File

@ -1,9 +1,9 @@
// Copyright (c) 1999,2016
// Copyright (c) 1999,2016
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
@ -18,7 +18,6 @@
//
// $URL$
// $Id$
//
//
// Author(s) : Mariette Yvinec
// Sylvain Pion
@ -26,31 +25,34 @@
#ifndef CGAL_CARTESIAN_WEIGHTED_POINT_3_H
#define CGAL_CARTESIAN_WEIGHTED_POINT_3_H
#include <iostream>
#include <CGAL/Handle_for.h>
#include <CGAL/Origin.h>
#include <boost/tuple/tuple.hpp>
#include <iostream>
namespace CGAL {
template < class R_ >
class Weighted_pointC3
{
typedef typename R_::Point_3 Point_3;
typedef typename R_::Point_3 Point_3;
typedef typename R_::FT FT;
typedef FT Weight;
typedef typename R_::FT FT;
typedef FT Weight;
typedef boost::tuple<Point_3, Weight> Rep;
typedef boost::tuple<Point_3, Weight> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
public:
Weighted_pointC3 ()
{}
//explicit
Weighted_pointC3(const Origin &o)
: base(o,0) {}
Weighted_pointC3 (const Point_3 &p)
: base(p,0)
{}
@ -59,15 +61,12 @@ public:
: base(p,w)
{}
// Constructors from coordinates are also provided for convenience, except
// that they are only from Cartesian coordinates, and with no weight, so as
// to avoid any potential ambiguity between the homogeneous weight and the
// power weight (it should be easy enough to pass a Point_3 explicitly in those
// cases).
Weighted_pointC3 (const FT &x, const FT &y, const FT &z)
: base(Point_3(x, y, z), 0)
{}
@ -81,10 +80,8 @@ public:
{
return get_pointee_or_identity(base).template get<1>();
}
};
template < class R_ >
std::ostream &
operator<<(std::ostream &os, const Weighted_pointC3<R_> &p)

View File

@ -96,6 +96,13 @@ namespace CartesianKernelFunctors {
r.x(), r.y(), r.z(),
s.x(), s.y(), s.z());
}
result_type
operator()(const Point_3& p, const Point_3& q,
const Point_3& r, const Vector_3& n) const
{
return enum_cast<Angle>(orientation(p,q,r,r+n));
}
};
template <typename K>
@ -507,8 +514,6 @@ namespace CartesianKernelFunctors {
}
};
template < typename K >
class Compare_power_distance_2
{
@ -517,11 +522,11 @@ namespace CartesianKernelFunctors {
typedef typename K::Point_2 Point_2;
typedef typename K::Comparison_result Comparison_result;
typedef Comparison_result result_type;
typedef Comparison_result result_type;
Comparison_result operator()(const Point_2& r,
const Weighted_point_2& q,
const Weighted_point_2& p) const
const Weighted_point_2& p,
const Weighted_point_2& q) const
{
return CGAL::compare_power_distanceC2(p.x(), p.y(), p.weight(),
q.x(), q.y(), q.weight(),
@ -529,7 +534,6 @@ namespace CartesianKernelFunctors {
}
};
template <typename K>
class Compare_squared_radius_3
{
@ -1726,7 +1730,6 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Construct_base_vector_3
{
@ -1760,8 +1763,21 @@ namespace CartesianKernelFunctors {
if ( CGAL_NTS is_zero(h.c()) ) // parallel to z-axis
return Vector_3(FT(0), FT(0), FT(1));
return Vector_3(-h.b(), h.a(), FT(0));
FT a = CGAL::abs(h.a()),
b = CGAL::abs(h.b()),
c = CGAL::abs(h.c());
// to avoid badly defined vectors with coordinates all close
// to 0 when the plane is almost horizontal, we ignore the
// smallest coordinate instead of always ignoring Z
if (CGAL::possibly(a <= b && a <= c))
return Vector_3(FT(0), -h.c(), h.b());
if (CGAL::possibly(b <= a && b <= c))
return Vector_3(-h.c(), FT(0), h.a());
return Vector_3(-h.b(), h.a(), FT(0));
} else {
return cp(co(h), this->operator()(h,1));
}
@ -3051,40 +3067,87 @@ namespace CartesianKernelFunctors {
template <typename K>
class Construct_weighted_point_2
{
typedef typename K::RT RT;
typedef typename K::Point_2 Point_2;
typedef typename K::Weighted_point_2 Weighted_point_2;
typedef typename K::FT FT;
typedef typename K::Point_2 Point_2;
typedef typename K::Weighted_point_2 Weighted_point_2;
typedef typename Weighted_point_2::Rep Rep;
public:
typedef Weighted_point_2 result_type;
typedef Weighted_point_2 result_type;
Rep
operator()(Return_base_tag, const Point_2& p, const RT& w) const
operator()(Return_base_tag, Origin o) const
{ return Rep(o); }
Rep
operator()(Return_base_tag, const Point_2& p, const FT& w) const
{ return Rep(p,w); }
Rep
operator()(Return_base_tag, const RT& x, const RT& y) const
operator()(Return_base_tag, const FT& x, const FT& y) const
{ return Rep(x,y); }
Weighted_point_2
operator()(Origin o) const
{ return Weighted_point_2(o); }
Weighted_point_2
operator()(const Point_2& p, const FT& w) const
{ return Weighted_point_2(p,w); }
Weighted_point_2
operator()(const FT& x, const FT& y) const
{ return Weighted_point_2(x, y); }
Weighted_point_2
operator()(const Point_2& p) const
{ return Weighted_point_2(p,0); }
const Weighted_point_2&
operator()(const Weighted_point_2 & wp) const
{ return wp; }
};
template <typename K>
class Construct_weighted_point_3
{
typedef typename K::RT RT;
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename Weighted_point_3::Rep Rep;
public:
typedef Weighted_point_3 result_type;
typedef Weighted_point_3 result_type;
Rep
operator()(Return_base_tag, const Point_3& p, const RT& w) const
operator()(Return_base_tag, Origin o) const
{ return Rep(o); }
Rep
operator()(Return_base_tag, const Point_3& p, const FT& w) const
{ return Rep(p,w); }
Rep
operator()(Return_base_tag, const FT& x, const FT& y, const FT& z) const
{ return Rep(x,y,z); }
Weighted_point_3
operator()(Origin o) const
{ return Weighted_point_3(o); }
Weighted_point_3
operator()(const Point_3& p, const FT& w) const
{ return Rep(p,w); }
Weighted_point_3
operator()(const FT& x, const FT& y, const FT& z) const
{ return Weighted_point_3(x,y,z); }
Weighted_point_3
operator()(const Point_3& p) const
{ return Weighted_point_3(p,0); }
const Weighted_point_3&
operator()(const Weighted_point_3& wp) const
{ return wp; }
};
@ -4078,89 +4141,50 @@ namespace CartesianKernelFunctors {
}
};
template < typename K >
class Power_side_of_oriented_power_sphere_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::Oriented_side Oriented_side;
typedef Oriented_side result_type;
template < typename K >
class Power_side_of_oriented_power_circle_2
{
public:
typedef typename K::Weighted_point_2 Weighted_point_2;
typedef typename K::Oriented_side Oriented_side;
Oriented_side operator() ( const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s,
const Weighted_point_3 & t) const
{
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight(),
t.x(), t.y(), t.z(), t.weight());
}
typedef Oriented_side result_type;
Oriented_side operator() ( const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s) const
{
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight());
}
Oriented_side operator() ( const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r) const
{
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight());
}
Oriented_side operator() ( const Weighted_point_3 & p,
const Weighted_point_3 & q) const
{
return power_side_of_oriented_power_sphereC3(p.weight(),q.weight());
}
};
template < typename K >
class Power_side_of_oriented_power_circle_2
{
public:
typedef typename K::Weighted_point_2 Weighted_point_2;
typedef typename K::Oriented_side Oriented_side;
typedef Oriented_side result_type;
Oriented_side operator() ( const Weighted_point_2 & p,
const Weighted_point_2 & q,
const Weighted_point_2 & r,
const Weighted_point_2 & t) const
Oriented_side operator()(const Weighted_point_2& p,
const Weighted_point_2& q,
const Weighted_point_2& r,
const Weighted_point_2& t) const
{
//CGAL_kernel_precondition( ! collinear(p, q, r) );
return power_side_of_oriented_power_circleC2(p.x(), p.y(), p.weight(),
q.x(), q.y(), q.weight(),
r.x(), r.y(), r.weight(),
t.x(), t.y(), t.weight());
q.x(), q.y(), q.weight(),
r.x(), r.y(), r.weight(),
t.x(), t.y(), t.weight());
}
Oriented_side operator() ( const Weighted_point_2 & p,
const Weighted_point_2 & q,
const Weighted_point_2 & t) const
// The methods below are currently undocumented because the definition of
// orientation is unclear for 2 and 1 point configurations in a 2D space.
// One should be (very) careful with the order of vertices when using them,
// as swapping points will change the result and one must therefore have a
// precise idea of what is the positive orientation in the full space.
// For example, these functions are (currently) used safely in the regular
// triangulations classes because we always call them on vertices of
// triangulation cells, which are always positively oriented.
Oriented_side operator()(const Weighted_point_2& p,
const Weighted_point_2& q,
const Weighted_point_2& t) const
{
//CGAL_kernel_precondition( collinear(p, q, r) );
//CGAL_kernel_precondition( p.point() != q.point() );
return power_side_of_oriented_power_circleC2(p.point().x(), p.y(), p.weight(),
q.x(), q.y(), q.weight(),
t.x(), t.y(), t.weight());
}
q.x(), q.y(), q.weight(),
t.x(), t.y(), t.weight());
}
Oriented_side operator() ( const Weighted_point_2 & p,
const Weighted_point_2 & t) const
Oriented_side operator()(const Weighted_point_2& p,
const Weighted_point_2& t) const
{
//CGAL_kernel_precondition( p.point() == r.point() );
Comparison_result r = CGAL::compare(p.weight(), t.weight());
@ -4168,7 +4192,7 @@ public:
else if (r == SMALLER) return ON_POSITIVE_SIDE;
return ON_ORIENTED_BOUNDARY;
}
};
};
template <typename K>
class Oriented_side_2

View File

@ -418,12 +418,11 @@ scaled_distance_to_lineC2( const FT &px, const FT &py,
return determinant<FT>(px-rx, py-ry, qx-rx, qy-ry);
}
template < class RT >
void
weighted_circumcenter_translateC2(const RT &dqx, const RT &dqy, const RT &dqw,
const RT &drx, const RT &dry, const RT &drw,
RT &dcx, RT &dcy)
const RT &drx, const RT &dry, const RT &drw,
RT &dcx, RT &dcy)
{
// Given 3 points P, Q, R, this function takes as input:
// qx-px, qy-py,qw-pw, rx-px, ry-py, rw-pw. And returns cx-px, cy-py,
@ -449,33 +448,76 @@ weighted_circumcenter_translateC2(const RT &dqx, const RT &dqy, const RT &dqw,
template < class RT, class We>
void
weighted_circumcenterC2( const RT &px, const RT &py, const We &pw,
const RT &qx, const RT &qy, const We &qw,
const RT &rx, const RT &ry, const We &rw,
RT &x, RT &y )
const RT &qx, const RT &qy, const We &qw,
const RT &rx, const RT &ry, const We &rw,
RT &x, RT &y )
{
RT dqw = RT(qw-pw);
RT drw = RT(rw-pw);
weighted_circumcenter_translateC2(qx-px, qy-py, dqw,rx-px, ry-py,drw,x, y);
x += px;
y += py;
}
template< class FT >
FT
power_productC2(const FT &px, const FT &py, const FT &pw,
const FT &qx, const FT &qy, const FT &qw)
{
// computes the power product of two weighted points
FT qpx = qx - px;
FT qpy = qy - py;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy);
return qp2 - pw - qw;
}
template < class RT , class We>
void
radical_axisC2(const RT &px, const RT &py, const We &pw,
const RT &qx, const RT &qy, const We &qw,
RT &a, RT &b, RT& c )
const RT &qx, const RT &qy, const We &qw,
RT &a, RT &b, RT& c )
{
a = RT(2)*(px - qx);
b = RT(2)*(py - qy);
c = - CGAL_NTS square(px) - CGAL_NTS square(py)
+ CGAL_NTS square(qx) + CGAL_NTS square(qy)
+RT(pw) - RT(qw);
c = - CGAL_NTS square(px) - CGAL_NTS square(py)
+ CGAL_NTS square(qx) + CGAL_NTS square(qy)
+ RT(pw) - RT(qw);
}
template< class FT >
CGAL_KERNEL_MEDIUM_INLINE
FT
squared_radius_orthogonal_circleC2(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_KERNEL_MEDIUM_INLINE
FT
squared_radius_smallest_orthogonal_circleC2(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

View File

@ -1,4 +1,4 @@
// Copyright (c) 2000
// Copyright (c) 2000
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
@ -403,113 +403,109 @@ squared_areaC3(const FT &px, const FT &py, const FT &pz,
return (CGAL_NTS square(vx) + CGAL_NTS square(vy) + CGAL_NTS square(vz))/4;
}
template <class FT>
void
determinants_for_weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
FT &num_x, FT &num_y, FT &num_z, FT& den)
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
FT &num_x, FT &num_y, FT &num_z, FT& den)
{
// translate origin to p
// and compute determinants for weighted_circumcenter and
// circumradius
FT qpx = qx-px;
FT qpy = qy-py;
FT qpz = qz-pz;
FT qpx = qx - px;
FT qpy = qy - py;
FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz) - qw + pw;
FT rpx = rx-px;
FT rpy = ry-py;
FT rpz = rz-pz;
FT rpx = rx - px;
FT rpy = ry - py;
FT rpz = rz - pz;
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
CGAL_NTS square(rpz) - rw + pw;
FT spx = sx-px;
FT spy = sy-py;
FT spz = sz-pz;
FT spx = sx - px;
FT spy = sy - py;
FT spz = sz - pz;
FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) +
CGAL_NTS square(spz) - sw + pw;
num_x = determinant(qpy,qpz,qp2,
rpy,rpz,rp2,
spy,spz,sp2);
rpy,rpz,rp2,
spy,spz,sp2);
num_y = determinant(qpx,qpz,qp2,
rpx,rpz,rp2,
spx,spz,sp2);
rpx,rpz,rp2,
spx,spz,sp2);
num_z = determinant(qpx,qpy,qp2,
rpx,rpy,rp2,
spx,spy,sp2);
rpx,rpy,rp2,
spx,spy,sp2);
den = determinant(qpx,qpy,qpz,
rpx,rpy,rpz,
spx,spy,spz);
rpx,rpy,rpz,
spx,spy,spz);
}
template <class FT>
void
determinants_for_circumcenterC3(
const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz,
const FT &rx, const FT &ry, const FT &rz,
const FT &sx, const FT &sy, const FT &sz,
FT &num_x, FT &num_y, FT &num_z, FT& den)
determinants_for_circumcenterC3(const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz,
const FT &rx, const FT &ry, const FT &rz,
const FT &sx, const FT &sy, const FT &sz,
FT &num_x, FT &num_y, FT &num_z, FT& den)
{
// translate origin to p
// and compute determinants for weighted_circumcenter and
// circumradius
FT qpx = qx-px;
FT qpy = qy-py;
FT qpz = qz-pz;
FT qpx = qx - px;
FT qpy = qy - py;
FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz);
FT rpx = rx-px;
FT rpy = ry-py;
FT rpz = rz-pz;
FT rpx = rx - px;
FT rpy = ry - py;
FT rpz = rz - pz;
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
CGAL_NTS square(rpz);
FT spx = sx-px;
FT spy = sy-py;
FT spz = sz-pz;
FT spx = sx - px;
FT spy = sy - py;
FT spz = sz - pz;
FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) +
CGAL_NTS square(spz);
num_x = determinant(qpy,qpz,qp2,
rpy,rpz,rp2,
spy,spz,sp2);
rpy,rpz,rp2,
spy,spz,sp2);
num_y = determinant(qpx,qpz,qp2,
rpx,rpz,rp2,
spx,spz,sp2);
rpx,rpz,rp2,
spx,spz,sp2);
num_z = determinant(qpx,qpy,qp2,
rpx,rpy,rp2,
spx,spy,sp2);
rpx,rpy,rp2,
spx,spy,sp2);
den = determinant(qpx,qpy,qpz,
rpx,rpy,rpz,
spx,spy,spz);
rpx,rpy,rpz,
spx,spy,spz);
}
template < class FT>
void
weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
FT &x, FT &y, FT &z)
weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
FT &x, FT &y, FT &z)
{
// this function compute the weighted circumcenter point only
// this function computes the weighted circumcenter point only
// Translate p to origin and compute determinants
FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
num_x, num_y, num_z,den);
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
num_x, num_y, num_z,den);
CGAL_assertion( ! CGAL_NTS is_zero(den) );
FT inv = FT(1)/(FT(2) * den);
FT inv = FT(1)/(FT(2) * den);
x = px + num_x*inv;
y = py - num_y*inv;
@ -518,248 +514,231 @@ weighted_circumcenterC3(
template < class FT>
void
weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
FT &x, FT &y, FT &z, FT &w)
weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
FT &x, FT &y, FT &z, FT &w)
{
// this function compute the weighted circumcenter point
// this function computes the weighted circumcenter point
// and the squared weighted circumradius
// Translate p to origin and compute determinants
FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
num_x, num_y, num_z, den);
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
num_x, num_y, num_z, den);
CGAL_assertion( ! CGAL_NTS is_zero(den) );
FT inv = FT(1)/(FT(2) * den);
FT inv = FT(1)/(FT(2) * den);
x = px + num_x*inv;
y = py - num_y*inv;
z = pz + num_z*inv;
w = (CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z))
*CGAL_NTS square(inv) - pw;
w = (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z))
* CGAL_NTS square(inv) - pw;
}
template< class FT >
FT
squared_radius_orthogonal_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw)
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw)
{
// this function compute the squared weighted circumradius only
// this function computes the squared weighted circumradius only
// Translate p to origin and compute determinants
FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
num_x, num_y, num_z,den);
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
num_x, num_y, num_z,den);
CGAL_assertion( ! CGAL_NTS is_zero(den) );
FT inv = FT(1)/(FT(2) * den);
FT inv = FT(1)/(FT(2) * den);
return
(CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z))
*CGAL_NTS square(inv) - pw;
return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z))
* CGAL_NTS square(inv) - pw;
}
template <class FT>
void
determinants_for_weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
FT &num_x, FT &num_y, FT &num_z, FT &den)
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
FT &num_x, FT &num_y, FT &num_z, FT &den)
{
// translate origin to p
// and compute determinants for weighted_circumcenter and
// circumradius
// translate origin to p and compute determinants for weighted_circumcenter
// and circumradius
// Translate s to origin to simplify the expression.
FT qpx = qx-px;
FT qpy = qy-py;
FT qpz = qz-pz;
FT qpx = qx - px;
FT qpy = qy - py;
FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz) - qw + pw;
FT rpx = rx-px;
FT rpy = ry-py;
FT rpz = rz-pz;
FT rpx = rx - px;
FT rpy = ry - py;
FT rpz = rz - pz;
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
CGAL_NTS square(rpz) - rw + pw;
FT sx = qpy*rpz-qpz*rpy;
FT sy = qpz*rpx-qpx*rpz;
FT sz = qpx*rpy-qpy*rpx;
FT sx = qpy*rpz - qpz*rpy;
FT sy = qpz*rpx - qpx*rpz;
FT sz = qpx*rpy - qpy*rpx;
// The following determinants can be developped and simplified.
//
// FT num_x = determinant(qpy,qpz,qp2,
// rpy,rpz,rp2,
// sy,sz,FT(0));
// FT num_y = determinant(qpx,qpz,qp2,
// rpx,rpz,rp2,
// sx,sz,FT(0));
// FT num_z = determinant(qpx,qpy,qp2,
// rpx,rpy,rp2,
// sx,sy,FT(0));
//
// FT num_x = determinant(qpy,qpz,qp2,
// rpy,rpz,rp2,
// sy,sz,FT(0));
// FT num_y = determinant(qpx,qpz,qp2,
// rpx,rpz,rp2,
// sx,sz,FT(0));
// FT num_z = determinant(qpx,qpy,qp2,
// rpx,rpy,rp2,
// sx,sy,FT(0));
num_x = qp2 * determinant(rpy,rpz,sy,sz)
- rp2 * determinant(qpy,qpz,sy,sz);
- rp2 * determinant(qpy,qpz,sy,sz);
num_y = qp2 * determinant(rpx,rpz,sx,sz)
- rp2 * determinant(qpx,qpz,sx,sz);
- rp2 * determinant(qpx,qpz,sx,sz);
num_z = qp2 * determinant(rpx,rpy,sx,sy)
- rp2 * determinant(qpx,qpy,sx,sy);
- rp2 * determinant(qpx,qpy,sx,sy);
den = determinant(qpx,qpy,qpz,
rpx,rpy,rpz,
sx,sy,sz);
rpx,rpy,rpz,
sx,sy,sz);
}
template < class FT >
void
weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
FT &x, FT &y, FT &z)
weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
FT &x, FT &y, FT &z)
{
// this function compute the weighted circumcenter point only
// this function computes the weighted circumcenter point only
// Translate p to origin and compute determinants
// Translate p to origin and compute determinants
FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
num_x, num_y, num_z, den);
qx, qy, qz, qw,
rx, ry, rz, rw,
num_x, num_y, num_z, den);
CGAL_assertion( den != FT(0) );
FT inv = FT(1)/(FT(2) * den);
FT inv = FT(1) / (FT(2) * den);
x = px + num_x*inv;
y = py - num_y*inv;
z = pz + num_z*inv;
}
template < class FT >
void
weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
FT &x, FT &y, FT &z, FT &w)
weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
FT &x, FT &y, FT &z, FT &w)
{
// this function compute the weighted circumcenter and
// this function computes the weighted circumcenter and
// the weighted squared circumradius
// Translate p to origin and compute determinants
// Translate p to origin and compute determinants
FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
num_x, num_y, num_z, den);
qx, qy, qz, qw,
rx, ry, rz, rw,
num_x, num_y, num_z, den);
CGAL_assertion( den != FT(0) );
FT inv = FT(1)/(FT(2) * den);
FT inv = FT(1) / (FT(2) * den);
x = px + num_x*inv;
y = py - num_y*inv;
z = pz + num_z*inv;
w = (CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z))
*CGAL_NTS square(inv) - pw;
w = (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z))
*CGAL_NTS square(inv) - pw;
}
template< class FT >
CGAL_MEDIUM_INLINE
FT
squared_radius_smallest_orthogonal_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
{
// this function compute the weighted squared circumradius only
// this function computes the weighted squared circumradius only
// Translate p to origin and compute determinants
// Translate p to origin and compute determinants
FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
num_x, num_y, num_z, den);
qx, qy, qz, qw,
rx, ry, rz, rw,
num_x, num_y, num_z, den);
CGAL_assertion( den != FT(0) );
FT inv = FT(1)/(FT(2) * den);
return
(CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z))
*CGAL_NTS square(inv) - pw;
return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z))
* CGAL_NTS square(inv) - pw;
}
template < class FT >
void
weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
FT &x, FT &y, FT &z)
weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
FT &x, FT &y, FT &z)
{
// this function compute the weighted circumcenter point only
FT qpx = qx-px;
FT qpy = qy-py;
FT qpz = qz-pz;
// this function computes the weighted circumcenter point only
FT qpx = qx - px;
FT qpy = qy - py;
FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz);
FT inv = FT(1)/(FT(2)*qp2);
FT alpha = 1/FT(2) + (pw-qw)*inv;
FT inv = FT(1) / (FT(2) * qp2);
FT alpha = 1 / FT(2) + (pw-qw) * inv;
x = px + alpha * qpx;
y = py + alpha * qpy;
z = pz + alpha * qpz;
}
template < class FT >
void
weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
FT &x, FT &y, FT &z, FT &w)
weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
FT &x, FT &y, FT &z, FT &w)
{
// this function compute the weighted circumcenter point and
// this function computes the weighted circumcenter point and
// the weighted circumradius
FT qpx = qx-px;
FT qpy = qy-py;
FT qpz = qz-pz;
FT qpx = qx - px;
FT qpy = qy - py;
FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz);
FT inv = FT(1)/(FT(2)*qp2);
FT alpha = 1/FT(2) + (pw-qw)*inv;
FT inv = FT(1) / (FT(2) * qp2);
FT alpha = 1 / FT(2) + (pw-qw) * inv;
x = px + alpha * qpx;
y = py + alpha * qpy;
z = pz + alpha * qpz;
w = CGAL_NTS square(alpha)*qp2 - pw;
w = CGAL_NTS square(alpha) * qp2 - pw;
}
template< class FT >
CGAL_MEDIUM_INLINE
FT
@ -767,30 +746,27 @@ squared_radius_smallest_orthogonal_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw)
{
// this function computes
// the weighted circumradius only
FT qpx = qx-px;
FT qpy = qy-py;
FT qpz = qz-pz;
// this function computes the weighted circumradius only
FT qpx = qx - px;
FT qpy = qy - py;
FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz);
FT inv = FT(1)/(FT(2)*qp2);
FT alpha = 1/FT(2) + (pw-qw)*inv;
FT inv = FT(1) / (FT(2) * qp2);
FT alpha = 1 / FT(2) + (pw-qw) * inv;
return CGAL_NTS square(alpha)*qp2 - pw;
}
template< class FT >
FT
power_productC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw)
power_productC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw)
{
// computes the power product of two weighted points
FT qpx = qx-px;
FT qpy = qy-py;
FT qpz = qz-pz;
FT qpx = qx - px;
FT qpy = qy - py;
FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz);
return qp2 - pw - qw ;
@ -799,17 +775,17 @@ power_productC3(
template < class RT , class We>
void
radical_axisC3(const RT &px, const RT &py, const RT &pz, const We & /* pw */,
const RT &qx, const RT &qy, const RT &qz, const We & /* qw */,
const RT &rx, const RT &ry, const RT &rz, const We & /* rw */,
RT &a, RT &b, RT& c )
const RT &qx, const RT &qy, const RT &qz, const We & /* qw */,
const RT &rx, const RT &ry, const RT &rz, const We & /* rw */,
RT &a, RT &b, RT& c )
{
RT dqx=qx-px, dqy=qy-py, dqz=qz-pz, drx=rx-px, dry=ry-py, drz=rz-pz;
//il manque des tests...
a= RT(1)*determinant(dqy, dqz, dry, drz);
b= - RT(1)*determinant(dqx, dqz, drx, drz);
c= RT(1)*determinant(dqx, dqy, drx, dry);
a = RT(1)*determinant(dqy, dqz, dry, drz);
b = - RT(1)*determinant(dqx, dqz, drx, drz);
c = RT(1)*determinant(dqx, dqy, drx, dry);
}
// function used in critical_squared_radiusC3
@ -817,77 +793,69 @@ radical_axisC3(const RT &px, const RT &py, const RT &pz, const We & /* pw */,
// circle orthogonal (p,pw), (q,qw), (r,rw), (s,sw)
template < class FT>
FT
power_to_orthogonal_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
const FT &tx, const FT &ty, const FT &tz, const FT &tw)
power_to_orthogonal_sphereC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
const FT &tx, const FT &ty, const FT &tz, const FT &tw)
{
//to get the value of the determinant
// We translate the points so that t becomes the origin.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = pz - tz;
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
CGAL_NTS square(dpz) - pw + tw ;
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = qz - tz;
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
CGAL_NTS square(dqz) - qw + tw;
FT drx = rx - tx;
FT dry = ry - ty;
FT drz = rz - tz;
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
CGAL_NTS square(drz) - rw + tw;
FT dsx = sx - tx;
FT dsy = sy - ty;
FT dsz = sz - tz;
FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) +
CGAL_NTS square(dsz) - sw + tw;
return determinant(dpx, dpy, dpz, dpt,
dqx, dqy, dqz, dqt,
drx, dry, drz, drt,
dsx, dsy, dsz, dst);
//to get the value of the determinant
// We translate the points so that t becomes the origin.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = pz - tz;
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
CGAL_NTS square(dpz) - pw + tw ;
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = qz - tz;
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
CGAL_NTS square(dqz) - qw + tw;
FT drx = rx - tx;
FT dry = ry - ty;
FT drz = rz - tz;
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
CGAL_NTS square(drz) - rw + tw;
FT dsx = sx - tx;
FT dsy = sy - ty;
FT dsz = sz - tz;
FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) +
CGAL_NTS square(dsz) - sw + tw;
return determinant(dpx, dpy, dpz, dpt,
dqx, dqy, dqz, dqt,
drx, dry, drz, drt,
dsx, dsy, dsz, dst);
}
// compute the critical weight tw
// where weighted point t is orthogonal to weighted points p, q,r,s
template < class FT>
FT
power_distance_to_power_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
const FT &tx, const FT &ty, const FT &tz, const FT & )
power_distance_to_power_sphereC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw,
const FT &tx, const FT &ty, const FT &tz, const FT & )
{
// the 5x5 det is a linear function of tw ff(tw)= ff(0) + tw ff(1)
// the critical value for tw is - ff(0)/( ff(1) - ff(0))
FT ff0 = power_to_orthogonal_sphereC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
tx, ty, tz, FT(0));
FT ff0 = power_to_orthogonal_sphereC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
tx, ty, tz, FT(0));
FT ff1 = power_to_orthogonal_sphereC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
tx, ty, tz, FT(1));
FT ff1 = power_to_orthogonal_sphereC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
tx, ty, tz, FT(1));
return -ff0/(ff1 - ff0);
return -ff0/(ff1 - ff0);
}
// I will use this to test if the radial axis of three spheres
// intersect the triangle formed by the centers.
// // resolution of the system (where we note c the center)
@ -913,9 +881,7 @@ power_distance_to_power_sphereC3(
// FT Mu = (dqq*dp-dpp*dpdq)/denom;
// return (CGAL_NTS square(Lambda)*dp+CGAL_NTS square(Mu)*dq
// +FT2*Lambda*Mu*dpdq - rw);
// + FT2*Lambda*Mu*dpdq - rw);
} //namespace CGAL

View File

@ -635,12 +635,11 @@ side_of_oriented_lineC2(const FT &a, const FT &b, const FT &c,
return CGAL_NTS sign(a*x+b*y+c);
}
template <class FT>
Comparison_result
compare_power_distanceC2(const FT& px, const FT& py, const FT& pwt,
const FT& qx, const FT& qy, const FT& qwt,
const FT& rx, const FT& ry)
const FT& qx, const FT& qy, const FT& qwt,
const FT& rx, const FT& ry)
{
// returns SMALLER if r is closer to p w.r.t. the power metric
FT d1 = CGAL_NTS square(rx - px) + CGAL_NTS square(ry - py) - pwt;
@ -648,58 +647,73 @@ compare_power_distanceC2(const FT& px, const FT& py, const FT& pwt,
return CGAL_NTS compare(d1, d2);
}
template <class FT>
CGAL_KERNEL_MEDIUM_INLINE
Bounded_side
power_side_of_bounded_power_circleC2(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 enum_cast<Bounded_side>
(CGAL_NTS sign(-(CGAL_NTS square(dtx) + CGAL_NTS square(dty)-tw+qw)*dpz
+(dpz-pw+qw)*(dpx*dtx+dpy*dty)));
}
template <class FT>
Oriented_side
power_side_of_oriented_power_circleC2( const FT &px, const FT &py, const FT &pwt,
const FT &qx, const FT &qy, const FT &qwt,
const FT &rx, const FT &ry, const FT &rwt,
const FT &tx, const FT &ty, const FT &twt)
power_side_of_oriented_power_circleC2(const FT &px, const FT &py, const FT &pwt,
const FT &qx, const FT &qy, const FT &qwt,
const FT &rx, const FT &ry, const FT &rwt,
const FT &tx, const FT &ty, const FT &twt)
{
// Note: maybe this can be further optimized like the usual in_circle() ?
// Note: maybe this can be further optimized like the usual in_circle() ?
// We translate the 4 points so that T becomes the origin.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) - pwt + twt;
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) - qwt + twt;
FT drx = rx - tx;
FT dry = ry - ty;
FT drz = CGAL_NTS square(drx) + CGAL_NTS square(dry) - rwt + twt;
// We translate the 4 points so that T becomes the origin.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) - pwt + twt;
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) - qwt + twt;
FT drx = rx - tx;
FT dry = ry - ty;
FT drz = CGAL_NTS square(drx) + CGAL_NTS square(dry) - rwt + twt;
return sign_of_determinant(dpx, dpy, dpz,
dqx, dqy, dqz,
drx, dry, drz);
return sign_of_determinant(dpx, dpy, dpz,
dqx, dqy, dqz,
drx, dry, drz);
}
template <class FT>
Oriented_side
power_side_of_oriented_power_circleC2( const FT &px, const FT &py, const FT &pwt,
const FT &qx, const FT &qy, const FT &qwt,
const FT &tx, const FT &ty, const FT &twt)
power_side_of_oriented_power_circleC2(const FT &px, const FT &py, const FT &pwt,
const FT &qx, const FT &qy, const FT &qwt,
const FT &tx, const FT &ty, const FT &twt)
{
// Same translation as above.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) - pwt + twt;
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) - qwt + twt;
// Same translation as above.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) - pwt + twt;
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) - qwt + twt;
// We do an orthogonal projection on the (x) axis, if possible.
Comparison_result cmpx = CGAL_NTS compare(px, qx);
if (cmpx != EQUAL)
return cmpx * sign_of_determinant(dpx, dpz, dqx, dqz);
// We do an orthogonal projection on the (x) axis, if possible.
Comparison_result cmpx = CGAL_NTS compare(px, qx);
if (cmpx != EQUAL)
return cmpx * sign_of_determinant(dpx, dpz, dqx, dqz);
// If not possible, then on the (y) axis.
Comparison_result cmpy = CGAL_NTS compare(py, qy);
return cmpy * sign_of_determinant(dpy, dpz, dqy, dqz);
// If not possible, then on the (y) axis.
Comparison_result cmpy = CGAL_NTS compare(py, qy);
return cmpy * sign_of_determinant(dpy, dpz, dqy, dqz);
}
} //namespace CGAL
#endif // CGAL_PREDICATES_KERNEL_FTC2_H

View File

@ -561,98 +561,99 @@ has_smaller_signed_dist_to_planeC3(
template <class FT>
CGAL_KERNEL_MEDIUM_INLINE
typename Same_uncertainty_nt<Oriented_side, FT>::type
power_side_of_oriented_power_sphereC3( const FT &px, const FT &py, const FT &pz, const FT &pwt,
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
const FT &rx, const FT &ry, const FT &rz, const FT &rwt,
const FT &sx, const FT &sy, const FT &sz, const FT &swt,
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
power_side_of_oriented_power_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pwt,
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
const FT &rx, const FT &ry, const FT &rz, const FT &rwt,
const FT &sx, const FT &sy, const FT &sz, const FT &swt,
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
{
// We translate the points so that T becomes the origin.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = pz - tz;
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
CGAL_NTS square(dpz) + (twt - pwt);
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = qz - tz;
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
CGAL_NTS square(dqz) + (twt - qwt);
FT drx = rx - tx;
FT dry = ry - ty;
FT drz = rz - tz;
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
CGAL_NTS square(drz) + (twt - rwt);
FT dsx = sx - tx;
FT dsy = sy - ty;
FT dsz = sz - tz;
FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) +
CGAL_NTS square(dsz) + (twt - swt);
// We translate the points so that T becomes the origin.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = pz - tz;
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
CGAL_NTS square(dpz) + (twt - pwt);
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = qz - tz;
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
CGAL_NTS square(dqz) + (twt - qwt);
FT drx = rx - tx;
FT dry = ry - ty;
FT drz = rz - tz;
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
CGAL_NTS square(drz) + (twt - rwt);
FT dsx = sx - tx;
FT dsy = sy - ty;
FT dsz = sz - tz;
FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) +
CGAL_NTS square(dsz) + (twt - swt);
return - sign_of_determinant(dpx, dpy, dpz, dpt,
dqx, dqy, dqz, dqt,
drx, dry, drz, drt,
dsx, dsy, dsz, dst);
return - sign_of_determinant(dpx, dpy, dpz, dpt,
dqx, dqy, dqz, dqt,
drx, dry, drz, drt,
dsx, dsy, dsz, dst);
}
template <class FT>
CGAL_KERNEL_MEDIUM_INLINE
typename Same_uncertainty_nt<Oriented_side, FT>::type
power_side_of_oriented_power_sphereC3(const FT &px, const FT &py, const FT &pz, const FT &pwt,
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
const FT &rx, const FT &ry, const FT &rz, const FT &rwt,
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
power_side_of_oriented_power_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pwt,
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
const FT &rx, const FT &ry, const FT &rz, const FT &rwt,
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
{
// Same translation as above.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = pz - tz;
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
CGAL_NTS square(dpz) + (twt - pwt);
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = qz - tz;
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
CGAL_NTS square(dqz) + (twt - qwt);
FT drx = rx - tx;
FT dry = ry - ty;
FT drz = rz - tz;
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
CGAL_NTS square(drz) + (twt - rwt);
Sign cmp;
// Same translation as above.
FT dpx = px - tx;
FT dpy = py - ty;
FT dpz = pz - tz;
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
CGAL_NTS square(dpz) + (twt - pwt);
FT dqx = qx - tx;
FT dqy = qy - ty;
FT dqz = qz - tz;
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
CGAL_NTS square(dqz) + (twt - qwt);
FT drx = rx - tx;
FT dry = ry - ty;
FT drz = rz - tz;
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
CGAL_NTS square(drz) + (twt - rwt);
Sign cmp;
// Projection on the (xy) plane.
cmp = sign_of_determinant(dpx, dpy, dpt,
dqx, dqy, dqt,
drx, dry, drt);
if (cmp != ZERO)
return cmp * sign_of_determinant(px-rx, py-ry,
qx-rx, qy-ry);
// Projection on the (xy) plane.
cmp = sign_of_determinant(dpx, dpy, dpt,
dqx, dqy, dqt,
drx, dry, drt);
if (cmp != ZERO)
return cmp * sign_of_determinant(px-rx, py-ry,
qx-rx, qy-ry);
// Projection on the (xz) plane.
cmp = sign_of_determinant(dpx, dpz, dpt,
dqx, dqz, dqt,
drx, drz, drt);
if (cmp != ZERO)
return cmp * sign_of_determinant(px-rx, pz-rz,
qx-rx, qz-rz);
// Projection on the (xz) plane.
cmp = sign_of_determinant(dpx, dpz, dpt,
dqx, dqz, dqt,
drx, drz, drt);
if (cmp != ZERO)
return cmp * sign_of_determinant(px-rx, pz-rz,
qx-rx, qz-rz);
// Projection on the (yz) plane.
cmp = sign_of_determinant(dpy, dpz, dpt,
dqy, dqz, dqt,
dry, drz, drt);
return cmp * sign_of_determinant(py-ry, pz-rz,
qy-ry, qz-rz);
// Projection on the (yz) plane.
cmp = sign_of_determinant(dpy, dpz, dpt,
dqy, dqz, dqt,
dry, drz, drt);
return cmp * sign_of_determinant(py-ry, pz-rz,
qy-ry, qz-rz);
}
template <class FT>
CGAL_KERNEL_MEDIUM_INLINE
typename Same_uncertainty_nt<Oriented_side, FT>::type
power_side_of_oriented_power_sphereC3(const FT &px, const FT &py, const FT &pz, const FT &pwt,
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
power_side_of_oriented_power_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pwt,
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
{
// Same translation as above.
FT dpx = px - tx;
@ -687,28 +688,25 @@ CGAL_KERNEL_MEDIUM_INLINE
typename Same_uncertainty_nt<Oriented_side, FT>::type
power_side_of_oriented_power_sphereC3(const FT &pwt, const FT &qwt)
{
return CGAL_NTS compare(qwt, pwt);
return CGAL_NTS compare(qwt, pwt);
}
template < class FT >
Comparison_result
compare_power_distanceC3(
const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
compare_power_distanceC3(const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
{
FT dqx = qx - px;
FT dqy = qy - py;
FT dqz = qz - pz;
FT drx = rx - px;
FT dry = ry - py;
FT drz = rz - pz;
return CGAL_NTS compare(dqx*dqx + dqy*dqy + dqz*dqz - qw,
drx*drx + dry*dry + drz*drz - rw);
FT dqx = qx - px;
FT dqy = qy - py;
FT dqz = qz - pz;
FT drx = rx - px;
FT dry = ry - py;
FT drz = rz - pz;
return CGAL_NTS compare(dqx*dqx + dqy*dqy + dqz*dqz - qw,
drx*drx + dry*dry + drz*drz - rw);
}
//return the sign of the power test of weighted point (sx,sy,sz,sw)
//with respect to the smallest sphere orthogonal to
//p,q,r
@ -716,12 +714,12 @@ template< class FT >
CGAL_KERNEL_MEDIUM_INLINE
typename Same_uncertainty_nt<Bounded_side, FT>::type
power_side_of_bounded_power_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw)
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw)
{
// Translate p to origin and compute determinants
// Translate p to origin and compute determinants
FT qpx = qx-px;
FT qpy = qy-py;
FT qpz = qz-pz;
@ -738,11 +736,11 @@ power_side_of_bounded_power_sphereC3(
FT rpw = rr - rw + pw ;
FT den = determinant(qq,qr,
qr,rr);
qr,rr);
FT detq = determinant(qpw,qr,
rpw,rr);
rpw,rr);
FT detr = determinant(qq,qpw,
qr,rpw);
qr,rpw);
// Smallest smallest orthogonal sphere center
// c = detq/2*den q + detr/2*den r (origin at p)
@ -751,26 +749,25 @@ power_side_of_bounded_power_sphereC3(
FT spx = sx-px;
FT spy = sy-py;
FT spz = sz-pz;
FT ss = CGAL_NTS square(spx) + CGAL_NTS square(spy) + CGAL_NTS square(spz);
FT ss = CGAL_NTS square(spx) + CGAL_NTS square(spy) + CGAL_NTS square(spz);
FT sq = spx*qpx + spy*qpy + spz*qpz;
FT sr = spx*rpx + spy*rpy + spz*rpz;
CGAL_assertion( ! CGAL_NTS is_zero(den) );
// return - sign of (c- s)^2 - (c^2 - pw) - sw note that den >= 0 -
return enum_cast<Bounded_side>(
- CGAL_NTS sign( den*(ss - sw + pw)- detq*sq - detr*sr));
- CGAL_NTS sign( den*(ss - sw + pw)- detq*sq - detr*sr));
}
// return the sign of the power test of weighted point (rx,ry,rz,rw)
// with respect to the smallest sphere orthogoanal to
// p,q
template< class FT >
typename Same_uncertainty_nt<Bounded_side, FT>::type
power_side_of_bounded_power_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
{
FT FT2(2);
FT FT4(4);
@ -789,9 +786,6 @@ power_side_of_bounded_power_sphereC3(
- CGAL_NTS sign (dr2 - dp2/FT4 + dpr*dpw/dp2 - drw ));
}
} //namespace CGAL
} // namespace CGAL
#endif // CGAL_PREDICATES_KERNEL_FTC3_H

View File

@ -832,7 +832,7 @@ void _test_intersection_Line_arc_Circular_arc(CK ck)
do{
p_random4 = Point_2(theRandom.get_int(random_min, random_max),
theRandom.get_int(random_min, random_max));
}while(p_random4 == center_circle_random1);
} while (p_random4 == center_circle_random1 || (p_random3 == p_random4));
std::vector< CGAL::Object >
vector_for_intersection_random3;

View File

@ -1,6 +1,9 @@
project (Circular_kernel_3_Demo)
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()

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