Fix conflict

This commit is contained in:
Maxime Gimeno 2019-01-11 09:47:34 +01:00
commit 2a49dfcb05
590 changed files with 8744 additions and 6256 deletions

View File

@ -17,7 +17,7 @@ if(POLICY CMP0071)
endif()
# Include this package's headers first
include_directories( BEFORE ./ ./include ../../include )
include_directories( BEFORE ./ ./include )
# Find CGAL and CGAL Qt5
find_package(CGAL COMPONENTS Qt5)
@ -25,9 +25,6 @@ find_package(CGAL COMPONENTS Qt5)
# Find Qt5 itself
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg)
include( ${CGAL_USE_FILE} )
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
qt5_wrap_ui( UI_FILES MainWindow.ui )

View File

@ -1297,7 +1297,7 @@ void Scene::refine_loop()
return;
}
std::cout << "Loop subdivision...";
CGAL::Subdivision_method_3::Loop_subdivision(*m_pPolyhedron, 1);
CGAL::Subdivision_method_3::Loop_subdivision(*m_pPolyhedron);
std::cout << "done (" << m_pPolyhedron->size_of_facets() << " facets)" << std::endl;
clear_internal_data();

View File

@ -1,5 +1,5 @@
#include <iostream>
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>

View File

@ -4,18 +4,12 @@
project( AABB_tree_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})

View File

@ -160,11 +160,12 @@ namespace CGAL {
/// is made using the internally stored traits.
/// For compilers that do not support variadic templates,
/// overloads up to 5 template arguments are provided.
#if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
template<typename ... T>
void build(T&& ...);
#ifndef DOXYGEN_RUNNING
void build();
#endif
#else
void build();
template<typename T1>

View File

@ -31,10 +31,18 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/variant/apply_visitor.hpp>
#if BOOST_VERSION >= 105000
#include <boost/heap/priority_queue.hpp>
# if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable: 4996)
# endif
# include <boost/heap/priority_queue.hpp>
# if defined(BOOST_MSVC)
# pragma warning(pop)
# endif
#else
#include <queue>
# include <queue>
#endif
#include <CGAL/assertions.h>
namespace CGAL {

View File

@ -4,17 +4,13 @@
project( AABB_tree_Tests )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include( ${CGAL_USE_FILE} ) # Kept to test the old behaviour.
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

View File

@ -4,22 +4,16 @@
project( Advancing_front_surface_reconstruction_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
if (MSVC AND ( CMAKE_SIZEOF_VOID_P EQUAL 4 ) )
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244")
endif()
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})

View File

@ -389,10 +389,10 @@ namespace CGAL {
Intern_successors_type* new_border()
{
nbe_pool.push_back(Next_border_elt());
nbe_pool.resize(nbe_pool.size()+1);
Next_border_elt* p1 = & nbe_pool.back();
nbe_pool.push_back(Next_border_elt());
nbe_pool.resize(nbe_pool.size()+1);
Next_border_elt* p2 = & nbe_pool.back();
Intern_successors_type ist(p1,p2);

View File

@ -4,18 +4,12 @@
project( Advancing_front_surface_reconstruction_Tests )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})

View File

@ -4,18 +4,12 @@
project( Algebraic_foundations_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})

View File

@ -4,17 +4,13 @@
project( Algebraic_foundations_Tests )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET COMPONENTS Core)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include(${CGAL_USE_FILE})
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

View File

@ -325,27 +325,27 @@ efficiency.
The following example illustrates the construction of `AlgebraicKernel_d_1::Algebraic_real_1`
using `AlgebraicKernel_d_1::Construct_algebraic_real_1`:
<SMALL>\cgalExample{Algebraic_kernel_d/Construct_algebraic_real_1.cpp}</SMALL>
\cgalExample{Algebraic_kernel_d/Construct_algebraic_real_1.cpp}
\subsection CGALAK1Solving Solving Univariate Polynomials
The following example illustrates the construction of `AlgebraicKernel_d_1::Algebraic_real_1`
using `AlgebraicKernel_d_1::Solve_1`: <SMALL>\cgalExample{Algebraic_kernel_d/Solve_1.cpp} </SMALL>
using `AlgebraicKernel_d_1::Solve_1`: \cgalExample{Algebraic_kernel_d/Solve_1.cpp}
\subsection CGALAK1EGCompare_1 Comparison and Approximation of Algebraic Real Numbers
The following example illustrates the comparison of `AlgebraicKernel_d_1::Algebraic_real_1` numbers:
<SMALL>\cgalExample{Algebraic_kernel_d/Compare_1.cpp}</SMALL>
\cgalExample{Algebraic_kernel_d/Compare_1.cpp}
\subsection CGALAK1EGIsolate_1 Isolation of Algebraic Real Numbers with respect to roots of other polynomials
The following example illustrates the isolation of `AlgebraicKernel_d_1::Algebraic_real_1` numbers:
<SMALL>\cgalExample{Algebraic_kernel_d/Isolate_1.cpp}</SMALL>
\cgalExample{Algebraic_kernel_d/Isolate_1.cpp}
\subsection CGALAK1EGSign_at_1 Interplay with Polynomials
The following example illustrates the sign evaluation of `AlgebraicKernel_d_1::Algebraic_real_1` numbers in polynomials:
<SMALL>\cgalExample{Algebraic_kernel_d/Sign_at_1.cpp}</SMALL>
\cgalExample{Algebraic_kernel_d/Sign_at_1.cpp}
\section Algebraic_kernel_dDesign Design and Implementation History

View File

@ -6,14 +6,13 @@ cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET COMPONENTS Core)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
find_package(MPFI QUIET)
endif()
if( CGAL_FOUND AND MPFI_FOUND)
include( ${CGAL_USE_FILE} )
include( ${MPFI_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include( CGAL_VersionUtils )
create_single_source_cgal_program( "Compare_1.cpp" )

View File

@ -1524,17 +1524,11 @@ compute_intermediate_values_and_slices() const {
#if CGAL_ACK_DEBUG_FLAG
CGAL_ACK_DEBUG_PRINT << "Prepare intermediate slices.." << std::flush;
#endif
std::size_t size = event_x_coordinates().size()+1;
this->ptr()->intermediate_values=std::vector<Lazy_bound>();
this->ptr()->intermediate_slices=std::vector<Lazy_status_line_CPA_1>();
for(size_type i=0;
i<=static_cast<size_type>(event_x_coordinates().size());
i++) {
this->ptr()->intermediate_values.get().push_back(Lazy_bound());
this->ptr()->intermediate_slices.get().push_back
(Lazy_status_line_CPA_1());
}
this->ptr()->intermediate_values.get().resize(size);
this->ptr()->intermediate_slices.get().resize(size);
#if CGAL_ACK_DEBUG_FLAG
CGAL_ACK_DEBUG_PRINT << "done" << std::endl;
#endif

View File

@ -13,9 +13,6 @@ if ( NOT CGAL_FOUND )
endif()
# include helper file
include( ${CGAL_USE_FILE} )
find_package(RS3 QUIET)
if(MPFI_FOUND)
@ -25,8 +22,6 @@ if(RS3_FOUND)
include( ${RS3_USE_FILE} )
endif()
include( CGAL_CreateSingleSourceCGALProgram )
# Boost and its components
find_package( Boost )
@ -41,14 +36,11 @@ endif()
# include for local directory
include_directories( BEFORE include )
# include for local package
include_directories( BEFORE ../../include )
include( ${CGAL_USE_FILE} )
# Creating entries for all .cpp/.C files with "main" routine
# ##########################################################
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "cyclic.cpp" )
create_single_source_cgal_program( "Algebraic_curve_kernel_2.cpp" )
create_single_source_cgal_program( "algebraic_curve_kernel_2_tools.cpp" )

View File

@ -4,19 +4,13 @@
project( Algebraic_kernel_for_circles_Tests )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include_directories (BEFORE "include")
include_directories (BEFORE "include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

View File

@ -4,19 +4,13 @@
project( Algebraic_kernel_for_spheres_Tests )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include_directories (BEFORE "include")
include_directories (BEFORE "include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

View File

@ -108,6 +108,10 @@ resorting to exact arithmetic). Access to the interval containing the exact valu
with `Protected=true`. Access to the exact value is provided through the function
`FT::Exact_nt exact() const` where `FT::Exact_nt` depends on the configuration of %CGAL
(it is `Gmpq` if `gmp` is available and `Quotient<CGAL::MP_Float>` otherwise).
An overload for the function `double to_double(FT)` is also available. Its
precision is controlled through `FT::set_relative_precision_of_to_double()` in
exactly the same way as with `Lazy_exact_nt<NT>`, so a call to `to_double` may
trigger an exact evaluation.
It must be noted that an object of type `FT` is valid as long as the alpha shapes class that creates
it is valid and has not been modified.
For convenience, classical comparison operators are provided for the type `FT`.

View File

@ -4,18 +4,12 @@
project( Alpha_shapes_2_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})

View File

@ -186,7 +186,25 @@ class Lazy_alpha_nt_2
const Data_vector& data() const{ return input_points;}
Data_vector& data(){ return input_points;}
static double & relative_precision_of_to_double_internal()
{
CGAL_STATIC_THREAD_LOCAL_VARIABLE(double, relative_precision_of_to_double, 0.00001);
return relative_precision_of_to_double;
}
public:
static const double & get_relative_precision_of_to_double()
{
return relative_precision_of_to_double_internal();
}
static void set_relative_precision_of_to_double(double d)
{
CGAL_assertion((0 < d) & (d < 1));
relative_precision_of_to_double_internal() = d;
}
typedef NT_exact Exact_nt;
typedef NT_approx Approximate_nt;
@ -449,7 +467,17 @@ struct Alpha_nt_selector_2
template<class Input_traits, bool mode, class Weighted_tag>
double to_double(const internal::Lazy_alpha_nt_2<Input_traits, mode, Weighted_tag>& a)
{
return to_double(a.approx());
double r;
if (fit_in_double(a.approx(), r))
return r;
// If it isn't precise enough,
// we trigger the exact computation first,
// which will refine the approximation.
if (!has_smaller_relative_precision(a.approx(), a.get_relative_precision_of_to_double()))
a.exact();
return CGAL_NTS to_double(a.approx());
}
} // namespace CGAL

View File

@ -4,18 +4,12 @@
project( Alpha_shapes_2_Tests )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})

View File

@ -17,7 +17,6 @@ if(POLICY CMP0071)
endif()
find_package(CGAL COMPONENTS Qt5)
include(${CGAL_USE_FILE})
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
@ -26,7 +25,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
# include(${QT_USE_FILE})
include_directories (BEFORE ../../include ./ )
include_directories (BEFORE ./ )
# ui file, created wih Qt Designer
qt5_wrap_ui( uis MainWindow.ui )

View File

@ -104,8 +104,11 @@ resorting to exact arithmetic). Access to the interval containing the exact valu
`FT::Approximate_nt approx() const` where `FT::Approximate_nt` is `Interval_nt<Protected>`
with `Protected=true`. Access to the exact value is provided through the function
`FT::Exact_nt exact() const` where `FT::Exact_nt` depends on the configuration of %CGAL
(it is `Gmpq` if `gmp` is available and `Quotient<CGAL::MP_Float>` otherwise).
An overload for the function `double to_double(FT)` is also available.
(it may be `mpq_class`, `Gmpq`, `Quotient<CGAL::MP_Float>`, etc).
An overload for the function `double to_double(FT)` is also available. Its
precision is controlled through `FT::set_relative_precision_of_to_double()` in
exactly the same way as with `Lazy_exact_nt<NT>`, so a call to `to_double` may
trigger an exact evaluation.
It must be noted that an object of type `FT` is valid as long as the alpha shapes class that creates
it is valid and has not been modified.
For convenience, classical comparison operators are provided for the type `FT`.

View File

@ -4,18 +4,12 @@
project( Alpha_shapes_3_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})

View File

@ -177,8 +177,25 @@ class Lazy_alpha_nt_3{
const Data_vector& data() const{ return input_points;}
Data_vector& data(){ return input_points;}
static double & relative_precision_of_to_double_internal()
{
CGAL_STATIC_THREAD_LOCAL_VARIABLE(double, relative_precision_of_to_double, 0.00001);
return relative_precision_of_to_double;
}
public:
static const double & get_relative_precision_of_to_double()
{
return relative_precision_of_to_double_internal();
}
static void set_relative_precision_of_to_double(double d)
{
CGAL_assertion((0 < d) & (d < 1));
relative_precision_of_to_double_internal() = d;
}
typedef NT_exact Exact_nt;
typedef NT_approx Approximate_nt;
@ -419,7 +436,17 @@ struct Alpha_nt_selector_3
template<class Input_traits, bool mode, class Weighted_tag>
double to_double(const internal::Lazy_alpha_nt_3<Input_traits, mode, Weighted_tag>& a)
{
return to_double(a.approx());
double r;
if (fit_in_double(a.approx(), r))
return r;
// If it isn't precise enough,
// we trigger the exact computation first,
// which will refine the approximation.
if (!has_smaller_relative_precision(a.approx(), a.get_relative_precision_of_to_double()))
a.exact();
return CGAL_NTS to_double(a.approx());
}
} //namespace CGAL

View File

@ -4,19 +4,13 @@
project( Alpha_shapes_3_Tests )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include_directories (BEFORE "include")
include_directories (BEFORE "include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

View File

@ -4,17 +4,13 @@
project( Apollonius_graph_2_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET COMPONENTS Core )
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include(${CGAL_USE_FILE})
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

View File

@ -4,19 +4,13 @@
project( Apollonius_graph_2_Tests )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include_directories (BEFORE "include")
include_directories (BEFORE "include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

View File

@ -4,31 +4,25 @@
project( Arithmetic_kernel_Tests )
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET COMPONENTS Core)
if ( CGAL_FOUND)
include( ${CGAL_USE_FILE} )
endif()
find_package(GMP QUIET)
if ( CGAL_FOUND AND GMP_FOUND )
include(${CGAL_USE_FILE})
include( CGAL_VersionUtils )
get_dependency_version( GMP )
IS_VERSION_LESS("${GMP_VERSION}" "4.2.0" _IS_GMP_VERSION_TO_LOW)
include_directories(../../include)
include_directories(include)
include( CGAL_CreateSingleSourceCGALProgram )
find_package( MPFI )
if( MPFI_FOUND )

View File

@ -8,16 +8,19 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053)
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
find_package(CGAL COMPONENTS Core Qt5 )
include( ${CGAL_USE_FILE} )
find_package( Qt5 QUIET COMPONENTS Gui Widgets)
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND CGAL_Core_FOUND)
include(${CGAL_USE_FILE})
include_directories( ./ )
# Arrangement package includes
include_directories( BEFORE ../../include )
add_definitions(-DQT_NO_KEYWORDS)
qt5_wrap_ui( arrangement_2_uis

View File

@ -2209,10 +2209,10 @@ representing line segments.
A polyline can be constructed given one of the following inputs:
- <b>A range of \a points</b>, where two succeeding points in the
- <b>A range of <em>points</em></b>, where two succeeding points in the
range represent the endpoints of a segment of the polyline.
- <b>A range of \a segments</b>. Note that , if the types
- <b>A range of <em>segments</em></b>. Note that , if the types
`SubcurveTraits_2::Curve_2` and `SubcurveTraits_2::X_monotone_curve_2` are
not the same, then when `Make_x_monotone_2` is invoked the segments
that compose the polyline will be broken into \f$x\f$-monotone
@ -2681,7 +2681,7 @@ manner whenever possible. Thus, it resorts to exact computations only when
the approximate computation fails to produce an unambiguous result.
Note that most arrangement vertices are therefore associated with approximated
points. You cannot access the coordinates of such points and obtain them as
algebraic numbers, and only access to the approximate coordinates in possible.
algebraic numbers, and only access to the approximate coordinates is possible.
See the Reference Manual for the exact interface of the `Point_2`,
`Curve_2` and `X_monotone_curve_2` defined by the traits class.

View File

@ -167,7 +167,7 @@ virtual void before_detach ();
issued immediately after the observer has been detached from its
arrangement instance.
*/
virtual void after_attach ();
virtual void after_detach ();
/// @}

View File

@ -4,17 +4,13 @@
project( Arrangement_on_surface_2_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET COMPONENTS Core)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include(${CGAL_USE_FILE})
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

View File

@ -90,6 +90,7 @@ int main ()
case BLUE : std::cout << "BLUE." << std::endl; break;
case RED : std::cout << "RED." << std::endl; break;
case WHITE : std::cout << "WHITE." << std::endl; break;
default: break;
}
}

View File

@ -43,7 +43,7 @@
namespace CGAL {
/*! \class
/*! \class
* A model of the ArrangementTraits_2 concept that counts the methods invoked.
*/
template <class Base_traits>
@ -88,7 +88,7 @@ public:
COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP,
COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP,
COMPARE_X_NEAR_BOUNDARY_OP,
NUMBER_OF_OPERATIONS
};
@ -103,69 +103,69 @@ public:
}
/*! Construct copy */
Arr_counting_traits_2(Arr_counting_traits_2& other) : Base(other)
Arr_counting_traits_2(const Arr_counting_traits_2& other) : Base(other)
{
clear_counters();
increment();
}
/*! Obtain the counter of the given operation */
unsigned int count(Operation_id id) const
{ return m_counters[id]; }
unsigned int count_compare_x() const
{ return m_counters[COMPARE_X_OP]; }
unsigned int count_compare_xy() const
{ return m_counters[COMPARE_XY_OP]; }
unsigned int count_construct_min_vertex() const
{ return m_counters[CONSTRUCT_MIN_VERTEX_OP]; }
unsigned int count_construct_max_vertex() const
{ return m_counters[CONSTRUCT_MAX_VERTEX_OP]; }
unsigned int count_is_vertical() const
{ return m_counters[IS_VERTICAL_OP]; }
unsigned int count_compare_y_at_x() const
{ return m_counters[COMPARE_Y_AT_X_OP]; }
unsigned int count_equal_points() const
{ return m_counters[EQUAL_POINTS_OP]; }
unsigned int count_equal_curves() const
{ return m_counters[EQUAL_CURVES_OP]; }
unsigned int count_compare_y_at_x_left() const
{ return m_counters[COMPARE_Y_AT_X_LEFT_OP]; }
unsigned int count_compare_y_at_x_right() const
{ return m_counters[COMPARE_Y_AT_X_RIGHT_OP]; }
unsigned int count_make_x_monotone() const
{ return m_counters[MAKE_X_MONOTONE_OP]; }
unsigned int count_split() const
{ return m_counters[SPLIT_OP]; }
unsigned int count_intersect() const
{ return m_counters[INTERSECT_OP]; }
unsigned int count_are_mergeable() const
{ return m_counters[ARE_MERGEABLE_OP]; }
unsigned int count_merge() const
{ return m_counters[MERGE_OP]; }
unsigned int count_construct_opposite() const
{ return m_counters[CONSTRUCT_OPPOSITE_OP]; }
unsigned int count_compare_endpoints_xy() const
{ return m_counters[COMPARE_ENDPOINTS_XY_OP]; }
// left-right
unsigned int count_parameter_space_in_x_curve_end() const
{ return m_counters[PARAMETER_SPACE_IN_X_CURVE_END_OP]; }
@ -174,7 +174,7 @@ public:
unsigned int count_parameter_space_in_x_point() const
{ return m_counters[PARAMETER_SPACE_IN_X_POINT_OP]; }
unsigned int count_is_on_x_identification_point() const
{ return m_counters[IS_ON_X_IDENTIFICATION_POINT_OP]; }
@ -242,7 +242,7 @@ public:
Top_side_category;
typedef typename internal::Arr_complete_right_side_category< Base >::Category
Right_side_category;
typedef typename Base::Point_2 Point_2;
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Base::Curve_2 Curve_2;
@ -310,7 +310,7 @@ public:
const Point_2 operator()(const X_monotone_curve_2& xc) const
{ ++m_counter; return m_object(xc); }
};
/*! A functor that checks whether a given x-monotone curve is vertical. */
class Is_vertical_2 {
private:
@ -326,7 +326,7 @@ public:
bool operator()(const X_monotone_curve_2& xc) const
{ ++m_counter; return m_object(xc); }
};
/*! A functor that compares the y-coordinates of a point and an
* x-monotone curve at the point x-coordinate.
*/
@ -345,7 +345,7 @@ public:
const X_monotone_curve_2& xc) const
{ ++m_counter; return m_object(p, xc); }
};
/*! A functor that checks whether two points and two x-monotone curves are
* identical.
*/
@ -369,7 +369,7 @@ public:
/*! Operate */
bool operator()(const Point_2& p1, const Point_2& p2) const
{ ++m_counter2; return m_object(p1, p2); }
{ ++m_counter2; return m_object(p1, p2); }
};
/*! A functor that compares compares the y-coordinates of two x-monotone
@ -411,7 +411,7 @@ public:
const Point_2& p) const
{ ++m_counter; return m_object(xc1, xc2, p); }
};
/*! A functor that divides a curve into x-monotone curves. */
class Make_x_monotone_2 {
private:
@ -550,7 +550,7 @@ public:
/*! Construct */
Parameter_space_in_x_2(const Base* base, unsigned int& counter1,
unsigned int& counter2, unsigned int& counter3) :
m_object(base->parameter_space_in_x_2_object()),
m_object(base->parameter_space_in_x_2_object()),
m_counter1(counter1),
m_counter2(counter2),
m_counter3(counter3) {}
@ -583,9 +583,9 @@ public:
public:
/*! Construct */
Is_on_x_identification_2(const Base* base,
Is_on_x_identification_2(const Base* base,
unsigned int& counter1, unsigned int& counter2) :
m_object(base->is_on_x_identificiation_2_object()),
m_object(base->is_on_x_identificiation_2_object()),
m_counter1(counter1),
m_counter2(counter2) {}
@ -619,7 +619,7 @@ public:
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
{ ++m_counter; return m_object(p1, p2); }
};
/*! A functor that compares the y-coordinates of curve ends near the
* boundary of the parameter space.
*/
@ -635,7 +635,7 @@ public:
/*! Operate */
Comparison_result operator()(const X_monotone_curve_2& xc1,
const X_monotone_curve_2& xc2,
const X_monotone_curve_2& xc2,
Arr_curve_end ce) const
{ ++m_counter; return m_object(xc1, xc2, ce); }
};
@ -656,7 +656,7 @@ public:
/*! Construct */
Parameter_space_in_y_2(const Base* base, unsigned int& counter1,
unsigned int& counter2, unsigned int& counter3) :
m_object(base->parameter_space_in_y_2_object()),
m_object(base->parameter_space_in_y_2_object()),
m_counter1(counter1),
m_counter2(counter2),
m_counter3(counter3) {}
@ -673,7 +673,7 @@ public:
/*! Operate */
Arr_parameter_space operator()(const X_monotone_curve_2& xc) const
{ ++m_counter3; return m_object(xc); }
};
/*! A functor that determines whether a point or a curve lies on an
@ -687,9 +687,9 @@ public:
public:
/*! Construct */
Is_on_y_identification_2(const Base* base,
Is_on_y_identification_2(const Base* base,
unsigned int& counter1, unsigned int& counter2) :
m_object(base->is_on_y_identificiation_2_object()),
m_object(base->is_on_y_identificiation_2_object()),
m_counter1(counter1),
m_counter2(counter2) {}
@ -715,9 +715,9 @@ public:
public:
/*! Construct */
Compare_x_at_limit_2(const Base* base,
Compare_x_at_limit_2(const Base* base,
unsigned int& counter1, unsigned int& counter2) :
m_object(base->compare_x_at_limit_2_object()),
m_object(base->compare_x_at_limit_2_object()),
m_counter1(counter1),
m_counter2(counter2) {}
@ -743,11 +743,11 @@ public:
private:
typename Base::Compare_x_near_limit_2 m_object;
unsigned int& m_counter;
public:
/*! Construct */
Compare_x_near_limit_2(const Base* base, unsigned int& counter) :
m_object(base->compare_x_near_limit_2_object()),
m_object(base->compare_x_near_limit_2_object()),
m_counter(counter) {}
@ -804,12 +804,12 @@ public:
private:
typename Base::Compare_x_near_boundary_2 m_object;
unsigned int& m_counter;
public:
/*! Construct */
Compare_x_near_boundary_2(const Base* base,
Compare_x_near_boundary_2(const Base* base,
unsigned int& counter) :
m_object(base->compare_x_near_boundary_2_object()),
m_object(base->compare_x_near_boundary_2_object()),
m_counter(counter) {}
@ -829,7 +829,7 @@ public:
Compare_x_2 compare_x_2_object() const
{ return Compare_x_2(this, m_counters[COMPARE_X_OP]); }
Compare_xy_2 compare_xy_2_object() const
{ return Compare_xy_2(this, m_counters[COMPARE_XY_OP]); }
@ -838,13 +838,13 @@ public:
Construct_max_vertex_2 construct_max_vertex_2_object() const
{ return Construct_max_vertex_2(this, m_counters[CONSTRUCT_MAX_VERTEX_OP]); }
Is_vertical_2 is_vertical_2_object() const
{ return Is_vertical_2(this, m_counters[IS_VERTICAL_OP]); }
Compare_y_at_x_2 compare_y_at_x_2_object() const
{ return Compare_y_at_x_2(this, m_counters[COMPARE_Y_AT_X_OP]); }
Equal_2 equal_2_object() const
{
return Equal_2(this, m_counters[EQUAL_POINTS_OP],
@ -856,7 +856,7 @@ public:
Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
{ return Compare_y_at_x_right_2(this, m_counters[COMPARE_Y_AT_X_RIGHT_OP]); }
Make_x_monotone_2 make_x_monotone_2_object() const
{ return Make_x_monotone_2(this, m_counters[MAKE_X_MONOTONE_OP]); }
@ -881,16 +881,16 @@ public:
// left-right
Parameter_space_in_x_2 parameter_space_in_x_2_object() const
{ return Parameter_space_in_x_2(
this,
this,
m_counters[PARAMETER_SPACE_IN_X_CURVE_END_OP],
m_counters[PARAMETER_SPACE_IN_X_POINT_OP],
m_counters[PARAMETER_SPACE_IN_X_CURVE_OP]
);
);
}
Is_on_x_identification_2 is_on_x_identification_2_object() const
{
return Is_on_x_identification_2(this,
return Is_on_x_identification_2(this,
m_counters[IS_ON_X_IDENTIFICATION_POINT_OP],
m_counters[IS_ON_X_IDENTIFICATION_CURVE_OP]);
}
@ -907,25 +907,25 @@ public:
// bottom-top
Parameter_space_in_y_2 parameter_space_in_y_2_object() const
{ return Parameter_space_in_y_2(
this,
this,
m_counters[PARAMETER_SPACE_IN_Y_CURVE_END_OP],
m_counters[PARAMETER_SPACE_IN_Y_POINT_OP],
m_counters[PARAMETER_SPACE_IN_Y_CURVE_OP]
);
);
}
Is_on_y_identification_2 is_on_y_identification_2_object() const
{ return Is_on_y_identification_2(
this,
this,
m_counters[IS_ON_Y_IDENTIFICATION_POINT_OP],
m_counters[IS_ON_Y_IDENTIFICATION_CURVE_OP]
);
);
}
Compare_x_at_limit_2 compare_x_at_limit_2_object() const
{
return
Compare_x_at_limit_2(this,
Compare_x_at_limit_2(this,
m_counters[COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP],
m_counters[COMPARE_X_AT_LIMIT_CURVE_ENDS_OP]);
}
@ -936,12 +936,12 @@ public:
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
{
return
Compare_x_on_boundary_2(this,
Compare_x_on_boundary_2(this,
m_counters[COMPARE_X_ON_BOUNDARY_POINTS_OP],
m_counters[COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP],
m_counters[COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP]);
}
Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const
{
return Compare_x_near_boundary_2(this,

View File

@ -1573,6 +1573,63 @@ public:
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
{ return Compare_x_on_boundary_2(*this); }
/*! A functor that compares the x-coordinates of curveends near the
* boundary of the parameter space.
*/
class Compare_x_near_boundary_2 {
protected:
typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
Polycurve_basic_traits_2;
/*! The polycurve traits (in case it has state). */
const Polycurve_basic_traits_2& m_poly_traits;
public:
/*! Constructor. */
Compare_x_near_boundary_2(const Polycurve_basic_traits_2& traits) :
m_poly_traits(traits)
{}
/*! Compare the x-coordinates of 2 curveends near the boundary of the
* parameter space.
* \param xcv1 the first polycurve.
* \param xcv2 the second polycurve.
* \param ce the curve end indicator -
* ARR_MIN_END - the minimal end of curves or
* ARR_MAX_END - the maximal end of curves.
* \return the second comparison result:
* SMALLER - x(xcv1, ce) < x(xcv2, ce);
* EQUAL - x(xcv1, ce) = x(xcv2, ce);
* LARGER - x(xcv1, ce) > x(xcv2, ce).
* \pre the $x$-coordinates of xcv1 and xcv2 at their ce end are equal.
* \pre xcv1 does not coincide with the vertical identification curve.
* \pre xcv2 does not coincide with the vertical identification curve.
*/
Comparison_result operator()(const X_monotone_curve_2& xcv1,
const X_monotone_curve_2& xcv2,
Arr_curve_end ce) const
{
const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
Comparison_result direction1 =
geom_traits->compare_endpoints_xy_2_object()(xcv1[0]);
const X_monotone_subcurve_2& xs1 =
(((direction1 == SMALLER) && (ce == ARR_MAX_END)) ||
((direction1 == LARGER) && (ce == ARR_MIN_END))) ?
xcv1[0] : xcv1[xcv1.number_of_subcurves()-1];
Comparison_result direction2 =
geom_traits->compare_endpoints_xy_2_object()(xcv2[0]);
const X_monotone_subcurve_2& xs2 =
(((direction2 == SMALLER) && (ce == ARR_MAX_END)) ||
((direction2 == LARGER) && (ce == ARR_MIN_END))) ?
xcv2[0] : xcv2[xcv2.number_of_subcurves()-1];
return geom_traits->compare_x_near_boundary_2_object()(xs1, xs2, ce);
}
};
/*! Obtain a Compare_x_near_boundary_2 function object */
Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const
{ return Compare_x_near_boundary_2(*this); }
class Compare_x_at_limit_2{
protected:
typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>

View File

@ -97,6 +97,7 @@ public:
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
typedef typename Base::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
typedef typename Base::Compare_x_at_limit_2 Compare_x_at_limit_2;
typedef typename Base::Compare_x_near_boundary_2 Compare_x_near_boundary_2;
typedef typename Base::Compare_x_near_limit_2 Compare_x_near_limit_2;
typedef typename Base::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
typedef typename Base::Compare_y_near_boundary_2 Compare_y_near_boundary_2;
@ -165,7 +166,7 @@ public:
#ifndef DOXYGEN_RUNNING
class Push_back_2;
#endif
#endif
/*! \class
* A functor that divides an arc into x-monotone arcs. That are, arcs that
* do not cross the identification arc.

View File

@ -106,6 +106,7 @@ public:
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
typedef typename Base::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
typedef typename Base::Compare_x_at_limit_2 Compare_x_at_limit_2;
typedef typename Base::Compare_x_near_boundary_2 Compare_x_near_boundary_2;
typedef typename Base::Compare_x_near_limit_2 Compare_x_near_limit_2;
typedef typename Base::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
typedef typename Base::Compare_y_near_boundary_2 Compare_y_near_boundary_2;

View File

@ -204,9 +204,6 @@ private:
/*! The number of facest */
size_type m_num_facets;
/*! The type of the facets. */
size_type m_num_vertices_per_facet;
/*! The index of the marked vertex */
size_type m_marked_vertex_index;
@ -223,13 +220,11 @@ private:
size_type num_points,
const CoordIndexIter& indices_begin,
const CoordIndexIter& indices_end,
size_type num_facets,
size_type num_vertices_per_facet = 0) :
size_type num_facets) :
m_points_begin(points_begin), m_points_end(points_end),
m_num_points(num_points),
m_indices_begin(indices_begin), m_indices_end(indices_end),
m_num_facets(num_facets),
m_num_vertices_per_facet(num_vertices_per_facet),
m_marked_vertex_index(0),
m_marked_edge_index(0),
m_marked_facet_index(0)
@ -247,6 +242,11 @@ private:
/*! Set the marked-face index */
void set_marked_facet_index(size_type id) {m_marked_facet_index = id;}
/*! Add vertices to the current facet. */
template <typename Iterator, typename Builder>
void add_vertices_to_facet(Iterator begin, Iterator end, Builder& B)
{ for (Iterator it = begin; it != end; ++it) B.add_vertex_to_facet(*it); }
/*! builds the polyhedron */
void operator()(HDS& hds)
{
@ -264,51 +264,16 @@ private:
// Add the facets:
counter = 0;
switch (m_num_vertices_per_facet) {
case 0: // '0' indicates variant number of vertices per facet
{
CoordIndexIter ii = m_indices_begin;
while (ii != m_indices_end) {
Polyhedron_facet_handle fh = B.begin_facet();
if (counter == m_marked_facet_index) fh->set_marked(true);
int index = *ii++;
while (index != -1) {
B.add_vertex_to_facet(index);
index = *ii++;
}
B.end_facet();
++counter;
}
}
break;
case 3:
// Unfold for to improve preformance:
for (CoordIndexIter ii = m_indices_begin; ii != m_indices_end;
ii += m_num_vertices_per_facet)
{
Polyhedron_facet_handle fh = B.begin_facet();
if (counter == m_marked_facet_index) fh->set_marked(true);
B.add_vertex_to_facet(*ii);
B.add_vertex_to_facet(*(ii+1));
B.add_vertex_to_facet(*(ii+2));
B.end_facet();
++counter;
}
break;
default:
for (CoordIndexIter ii = m_indices_begin; ii != m_indices_end;
ii += m_num_vertices_per_facet)
{
Polyhedron_facet_handle fh = B.begin_facet();
if (counter == m_marked_facet_index) fh->set_marked(true);
for (size_type i = 0; i < m_num_vertices_per_facet; ++i)
B.add_vertex_to_facet(*(ii + i));
B.end_facet();
++counter;
}
break;
for (CoordIndexIter it = m_indices_begin; it != m_indices_end; ++it) {
Polyhedron_facet_handle fh = B.begin_facet();
if (counter == m_marked_facet_index) fh->set_marked(true);
//! \todo EF: when upgrading to C++11 enable the following code and
// remove add_vertices_to_facet().
// for (const auto& facet : *it) B.add_vertex_to_facet(facet);
// B.end_facet();
add_vertices_to_facet(it->begin(), it->end(), B);
B.end_facet();
++counter;
}
B.end_surface();
}
@ -366,13 +331,12 @@ private:
size_type num_points,
const CoordIndexIter indices_begin,
const CoordIndexIter indices_end,
size_type num_facets,
size_type num_vertices_per_facet = 0)
size_type num_facets)
{
/*! The builder */
Build_surface<PointIterator, CoordIndexIter>
surface(points_begin, points_end, num_points,
indices_begin, indices_end, num_facets, num_vertices_per_facet);
indices_begin, indices_end, num_facets);
surface.set_marked_vertex_index(m_marked_vertex_index);
surface.set_marked_edge_index(m_marked_edge_index);
surface.set_marked_facet_index(m_marked_facet_index);
@ -604,15 +568,13 @@ public:
const CoordIndexIter indices_begin,
const CoordIndexIter indices_end,
size_type num_facets,
size_type num_vertices_per_facet = 0,
Visitor* visitor = NULL)
{
m_visitor = visitor;
Polyhedron polyhedron;
update_polyhedron(polyhedron, points_begin, points_end, num_points,
indices_begin, indices_end, num_facets,
num_vertices_per_facet);
indices_begin, indices_end, num_facets);
#if 0
std::copy(polyhedron.points_begin(), polyhedron.points_end(),

View File

@ -18,15 +18,16 @@
// $Date$
//
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>s
// Efi Fogel <efif@post.tau.ac.il>
// Eric Berberich <eric@mpi-inf.mpg.de>
// (based on old version by Iddo Hanniel
// Eyal Flato
// Oren Nechushtan
// Efi Fogel
// Ron Wein
// Idit Haran)
// Author(s): Ron Wein <wein@post.tau.ac.il>s
// Efi Fogel <efif@post.tau.ac.il>
// Eric Berberich <eric@mpi-inf.mpg.de>
// (based on old version by Iddo Hanniel
// Eyal Flato
// Oren Nechushtan
// Efi Fogel
// Ron Wein
// Idit Haran)
#ifndef CGAL_ARR_TRAITS_ADAPTOR_2_H
#define CGAL_ARR_TRAITS_ADAPTOR_2_H
@ -73,6 +74,12 @@ public:
Right_side_category;
protected:
// All sides
typedef typename Arr_are_all_sides_oblivious_tag<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
Are_all_sides_oblivious_category;
// left-right dispatch
typedef CGAL::internal::Arr_left_right_implementation_dispatch<
@ -2270,10 +2277,10 @@ class Arr_traits_adaptor_2 :
public Arr_traits_basic_adaptor_2<ArrangementTraits_>
{
public:
// Traits-class geometric types.
typedef ArrangementTraits_ Base_traits_2;
typedef Arr_traits_basic_adaptor_2<ArrangementTraits_> Base;
typedef ArrangementTraits_ Base_traits_2;
typedef Arr_traits_basic_adaptor_2<Base_traits_2> Base;
typedef Arr_traits_adaptor_2<Base_traits_2> Self;
typedef typename Base_traits_2::Curve_2 Curve_2;
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
@ -2289,6 +2296,9 @@ public:
typedef typename Base::Top_side_category Top_side_category;
typedef typename Base::Right_side_category Right_side_category;
typedef typename Base::Are_all_sides_oblivious_category
Are_all_sides_oblivious_category;
/// \name Construction.
//@{
/*! Default constructor. */
@ -2300,7 +2310,7 @@ public:
// Inherited functors:
typedef typename Base::Compare_x_2 Compare_x_2;
typedef typename Base::Compare_xy_2 Compare_xy_2;
// typedef typename Base::Compare_xy_2 Compare_xy_2;
typedef typename Base::Construct_min_vertex_2 Construct_min_vertex_2;
typedef typename Base::Construct_max_vertex_2 Construct_max_vertex_2;
typedef typename Base::Is_vertical_2 Is_vertical_2;
@ -2317,6 +2327,499 @@ public:
/// \name Overriden functors.
//@{
/*! A functor that compares two points or two x-monotone curves
* lexigoraphically. Twp points are compared firest by their x-coordinates,
* then by their y-coordinates. Two curves are compared first their left-most
* endpoint, then by the graphs, and finally by their right-most endpoint.
*/
class Compare_xy_2 {
public:
/*! Compare two points lexigoraphically: by x, then by y.
* \param p1 the first point.
* \param p2 the second point.
* \return SMALLER - x(p1) < x(p2);
* SMALLER - x(p1) = x(p2) and y(p1) < y(p2);
* EQUAL - x(p1) = x(p2) and y(p1) = y(p2);
* LARGER - x(p1) = x(p2) and y(p1) > y(p2);
* LARGER - x(p1) > x(p2).
* \pre p1 does not lie on the boundary.
* \pre p2 does not lie on the boundary.
*/
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
{
Base base(m_self);
return base.compare_xy_2_object()(p1, p2);
}
/*! Compare two x-monotone curves lexigoraphically.
* Input: C1, C2, intersections = empty
* compare(C1, C2, intersections)
* Compare the left-most points of C1 and C2.
* If not equal return the comparison result.
* Otherwise (the left-most points are equal)
* Compare C1 and C2 to the right of the point.
* If not equal return the comparison result.
* Otherwise (they overlap)
* If intersection is empty, compute the intersections,
* Remove the first overlapping section from c1, c2, and intersections.
* If intersections is empty
* Compare the right-most point and return the result.
* return compare(C1, C2, intersections).
*/
Comparison_result operator()(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2) const
{
std::list<CGAL::Object> intersections;
return operator()(c1, c2, intersections,
Are_all_sides_oblivious_category());
}
protected:
//! The base traits.
const Self& m_self;
/*! Constructor.
* \param trait The base traits class. It must be passed, to handle non
* stateless traits objects, (which stores data).
* The constructor is declared private to allow only the functor
* obtaining function, which is a member of the nesting class,
* constructing it.
*/
Compare_xy_2(const Self& self) : m_self(self) {}
//! Allow its functor obtaining function calling the private constructor.
friend class Arr_traits_adaptor_2<Base_traits_2>;
/// Point-curve
//@{
/*! Compare a point and a curve end.
* Dispatch calls to traits that handle open and close boundaries, resp.
* The only reason for this dispatcher is the poor choice of different
* names for the Traits functors that handle close and open boundaries:
* Open boundary traits use: Compare_x_at_limit_2
* Close boundary traits use: Compare_x_on_boundary_2
*/
Comparison_result cmp_x_on_bnd(const Point_2& p,
const X_monotone_curve_2& c,
Arr_curve_end ce) const
{
// The complete code would need to check whether ce is bottom or top and
// use the corresponding dispatching criterion, but
// (i) in all out traits if bottom is open, so is top, and
// (ii) this is going to change soon....
return cmp_x_on_bnd(p, c, ce, Bottom_side_category());
}
// Open
Comparison_result cmp_x_on_bnd(const Point_2& p,
const X_monotone_curve_2& c,
Arr_curve_end ce,
Arr_open_side_tag) const
{ return m_self.compare_x_at_limit_2_object()(p, c, ce); }
// Close
Comparison_result cmp_x_on_bnd(const Point_2& p,
const X_monotone_curve_2& c,
Arr_curve_end ce,
Arr_oblivious_side_tag) const
{ return m_self.compare_x_on_boundary_2_object()(p, c, ce); }
//@}
/// curve-curve
//@{
/*! Compare a curve end and a curve end.
* Dispatch calls to traits that handle open and close boundaries, resp.
* The only reason for this dispatcher is the poor choice of different
* names for the Traits functors that handle close and open boundaries:
* Open boundary traits use: Compare_x_at_limit_2
* Close boundary traits use: Compare_x_on_boundary_2
*/
Comparison_result cmp_x_on_bnd(const X_monotone_curve_2& c1,
Arr_curve_end ce1,
const X_monotone_curve_2& c2,
Arr_curve_end ce2) const
{
// The complete code would need to check the combination of ce1 and ce2,
// whther they are (booton,bottom), (bottom,top), (top,bottom) or
// (top,top) and use the corresponding dispatching criteria, but we don't
// even have the interface to handle mixed (e.g., open bottom and
// closed top. Anyway, this is going to change soon....
return cmp_x_on_bnd(c1, ce1, c2, ce2, Bottom_side_category());
}
// Open
Comparison_result cmp_x_on_bnd(const X_monotone_curve_2& c1,
Arr_curve_end ce1,
const X_monotone_curve_2& c2,
Arr_curve_end ce2,
Arr_open_side_tag) const
{ return m_self.compare_x_at_limit_2_object()(c1, ce1, c2, ce2); }
// Close
Comparison_result cmp_x_on_bnd(const X_monotone_curve_2& c1,
Arr_curve_end ce1,
const X_monotone_curve_2& c2,
Arr_curve_end ce2,
Arr_oblivious_side_tag) const
{ return m_self.compare_x_on_boundary_2_object()(c1, ce1, c2, ce2); }
//@}
/*! Compare the max end of two x-monotone curves lexigoraphically.
*/
Comparison_result compare_max_end(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
Arr_all_sides_oblivious_tag) const
{
typedef typename Self::Construct_max_vertex_2 Construct_max_vertex_2;
Construct_max_vertex_2 ctr_max =
m_self.construct_max_vertex_2_object();
const Point_2& p1 = ctr_max(c1);
const Point_2& p2 = ctr_max(c2);
return operator()(p1, p2);
}
/*! Compare the max (right) end of two x-monotone curves lexigoraphically.
* \pre the curve overlap
*/
Comparison_result compare_max_end(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
Arr_not_all_sides_oblivious_tag) const
{
typedef typename Base::Parameter_space_in_x_2 Parameter_space_in_x_2;
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
Parameter_space_in_x_2 psx = m_self.parameter_space_in_x_2_object();
Parameter_space_in_y_2 psy = m_self.parameter_space_in_y_2_object();
Arr_parameter_space px1 = psx(c1, ARR_MAX_END);
Arr_parameter_space py1 = psy(c1, ARR_MAX_END);
Arr_parameter_space px2 = psx(c2, ARR_MAX_END);
Arr_parameter_space py2 = psy(c2, ARR_MAX_END);
// Handle the trivial cases:
if ((px1 == ARR_LEFT_BOUNDARY) && (px2 != ARR_LEFT_BOUNDARY))
return SMALLER;
if ((px2 == ARR_LEFT_BOUNDARY) && (px1 != ARR_LEFT_BOUNDARY))
return LARGER;
if ((px1 == ARR_RIGHT_BOUNDARY) && (px2 != ARR_RIGHT_BOUNDARY))
return LARGER;
if ((px2 == ARR_RIGHT_BOUNDARY) && (px1 != ARR_RIGHT_BOUNDARY))
return SMALLER;
// The only casese left are px1,px2 = (I,I), (L,L), and (R,R)
if (px1 == ARR_INTERIOR) {
CGAL_assertion(px2 == ARR_INTERIOR);
if ((py1 == ARR_INTERIOR) && (py2 == ARR_INTERIOR))
return compare_max_end(c1, c2, Arr_all_sides_oblivious_tag());
// px1, px2, py1 are interior
if (py1 == ARR_INTERIOR) {
CGAL_assertion(py2 != ARR_INTERIOR);
#if 0
// This code is retained (commented out) because in the future, when
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
// say, to Compare_x_on_boundary, it will replace the call below.
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
#endif
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
Comparison_result res = cmp_x_on_bnd(c1_max, c2, ARR_MAX_END);
if (res != EQUAL) return res;
return (py2 == ARR_TOP_BOUNDARY) ? SMALLER : LARGER;
}
// px1, px2, py2 are interior
if (py2 == ARR_INTERIOR) {
CGAL_assertion(py1 != ARR_INTERIOR);
#if 0
// This code is retained (commented out) because in the future, when
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
// say, to Compare_x_on_boundary, it will replace the call below.
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
#endif
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
Comparison_result res = cmp_x_on_bnd(c2_max, c1, ARR_MAX_END);
if (res != EQUAL) return CGAL::opposite(res);
return (py1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER;
}
// Both py1 and py2 not interior
#if 0
// This code is retained (commented out) because in the future, when
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
// say, to Compare_x_on_boundary, it will replace the call below.
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
#endif
Comparison_result res = cmp_x_on_bnd(c1, ARR_MAX_END, c2, ARR_MAX_END);
if (res != EQUAL) return res;
if ((py1 == ARR_BOTTOM_BOUNDARY) && (py2 != ARR_BOTTOM_BOUNDARY))
return SMALLER;
if ((py1 == ARR_TOP_BOUNDARY) && (py2 != ARR_TOP_BOUNDARY))
return LARGER;
return EQUAL;
}
// Both endpoints lie either on the left boundary or on the right
// boundary, which means that their x-coordinates are equal.
// Handle the trivial cases:
if ((py1 == ARR_BOTTOM_BOUNDARY) && (py2 != ARR_BOTTOM_BOUNDARY))
return SMALLER;
if ((py1 == ARR_TOP_BOUNDARY) && (py2 != ARR_TOP_BOUNDARY))
return LARGER;
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
Compare_y_on_boundary_2 cmp_y_on_bnd =
m_self.compare_y_on_boundary_2_object();
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
Comparison_result res = cmp_y_on_bnd(c1_max, c2_max);
return res;
}
/*! Split 2 given curves that overlap and have a common sub-curve on their
* right. Then compare the remaining portions of the curves, respectively.
*/
Comparison_result
compare_remainder(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
std::list<CGAL::Object>& intersections) const
{
// Right-most sections are equal.
// Advance to the next respective sections:
if (intersections.empty()) {
typedef typename Self::Intersect_2 Intersect_2;
Intersect_2 intersect = m_self.intersect_2_object();
intersect(c1, c2, std::back_inserter(intersections));
}
// Verify the first intersection is an overlap, remove it, and
// recursively call.
CGAL::Object first = intersections.front();
X_monotone_curve_2 xcv;
if (!assign(xcv, first)) {
CGAL_error_msg("The first intersection is not an overlap!");
return SMALLER;
}
intersections.pop_front();
if (intersections.empty())
return compare_max_end(c1, c2, Are_all_sides_oblivious_category());
// Otherwise, split and continue.
typedef typename Self::Split_2 Split_2;
Split_2 split = m_self.split_2_object();
X_monotone_curve_2 c11, c12, c21, c22;
Construct_max_vertex_2 ctr_max =
m_self.construct_max_vertex_2_object();
const Point_2& p1 = ctr_max(xcv);
const Point_2& p2 = ctr_max(xcv);
split(c1, p1, c11, c12);
split(c2, p2, c21, c22);
return operator()(c12, c22, intersections,
Are_all_sides_oblivious_category());
}
/*! Compare two x-monotone curves lexigoraphically.
*/
Comparison_result operator()(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
std::list<CGAL::Object>& intersections,
Arr_all_sides_oblivious_tag) const
{
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
Comparison_result res = operator()(c1_min, c2_min);
if (res != EQUAL) return res;
// Left-most points are equal.
// Compare their y-coordinates to their right:
res = m_self.compare_y_at_x_right_2_object()(c1, c2, c1_min);
if (res != EQUAL) return res;
return compare_remainder(c1, c2, intersections);
}
/*! Compare two x-monotone curves lexigoraphically.
*/
Comparison_result operator()(const X_monotone_curve_2& c1,
const X_monotone_curve_2& c2,
std::list<CGAL::Object>& intersections,
Arr_not_all_sides_oblivious_tag) const
{
typedef typename Base::Parameter_space_in_x_2 Parameter_space_in_x_2;
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
Parameter_space_in_x_2 psx = m_self.parameter_space_in_x_2_object();
Parameter_space_in_y_2 psy = m_self.parameter_space_in_y_2_object();
Arr_parameter_space min_px1 = psx(c1, ARR_MIN_END);
Arr_parameter_space min_py1 = psy(c1, ARR_MIN_END);
Arr_parameter_space min_px2 = psx(c2, ARR_MIN_END);
Arr_parameter_space min_py2 = psy(c2, ARR_MIN_END);
// Handle the trivial cases:
if ((min_px1 == ARR_LEFT_BOUNDARY) && (min_px2 != ARR_LEFT_BOUNDARY))
return SMALLER;
if ((min_px2 == ARR_LEFT_BOUNDARY) && (min_px1 != ARR_LEFT_BOUNDARY))
return LARGER;
if ((min_px1 == ARR_RIGHT_BOUNDARY) && (min_px2 != ARR_RIGHT_BOUNDARY))
return LARGER;
if ((min_px2 == ARR_RIGHT_BOUNDARY) && (min_px1 != ARR_RIGHT_BOUNDARY))
return SMALLER;
// The only casese left are px1,px2 = (I,I), (L,L), and (R,R)
if (min_px1 == ARR_INTERIOR) {
CGAL_assertion(min_px2 == ARR_INTERIOR);
if ((min_py1 == ARR_INTERIOR) && (min_py2 == ARR_INTERIOR)) {
return operator()(c1, c2, intersections,
Arr_all_sides_oblivious_tag());
}
//
if (min_py1 == ARR_INTERIOR) {
CGAL_assertion(min_py2 != ARR_INTERIOR);
#if 0
// This code is retained (commented out) because in the future, when
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
// say, to Compare_x_on_boundary, it will replace the call below.
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
#endif
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
Comparison_result res = cmp_x_on_bnd(c1_min, c2, ARR_MIN_END);
if (res != EQUAL) return res;
return (min_py2 == ARR_TOP_BOUNDARY) ? SMALLER : LARGER;
}
if (min_py2 == ARR_INTERIOR) {
CGAL_assertion(min_py1 != ARR_INTERIOR);
#if 0
// This code is retained (commented out) because in the future, when
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
// say, to Compare_x_on_boundary, it will replace the call below.
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
#endif
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
Comparison_result res = cmp_x_on_bnd(c2_min, c1, ARR_MIN_END);
if (res != EQUAL) return CGAL::opposite(res);
return (min_py1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER;
}
// Both min_py1 and min_py2 not interior
#if 0
// This code is retained (commented out) because in the future, when
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
// say, to Compare_x_on_boundary, it will replace the call below.
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
Compare_x_on_boundary_2 cmp_x_on_bnd =
m_self.compare_x_on_boundary_2_object();
#endif
Comparison_result res = cmp_x_on_bnd(c1, ARR_MIN_END, c2, ARR_MIN_END);
if (res != EQUAL) return res;
if ((min_py1 == ARR_BOTTOM_BOUNDARY) && (min_py2 == ARR_TOP_BOUNDARY))
return SMALLER;
if ((min_py1 == ARR_TOP_BOUNDARY) && (min_py2 == ARR_BOTTOM_BOUNDARY))
return LARGER;
// Left-most points are equal.
// Compare their x-coordinates near the common left endpoint.
res = m_self.compare_x_near_boundary_2_object()(c1, c2, ARR_MIN_END);
if (res != EQUAL) return res;
return compare_remainder(c1, c2, intersections);
}
if ((min_py1 == ARR_BOTTOM_BOUNDARY) && (min_py2 != ARR_BOTTOM_BOUNDARY))
return SMALLER;
if ((min_py1 == ARR_TOP_BOUNDARY) && (min_py2 != ARR_TOP_BOUNDARY))
return LARGER;
if (min_px1 == ARR_LEFT_BOUNDARY) {
// The min points of the two curves lie on the left boundary.
CGAL_assertion(min_px2 == ARR_LEFT_BOUNDARY);
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
Compare_y_on_boundary_2 cmp_y_on_bnd =
m_self.compare_y_on_boundary_2_object();
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
Comparison_result res = cmp_y_on_bnd(c1_min, c2_min);
if (res != EQUAL) return res;
typedef typename Self::Is_vertical_2 Is_vertical_2;
Is_vertical_2 is_vert = m_self.is_vertical_2_object();
bool vert1 = is_vert(c1);
bool vert2 = is_vert(c2);
if (vert1 && ! vert2) return SMALLER;
if (vert2 && ! vert1) return LARGER;
if (vert1 && vert2) {
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
res = cmp_y_on_bnd(c1_max, c2_max);
if (res == SMALLER) return SMALLER;
}
// Compare slightly to the right near the boundary.
typedef typename Self::Compare_y_near_boundary_2
Compare_y_near_boundary_2;
Compare_y_near_boundary_2 cmp_y_near_bnd =
m_self.compare_y_near_boundary_2_object();
res = cmp_y_near_bnd(c1, c2, CGAL::ARR_MIN_END);
if (res != EQUAL) return res;
// The two curves overlap on their right.
// Intersect them, and recursively compare the remaining portions,
// respectively.
return compare_remainder(c1, c2, intersections);
}
CGAL_assertion(min_px1 == ARR_RIGHT_BOUNDARY);
CGAL_assertion(min_px2 == ARR_RIGHT_BOUNDARY);
// The min points of the two curves lie on the right boundary.
// It implies that the entire curves lie on the right boundary, and
// thus both are vertical.
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
Compare_y_on_boundary_2 cmp_y_on_bnd =
m_self.compare_y_on_boundary_2_object();
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
Comparison_result res = cmp_y_on_bnd(c1_min, c2_min);
if (res != EQUAL) return res;
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
res = cmp_y_on_bnd(c1_max, c2_max);
return res;
}
};
/*! Obtain a Compare_xy_2 function object */
Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(*this); }
/*! A functor that tests whether two x-monotone curves can be merged. */
class Are_mergeable_2 {
public:

View File

@ -15,11 +15,11 @@
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
// (based on old version by Eyal Flato)
//
// Author(s): Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
// (based on old version by Eyal Flato)
#ifndef CGAL_ARRANGEMENT_ZONE_2_H
#define CGAL_ARRANGEMENT_ZONE_2_H
@ -61,17 +61,14 @@ namespace CGAL {
* by the visitor (if valid), and the Boolean value indicates whether we
* should halt the zone-computation process.
*/
template <class Arrangement_, class ZoneVisitor_>
class Arrangement_zone_2
{
template <typename Arrangement_, typename ZoneVisitor_>
class Arrangement_zone_2 {
public:
typedef Arrangement_ Arrangement_2;
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
typedef typename Arrangement_2::Topology_traits Topology_traits;
protected:
typedef Arr_traits_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
typedef typename Traits_adaptor_2::Left_side_category Left_side_category;
@ -79,14 +76,13 @@ protected:
typedef typename Traits_adaptor_2::Top_side_category Top_side_category;
typedef typename Traits_adaptor_2::Right_side_category Right_side_category;
BOOST_MPL_ASSERT(
(typename
Arr_sane_identified_tagging< Left_side_category, Bottom_side_category,
Top_side_category, Right_side_category >::result)
);
BOOST_MPL_ASSERT
((typename Arr_sane_identified_tagging<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result));
public:
typedef ZoneVisitor_ Visitor;
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
@ -100,194 +96,260 @@ public:
typedef typename Geometry_traits_2::Multiplicity Multiplicity;
protected:
typedef typename Arr_are_all_sides_oblivious_tag<
Left_side_category, Bottom_side_category,
Top_side_category, Right_side_category >::result
typedef typename Arr_are_all_sides_oblivious_tag<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
Are_all_sides_oblivious_category;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
// Types used for caching intersection points:
typedef std::pair<Point_2,Multiplicity> Intersect_point_2;
typedef std::list<CGAL::Object> Intersect_list;
typedef std::map<const X_monotone_curve_2*,
Intersect_list> Intersect_map;
typedef typename Intersect_map::iterator Intersect_map_iterator;
typedef typename Arrangement_2::Ccb_halfedge_circulator
Ccb_halfedge_circulator;
typedef std::set<const X_monotone_curve_2*> Curves_set;
typedef typename Curves_set::iterator Curves_set_iterator;
// Types used for caching intersection points:
typedef std::pair<Point_2, Multiplicity> Intersect_point_2;
typedef std::list<CGAL::Object> Intersect_list;
typedef std::map<const X_monotone_curve_2*, Intersect_list>
Intersect_map;
typedef typename Intersect_map::iterator Intersect_map_iterator;
typedef std::set<const X_monotone_curve_2*> Curves_set;
typedef typename Curves_set::iterator Curves_set_iterator;
// Data members:
Arrangement_2& arr; // The associated arrangement.
const Traits_adaptor_2 * m_geom_traits; // Its associated geometry traits.
Arr_accessor<Arrangement_2> arr_access; // An accessor for the arrangement.
Visitor *visitor; // The zone visitor.
Arrangement_2& m_arr; // The associated arrangement.
const Traits_adaptor_2* m_geom_traits; // Its associated geometry traits.
Arr_accessor<Arrangement_2> m_arr_access; // An accessor for the arrangement.
Intersect_map inter_map; // Stores all computed intersections.
Visitor* m_visitor; // The zone visitor.
const Vertex_handle invalid_v; // An invalid vertex handle.
const Halfedge_handle invalid_he; // An invalid halfedge handle.
Intersect_map m_inter_map; // Stores all computed intersections.
X_monotone_curve_2 cv; // The current portion of the
const Vertex_handle m_invalid_v; // An invalid vertex handle.
const Halfedge_handle m_invalid_he; // An invalid halfedge handle.
X_monotone_curve_2 m_cv; // The current portion of the
// inserted curve.
CGAL::Object obj; // The location of the left endpoint.
bool has_left_pt; // Is the left end of the curve
// bounded.
bool left_on_boundary; // Is the left point on the boundary.
Point_2 left_pt; // Its current left endpoint.
bool has_right_pt; // Is the right end of the curve
// bounded.
bool right_on_boundary;// Is the right point on the boundary.
Point_2 right_pt; // Its right endpoint (if bounded).
CGAL::Object m_obj; // The location of the left endpoint.
bool m_has_left_pt; // Is the left end of the curve bounded.
bool m_left_on_boundary; // Is the left point on the boundary.
Point_2 m_left_pt; // Its current left endpoint.
bool m_has_right_pt; // Is the right end of the curve bounded.
bool m_right_on_boundary; // Is the right point on the boundary.
Point_2 m_right_pt; // Its right endpoint (if bounded).
Vertex_handle left_v; // The arrangement vertex associated
Vertex_handle m_left_v; // The arrangement vertex associated
// with the current left_pt (if any).
Halfedge_handle left_he; // If left_v is valid, left_he is the
Halfedge_handle m_left_he; // If left_v is valid, left_he is the
// predecessor for cv around this
// vertex. Otherwise, if it is valid,
// it is the halfedge that contains
// the left endpoint it its interior.
Vertex_handle right_v; // The arrangement vertex associated
// with the current right_pt (if any).
Halfedge_handle right_he; // If right_v is valid, left_he is the
Vertex_handle m_right_v; // The arrangement vertex associated
// with the current m_right_pt (if any).
Halfedge_handle m_right_he; // If m_right_v is valid, left_he is the
// predecessor for cv around this
// vertex. Otherwise, if it is valid,
// it is the halfedge that contains
// the right endpoint it its interior.
Point_2 intersect_p; // The next intersection point.
unsigned int ip_mult; // Its multiplicity
Point_2 m_intersect_p; // The next intersection point.
unsigned int m_ip_multiplicity; // Its multiplicity
// (0 in case of an overlap).
bool found_intersect; // Have we found an intersection
bool m_found_intersect; // An intersection has been found.
// (or an overlap).
X_monotone_curve_2 overlap_cv; // The currently discovered overlap.
bool found_overlap; // Have we found an overlap.
bool found_iso_vert; // Check if an isolated vertex induces
// the next intersection.
Vertex_handle intersect_v; // The vertex that intersects cv.
Halfedge_handle intersect_he; // The halfedge that intersects cv
X_monotone_curve_2 m_overlap_cv; // The currently discovered overlap.
bool m_found_overlap; // An overlap has been found.
bool m_found_iso_vert; // Check whether an isolated vertex
// induces the next intersection.
Vertex_handle m_intersect_v; // The vertex that intersects cv.
Halfedge_handle m_intersect_he; // The halfedge that intersects cv
// (or overlaps it).
X_monotone_curve_2 sub_cv1; // Auxiliary variable (for curve split).
X_monotone_curve_2 sub_cv2; // Auxiliary variable (for curve split).
X_monotone_curve_2 m_sub_cv1; // Auxiliary variable (for curve split).
X_monotone_curve_2 m_sub_cv2; // Auxiliary variable (for curve split).
public:
/*!
* Constructor.
/*! Constructor.
* \param _arr The arrangement for which we compute the zone.
* \param _visitor A pointer to a zone-visitor object.
*/
Arrangement_zone_2 (Arrangement_2& _arr, Visitor *_visitor) :
arr (_arr),
arr_access (_arr),
visitor (_visitor),
invalid_v (),
invalid_he ()
Arrangement_zone_2(Arrangement_2& arr, Visitor* visitor) :
m_arr(arr),
m_arr_access(arr),
m_visitor(visitor),
m_invalid_v(),
m_invalid_he()
{
m_geom_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
CGAL_assertion (visitor != NULL);
m_geom_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits());
CGAL_assertion(visitor != NULL);
// Initialize the visitor.
visitor->init (&arr);
visitor->init(&arr);
}
/*!
* Initialize the zone-computation process with a given curve.
/*! Initialize the zone-computation process with a given curve.
* \param _cv The query curve.
* \param pl A point-location object associated with the arrangement.
*/
template <class PointLocation>
void init (const X_monotone_curve_2& _cv, const PointLocation& pl)
template <typename PointLocation>
void init(const X_monotone_curve_2& cv, const PointLocation& pl)
{
// Set the curve and check whether its left end has boundary conditions.
cv = _cv;
m_cv = cv;
const Arr_parameter_space bx1 =
m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END);
const Arr_parameter_space by1 =
m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END);
const Arr_parameter_space bx1 =
m_geom_traits->parameter_space_in_x_2_object()(m_cv, ARR_MIN_END);
const Arr_parameter_space by1 =
m_geom_traits->parameter_space_in_y_2_object()(m_cv, ARR_MIN_END);
if (bx1 == ARR_INTERIOR && by1 == ARR_INTERIOR) {
// The curve has a finite left endpoint with no boundary conditions:
// locate it in the arrangement.
has_left_pt = true;
left_on_boundary = (bx1 != ARR_INTERIOR || by1 != ARR_INTERIOR);
left_pt = m_geom_traits->construct_min_vertex_2_object() (cv);
m_has_left_pt = true;
m_left_on_boundary = (bx1 != ARR_INTERIOR || by1 != ARR_INTERIOR);
m_left_pt = m_geom_traits->construct_min_vertex_2_object()(m_cv);
obj = pl.locate (left_pt);
m_obj = pl.locate(m_left_pt);
}
else {
// The left end of the curve has boundary conditions: use the topology
// traits use the arrangement accessor to locate it.
// Note that if the curve-end is unbounded, left_pt does not exist.
// Note that if the curve-end is unbounded, left_pt does not exist.
has_left_pt = m_geom_traits->is_closed_2_object()(cv, ARR_MIN_END);
left_on_boundary = true;
if (has_left_pt)
left_pt = m_geom_traits->construct_min_vertex_2_object() (cv);
obj = arr_access.locate_curve_end (cv, ARR_MIN_END, bx1, by1);
// Note that if the curve-end is unbounded, m_left_pt does not exist.
// Note that if the curve-end is unbounded, m_left_pt does not exist.
m_has_left_pt = m_geom_traits->is_closed_2_object()(m_cv, ARR_MIN_END);
m_left_on_boundary = true;
if (m_has_left_pt)
m_left_pt = m_geom_traits->construct_min_vertex_2_object()(m_cv);
m_obj = m_arr_access.locate_curve_end(m_cv, ARR_MIN_END, bx1, by1);
}
// Check the boundary conditions of th right curve end.
if (m_geom_traits->is_closed_2_object()(cv, ARR_MAX_END)) {
const Arr_parameter_space bx2 =
m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MAX_END);
const Arr_parameter_space by2 =
m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END);
if (m_geom_traits->is_closed_2_object()(m_cv, ARR_MAX_END)) {
const Arr_parameter_space bx2 =
m_geom_traits->parameter_space_in_x_2_object()(m_cv, ARR_MAX_END);
const Arr_parameter_space by2 =
m_geom_traits->parameter_space_in_y_2_object()(m_cv, ARR_MAX_END);
// The right endpoint is valid.
has_right_pt = true;
right_pt = m_geom_traits->construct_max_vertex_2_object() (cv);
right_on_boundary = (bx2 != ARR_INTERIOR) || (by2 != ARR_INTERIOR);
m_has_right_pt = true;
m_right_pt = m_geom_traits->construct_max_vertex_2_object()(m_cv);
m_right_on_boundary = (bx2 != ARR_INTERIOR) || (by2 != ARR_INTERIOR);
}
else {
// The right end of the curve lies at infinity.
has_right_pt = false;
right_on_boundary = true;
m_has_right_pt = false;
m_right_on_boundary = true;
}
return;
}
/*!
* Initialize the zone-computation process with a given curve and an object
/*! Initialize the zone-computation process with a given curve and an object
* that wraps the location of the curve's left end.
* \param _cv The query curve.
* \param _obj An object that represents the location of the left end
* of the curve.
* \param cv The query curve.
* \param obj An object that represents the location of the left end of the
* curve.
*/
void init_with_hint (const X_monotone_curve_2& _cv, const Object& _obj);
void init_with_hint(const X_monotone_curve_2& cv, const Object& obj);
/*!
* Compute the zone of the given curve and issue the apporpriate
/*! Compute the zone of the given curve and issue the apporpriate
* notifications for the visitor.
*/
void compute_zone ();
void compute_zone();
private:
/*! Check whether two curves with a common endpoint overlap.
* \pre p == min_point(cv1)
* \pre p == min_point(cv2)
* \todo move this function to a more accessible place so that it can be reused
*/
bool do_overlap(const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2,
const Point_2& p) const
{ return do_overlap_impl(cv1, cv2, p, Are_all_sides_oblivious_category()); }
/*!
* Find a face containing the query curve cv around the given vertex.
* In case an overlap occurs, sets intersect_he to be the overlapping edge.
/*! Check whether two curves with a common min endpoint overlap.
*/
bool do_overlap_impl(const X_monotone_curve_2& cv1,
const X_monotone_curve_2& cv2,
const Point_2& p, Arr_all_sides_oblivious_tag) const
{
return m_geom_traits->compare_y_at_x_right_2_object()(cv1, cv2, p) == EQUAL;
}
/*! Check whether two curves with a common min endpoint overlap.
*/
bool do_overlap_impl(const X_monotone_curve_2& cv1,
const X_monotone_curve_2& cv2,
const Point_2& p, Arr_not_all_sides_oblivious_tag) const;
/* Check whether the given query curve is encountered when rotating the
* first curve in a clockwise direction around a given point until reaching
* the second curve.
* \pre p == min_point(xcv)
* \pre p == min_point(xcv1)
* \pre p == min_point(cxv2)
* \pre xcv_to_right == TRUE
* \todo move this function to a more accessible place so that it can be reused
*/
bool is_between_cw(const X_monotone_curve_2& xcv, bool xcv_to_right,
const X_monotone_curve_2& xcv1, bool xcv1_to_right,
const X_monotone_curve_2& xcv2, bool xcv2_to_right,
const Point_2& p,
bool& xcv_equal_xcv1, bool& xcv_equal_xcv2) const
{
return is_between_cw_impl(xcv, xcv_to_right,
xcv1, xcv1_to_right,
xcv2, xcv2_to_right,
p, xcv_equal_xcv1, xcv_equal_xcv2,
Are_all_sides_oblivious_category());
}
/* Check whether the given query curve is encountered when rotating the
* first curve in a clockwise direction around a given point until reaching
* the second curve.
*/
bool is_between_cw_impl(const X_monotone_curve_2& xcv, bool xcv_to_right,
const X_monotone_curve_2& xcv1, bool xcv1_to_right,
const X_monotone_curve_2& xcv2, bool xcv2_to_right,
const Point_2& p,
bool& xcv_equal_xcv1, bool& xcv_equal_xcv2,
Arr_all_sides_oblivious_tag) const
{
return m_geom_traits->is_between_cw_2_object()(xcv, xcv_to_right,
xcv1, xcv1_to_right,
xcv2, xcv2_to_right,
p,
xcv_equal_xcv1,
xcv_equal_xcv2);
}
/* Check whether the given query curve is encountered when rotating the
* first curve in a clockwise direction around a given point until reaching
* the second curve.
*/
bool is_between_cw_impl(const X_monotone_curve_2& xcv, bool xcv_to_right,
const X_monotone_curve_2& xcv1, bool xcv1_to_right,
const X_monotone_curve_2& xcv2, bool xcv2_to_right,
const Point_2& p,
bool& xcv_equal_xcv1, bool& xcv_equal_xcv2,
Arr_not_all_sides_oblivious_tag) const;
/*! Find a face containing the query curve m_cv around the given vertex.
* In case an overlap occurs, sets m_intersect_he to be the overlapping edge.
* \param v The query vertex.
* \param he Output: The predecessor of cv around the vertex.
* \return (true) if cv overlaps with the curve associated with he;
* \param he Output: The predecessor of m_cv around the vertex.
* \return (true) if m_cv overlaps with the curve associated with he;
* (false) if there is no overlap.
*/
bool _find_prev_around_vertex (Vertex_handle v, Halfedge_handle& he);
bool _find_prev_around_vertex(Vertex_handle v, Halfedge_handle& he);
/*!
* Direct the halfedge for the location of the given subcurve around a split
/*! Direct the halfedge for the location of the given subcurve around a split
* point that occurs in the interior of a given edge, when the subcurve lies
* to the right of the split point.
* In case of overlaps, it sets also found_overlap and intersect_he.
* In case of overlaps, it sets also m_found_overlap and m_intersect_he.
* \param cv_ins The curve to be inserted, whose left endpoint coincides
* with the edge to be split.
* \param cv_left_pt The left endpoint of cv_ins.
@ -302,8 +364,7 @@ private:
const Point_2& cv_left_pt,
Halfedge_handle query_he);
/*!
* Direct the halfedge for the location of the given subcurve around a split
/*! Direct the halfedge for the location of the given subcurve around a split
* point that occurs in the interior of a given edge, when the subcurve lies
* to the left of the split point.
* \param cv_ins The curve to be inserted, whose right endpoint coincides
@ -318,8 +379,7 @@ private:
_direct_intersecting_edge_to_left(const X_monotone_curve_2& cv_ins,
Halfedge_handle query_he);
/*!
* Get the next intersection of cv with the given halfedge.
/*! Get the next intersection of m_cv with the given halfedge.
* \param he A handle to the halfedge.
* \param skip_first_point Should we skip the first intersection point.
* \param intersect_on_right_boundary Output: If an intersetion point is
@ -332,20 +392,19 @@ private:
* case of an overlap, and an empty object if there is no
* intersection.
*/
CGAL::Object _compute_next_intersection (Halfedge_handle he,
bool skip_first_point,
bool& intersect_on_right_boundary);
CGAL::Object _compute_next_intersection(Halfedge_handle he,
bool skip_first_point,
bool& intersect_on_right_boundary);
/*!
* Remove the next intersection of cv with the given halfedge from the map.
/*! Remove the next intersection of m_cv with the given halfedge from the map.
* \param he A handle to the halfedge.
* \pre The list of intersections with the curve of he has already been
* computed, and it is not empty.
*/
void _remove_next_intersection (Halfedge_handle he);
/*!
* Check if the given point lies completely to the left of the given egde.
/*! Check whether the given point lies completely to the left of the given
* egde.
* \param p The point.
* \param he The halfedge.
* \pre he is not a fictitious edge.
@ -359,19 +418,19 @@ private:
bool _is_to_left_impl(const Point_2& p, Halfedge_handle he,
Arr_all_sides_oblivious_tag) const
{
return ((he->direction() == ARR_LEFT_TO_RIGHT &&
m_geom_traits->compare_xy_2_object()
return (((he->direction() == ARR_LEFT_TO_RIGHT) &&
m_geom_traits->compare_xy_2_object()
(p, he->source()->point()) == SMALLER) ||
(he->direction() == ARR_RIGHT_TO_LEFT &&
m_geom_traits->compare_xy_2_object()
m_geom_traits->compare_xy_2_object()
(p, he->target()->point()) == SMALLER));
}
bool _is_to_left_impl(const Point_2& p, Halfedge_handle he,
Arr_not_all_sides_oblivious_tag) const;
/*!
* Check if the given point lies completely to the right of the given egde.
/*! Check whether the given point lies completely to the right of the given
* egde.
* \param p The point.
* \param he The halfedge.
* \pre he is not a fictitious edge.
@ -385,59 +444,62 @@ private:
bool _is_to_right_impl(const Point_2& p, Halfedge_handle he,
Arr_all_sides_oblivious_tag) const
{
return ((he->direction() == ARR_LEFT_TO_RIGHT &&
m_geom_traits->compare_xy_2_object()
(p, he->target()->point()) == LARGER) ||
(he->direction() == ARR_RIGHT_TO_LEFT &&
m_geom_traits->compare_xy_2_object()
(p, he->source()->point()) == LARGER));
return (((he->direction() == ARR_LEFT_TO_RIGHT) &&
m_geom_traits->compare_xy_2_object()(p, he->target()->point()) ==
LARGER) ||
((he->direction() == ARR_RIGHT_TO_LEFT) &&
m_geom_traits->compare_xy_2_object()(p, he->source()->point()) ==
LARGER));
}
bool _is_to_right_impl(const Point_2& p, Halfedge_handle he,
Arr_not_all_sides_oblivious_tag) const;
/*!
* Compute the (lexicographically) leftmost intersection of the query
/*! Compute the (lexicographically) leftmost intersection of the query
* curve with a given halfedge on the boundary of a face in the arrangement.
*/
void
_leftmost_intersection(Ccb_halfedge_circulator he_curr, bool on_boundary,
bool& leftmost_on_right_boundary);
/*! Compute the (lexicographically) leftmost intersection of the query
* curve with the boundary of a given face in the arrangement.
* The function computes sets intersect_p, intersect_he (or alternatively
* overlap_cv and intersect_he) and set the flags found_intersect and
* found_overlap accordingly.
* The function computes sets m_intersect_p, m_intersect_he (or alternatively
* m_overlap_cv and m_intersect_he) and set the flags m_found_intersect and
* m_found_overlap accordingly.
* \param face A handle to the face.
* \param on_boundary Specifies whether the left endpoint of the curve lies
* on the face boundary.
*/
void _leftmost_intersection_with_face_boundary (Face_handle face,
bool on_boundary);
void _leftmost_intersection_with_face_boundary(Face_handle face,
bool on_boundary);
/*!
* Compute the zone of an x-monotone curve in a given arrangement face.
/*! Compute the zone of an x-monotone curve in a given arrangement face.
* The left endpoint of the curve either lies in the face interior or on
* the boundary of the face.
* This function updates cv and its left endpoint and also sets left_v
* and left_he for the remaining portion of the curve.
* In case of overlaps, it sets also overlap_cv and intersect_he.
* This function updates m_cv and its left endpoint and also sets m_left_v
* and m_left_he for the remaining portion of the curve.
* In case of overlaps, it sets also m_overlap_cv and m_intersect_he.
* \param face The given face.
* \param on_boundary Specifies whether the left endpoint of the curve lies
* on the face boundary.
* \pre If on_boundary is (true) then left_he must be valid; if it is (false)
* then both left_v anf left_he must be invalid.
* \pre If on_boundary is (true) then m_left_he must be valid; if it is
* (false), then both m_left_v anf m_left_he must be invalid.
* \return (true) if we are done with the zone-computation process;
* (false) if we still have a remaining portion of cv to continue
* (false) if we still have a remaining portion of m_cv to continue
* with.
*/
bool _zone_in_face (Face_handle face,
bool on_boundary);
bool _zone_in_face(Face_handle face, bool on_boundary);
/*!
* Compute the zone of an overlapping subcurve overlap_cv of cv and the
* curve currently associated with intersect_he.
* This function updates cv and its left endpoint and also sets left_v
* and left_he for the remaining portion of the curve.
/*! Compute the zone of an overlapping subcurve m_overlap_cv of m_cv and the
* curve currently associated with m_intersect_he.
* This function updates m_cv and its left endpoint and also sets m_left_v
* and m_left_he for the remaining portion of the curve.
* \return (true) if we are done with the zone-computation process;
* (false) if we still have a remaining portion of cv to continue
* (false) if we still have a remaining portion of m_cv to continue
* with.
*/
bool _zone_in_overlap ();
bool _zone_in_overlap();
};
} //namespace CGAL

View File

@ -12,11 +12,7 @@ find_package(CGAL QUIET COMPONENTS Core)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include(${CGAL_USE_FILE})
if(COMMAND target_compile_options)
# Since CMake-2.8.12: New CMake script, that defines the targets and

View File

@ -270,10 +270,9 @@ bool Construction_test<T_Geom_traits, T_Topol_traits>::are_same_results()
typename Xcurve_container::iterator xcit = curves_res.begin();
Edge_const_iterator eit;
for (eit = m_arr->edges_begin(); eit != m_arr->edges_end(); ++eit) {
if (is_interior(eit->source()) && is_interior(eit->target()))
*xcit++ = eit->curve();
}
for (eit = m_arr->edges_begin(); eit != m_arr->edges_end(); ++eit)
*xcit++ = eit->curve();
Curve_compare<Geom_traits> curve_compare(m_geom_traits);
std::sort(curves_res.begin(), xcit, curve_compare);

View File

@ -6,17 +6,20 @@
#include "Traits_base_test.h"
template <typename Geom_traits_T>
template <typename GeomTraits, typename BaseGeomTraits>
class Traits_adaptor_test :
public Traits_base_test<typename Geom_traits_T::Base>
public Traits_base_test<BaseGeomTraits>
{
public:
typedef Geom_traits_T Geom_traits;
typedef Traits_base_test<typename Geom_traits::Base> Base;
typedef GeomTraits Geom_traits;
typedef BaseGeomTraits Base_geom_traits;
typedef Traits_base_test<Base_geom_traits> Base;
private:
typedef Traits_adaptor_test<Geom_traits, Base_geom_traits> Self;
/*! A map between (strings) commands and (member functions) operations */
typedef bool (Traits_adaptor_test::* Wrapper)(std::istringstream &);
typedef bool (Traits_adaptor_test::* Wrapper)(std::istringstream&);
typedef std::map<std::string, Wrapper> Wrapper_map;
typedef typename Wrapper_map::iterator Wrapper_iter;
Wrapper_map m_wrappers;
@ -34,6 +37,8 @@ private:
}
//@{
bool ta_compare_xy(std::istringstream&);
bool ta_compare_xy_imp(std::istringstream&);
bool ta_compare_y_at_x_left_wrapper(std::istringstream&);
bool ta_compare_y_at_x_left_wrapper_imp(std::istringstream&,
@ -61,67 +66,78 @@ protected:
const Geom_traits& m_geom_traits;
public:
/*! Constructor */
/*! Construct.
*/
Traits_adaptor_test(const Geom_traits& geom_traits);
/*! Destructor */
/*! Destruct.
*/
virtual ~Traits_adaptor_test();
};
/*!
* Constructor.
/*! Construct.
* Accepts test data file name.
*/
template <typename Geom_traits_T>
Traits_adaptor_test<Geom_traits_T>::
Traits_adaptor_test(const Geom_traits_T& geom_traits) :
template <typename GeomTraits, typename BaseGeomTraits>
Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
Traits_adaptor_test(const GeomTraits& geom_traits) :
Base(geom_traits),
m_geom_traits(geom_traits)
{
typedef Geom_traits_T Geom_traits;
m_wrappers[std::string("compare_xy")] = &Self::ta_compare_xy;
m_wrappers[std::string("compare_y_at_x_left")] =
&Traits_adaptor_test<Geom_traits>::ta_compare_y_at_x_left_wrapper;
m_wrappers[std::string("is_in_x_range")] =
&Traits_adaptor_test<Geom_traits>::ta_is_in_x_range_wrapper;
&Self::ta_compare_y_at_x_left_wrapper;
m_wrappers[std::string("is_in_x_range")] = &Self::ta_is_in_x_range_wrapper;
m_wrappers[std::string("compare_y_position")] =
&Traits_adaptor_test<Geom_traits>::ta_compare_y_position_wrapper;
m_wrappers[std::string("is_between_cw")] =
&Traits_adaptor_test<Geom_traits>::ta_is_between_cw_wrapper;
&Self::ta_compare_y_position_wrapper;
m_wrappers[std::string("is_between_cw")] = &Self::ta_is_between_cw_wrapper;
m_wrappers[std::string("compare_cw_around_point")] =
&Traits_adaptor_test<Geom_traits>::ta_compare_cw_around_point_wrapper;
m_wrappers[std::string("are_mergeable")] =
&Traits_adaptor_test<Geom_traits>::ta_are_mergeable_wrapper;
m_wrappers[std::string("merge")] =
&Traits_adaptor_test<Geom_traits>::ta_merge_wrapper;
&Self::ta_compare_cw_around_point_wrapper;
m_wrappers[std::string("are_mergeable")] = &Self::ta_are_mergeable_wrapper;
m_wrappers[std::string("merge")] = &Self::ta_merge_wrapper;
}
/*!
* Destructor.
/*! Destruct.
* Declares as virtual.
*/
template <typename Geom_traits_T>
Traits_adaptor_test<Geom_traits_T>::~Traits_adaptor_test() {}
template <typename GeomTraits, typename BaseGeomTraits>
Traits_adaptor_test<GeomTraits, BaseGeomTraits>::~Traits_adaptor_test() {}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_y_at_x_left_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_xy(std::istringstream& str_stream)
{
typedef typename Geom_traits_T::Has_left_category Has_left_category;
unsigned int id1, id2;
str_stream >> id1 >> id2;
unsigned int exp_answer = this->get_expected_enum(str_stream);
std::cout << "Test: compare_xy( " << this->m_xcurves[id1]
<< "," << this->m_xcurves[id2] << " ) ? " << exp_answer << " ";
unsigned int real_answer =
m_geom_traits.compare_xy_2_object()(this->m_xcurves[id1] ,
this->m_xcurves[id2]);
return this->compare(exp_answer, real_answer);
}
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_y_at_x_left_wrapper(std::istringstream& str_stream)
{
typedef typename Geom_traits::Has_left_category Has_left_category;
return ta_compare_y_at_x_left_wrapper_imp(str_stream, Has_left_category());
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream &, CGAL::Tag_false)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream&, CGAL::Tag_false)
{
CGAL_error();
return false;
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream,
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream& str_stream,
CGAL::Tag_true)
{
unsigned int id1, id2, id3;
@ -138,21 +154,18 @@ ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream,
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_is_in_x_range_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_is_in_x_range_wrapper(std::istringstream& str_stream)
{
unsigned int id1, id2;
char c;
str_stream >> c >> id1 >> id2;
bool exp_answer = this->get_expected_boolean(str_stream);
std::cout << "Test: is_in_x_range( " << this->m_xcurves[id1] << ",";
if (c == 'p')
std::cout << this->m_points[id2];
else if (c == 'x')
std::cout << this->m_xcurves[id2];
else
CGAL_error();
if (c == 'p') std::cout << this->m_points[id2];
else if (c == 'x') std::cout << this->m_xcurves[id2];
else CGAL_error();
std::cout << " ) ? " << " ";
bool real_answer = (c == 'p') ?
@ -163,9 +176,9 @@ ta_is_in_x_range_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_y_position_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_y_position_wrapper(std::istringstream& str_stream)
{
unsigned int id1, id2;
str_stream >> id1 >> id2;
@ -179,9 +192,9 @@ ta_compare_y_position_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_is_between_cw_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_is_between_cw_wrapper(std::istringstream& str_stream)
{
unsigned int xcv , b , xcv1 , b1 , xcv2 , b2 , p;
//note that b_ref1 b_ref2 are outputs so they can be tested also
@ -205,9 +218,9 @@ ta_is_between_cw_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_compare_cw_around_point_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_compare_cw_around_point_wrapper(std::istringstream& str_stream)
{
unsigned int xcv1 , b1 , xcv2 , b2 , p , b3;
str_stream >> xcv1 >> b1 >> xcv2 >> b2 >> p >> b3;
@ -231,25 +244,25 @@ ta_compare_cw_around_point_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_are_mergeable_wrapper(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_are_mergeable_wrapper(std::istringstream& str_stream)
{
typedef typename Geom_traits_T::Has_merge_category Has_merge_category;
typedef typename GeomTraits::Has_merge_category Has_merge_category;
return ta_are_mergeable_wrapper_imp(str_stream, Has_merge_category());
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_are_mergeable_wrapper_imp(std::istringstream &, CGAL::Tag_false)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_are_mergeable_wrapper_imp(std::istringstream&, CGAL::Tag_false)
{
CGAL_error();
return false;
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_are_mergeable_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true)
{
unsigned int id1, id2;
str_stream >> id1 >> id2;
@ -263,27 +276,26 @@ ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
return this->compare(exp_answer, real_answer);
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::ta_merge_wrapper
(std::istringstream & str_stream)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::ta_merge_wrapper
(std::istringstream& str_stream)
{
typedef typename Geom_traits_T::Has_merge_category Has_merge_category;
typedef typename GeomTraits::Has_merge_category Has_merge_category;
return ta_merge_wrapper_imp(str_stream, Has_merge_category());
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_merge_wrapper_imp(std::istringstream &, CGAL::Tag_false)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_merge_wrapper_imp(std::istringstream&, CGAL::Tag_false)
{
CGAL_error();
return false;
}
template <typename Geom_traits_T>
bool Traits_adaptor_test<Geom_traits_T>::
ta_merge_wrapper_imp(std::istringstream & str_stream, CGAL::Tag_true)
template <typename GeomTraits, typename BaseGeomTraits>
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
ta_merge_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true)
{
typedef Geom_traits_T Geom_traits;
typedef typename Geom_traits::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Geom_traits::Equal_2 Equal_2;
CGAL_USE_TYPE(Equal_2);

View File

@ -197,7 +197,7 @@ function(run_test_alt name datafile)
set(command ${name} ${datafile} ${ARGN})
string(MAKE_C_IDENTIFIER "${name} ${ARGV4} ${ARGV5}" test_name)
add_test(NAME ${test_name} COMMAND ${command}
WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR})
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set_property(TEST "${test_name}"
APPEND PROPERTY DEPENDS "compilation_of__${name}")
if(POLICY CMP0066) # CMake 3.7 or later
@ -479,6 +479,7 @@ function(execute_commands_traits_adaptor data_dir traits_type_name)
set(commands_indicator_PARAMETER_SPACE_X 0)
set(commands_indicator_PARAMETER_SPACE_Y 0)
set(commands_indicator_COMPARE_XY 0)
set(commands_indicator_COMPARE_X_AT_LIMIT 0)
set(commands_indicator_COMPARE_X_NEAR_LIMIT 0)
set(commands_indicator_COMPARE_X_ON_BOUNDARY 0)
@ -508,6 +509,11 @@ function(execute_commands_traits_adaptor data_dir traits_type_name)
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
data/test_adaptor/${data_dir}/parameter_space_y ${traits_type_name})
endif()
if(commands_indicator_COMPARE_XY)
run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
data/test_adaptor/${data_dir}/compare_xy ${traits_type_name})
endif()
if(commands_indicator_COMPARE_X_AT_LIMIT)
run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
@ -599,7 +605,7 @@ 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
COMPARE_XY COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT
ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW)
endfunction()
@ -615,7 +621,7 @@ 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
COMPARE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT)
endfunction()
@ -632,7 +638,7 @@ 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
COMPARE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT)
endfunction()

View File

@ -0,0 +1 @@
compare_xy 0 8 SMALLER

View File

@ -19,10 +19,10 @@
0 0 1
2 1 0 1 -2 0 0 1
1 -1 1 2 1 0 0 1
1 0 1 2 1 0 0 1
1 1 0 2 1 0 0 1
0 0 1 1 -2 0 0 1
1 -1 1 2 1 0 0 1
1 -1 1 0 0 1 0 1
1 0 1 2 1 0 0 1
1 0 1 0 0 1 0 1
1 1 0 2 1 0 0 1
0 0 1 1 1 0 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -96,15 +94,14 @@ Transform {
aosIsolatedVertexStyle "disc"
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
coord DEF COORD ExactCoordinate {
ratPoint [
0 0 1
1 -2 0
1 -1 1
2 1 0
1 0 1
1 1 0
]
coord DEF COORD EpecCoordinate {
exactPoint [0 0 1
1 -2 0
1 -1 1
2 1 0
1 0 1
1 1 0
]
}
# Pointindex [6 7]
curveIndex [
@ -145,7 +142,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -207,20 +211,13 @@ Transform {
}
]
}
# The axes:
DEF AXES Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -13,6 +13,6 @@
0 0 1
-1 0 -1 -1 -1 0 0 1
-1 -1 0 0 0 1 0 1
0 0 1 -1 2 0 0 1
-1 2 0 -1 0 -1 0 1
0 0 1 -1 2 0 0 1
-1 1 0 0 0 1 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,13 +96,13 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD ExactCoordinate {
ratPoint [-1 0 -1,
-1 -1 0,
0 0 1,
-1 2 0,
-1 1 0
]
coord DEF COORD EpecCoordinate {
exactPoint [-1 0 -1,
-1 -1 0,
0 0 1,
-1 2 0,
-1 1 0
]
}
# Pointindex [6 7]
curveIndex [0 1 1 2 2 3 3 0 4 2]
@ -136,7 +134,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -198,20 +203,13 @@ Transform {
}
]
}
# The axes:
DEF AXES Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -11,6 +11,6 @@
1 -1 0
0 0 1
-1 -1 0 1 -1 0 0 1
0 0 1 -1 -1 0 0 1
-1 -2 1 1 -2 1 0 1
1 -1 0 0 0 1 0 1
0 0 1 -1 -1 0 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,13 +96,13 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD ExactCoordinate {
ratPoint [-1 -1 0
1 -1 0,
0 0 1,
-1 -2 1,
1 -2 1
]
coord DEF COORD EpecCoordinate {
exactPoint [-1 -1 0
1 -1 0,
0 0 1,
-1 -2 1,
1 -2 1
]
}
# Pointindex [6 7]
curveIndex [0 1 1 2 2 0 3 4]
@ -136,7 +134,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -198,20 +203,13 @@ Transform {
}
]
}
# The axes:
DEF AXES Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -10,6 +10,6 @@
1 -1 0
0 0 1
-1 -1 0 1 -1 0 0 1
1 -1 0 0 0 1 0 1
0 0 1 -1 -1 0 0 1
0 0 1 0 -1 1 0 1
1 -1 0 0 0 1 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,12 +96,12 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD ExactCoordinate {
ratPoint [-1 -1 0
1 -1 0,
0 0 1,
0 -1 1
]
coord DEF COORD EpecCoordinate {
exactPoint [-1 -1 0
1 -1 0,
0 0 1,
0 -1 1
]
}
# Pointindex [6 7]
curveIndex [0 1 1 2 2 0 2 3]
@ -135,7 +133,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -197,20 +202,13 @@ Transform {
}
]
}
# The axes:
DEF AXES Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -14,6 +14,6 @@
0 0 1
-1 0 -1 -1 -1 0 0 1
-1 -1 0 0 0 1 0 1
0 0 1 -1 2 0 0 1
-1 2 0 -1 0 -1 0 1
0 0 1 -1 2 0 0 1
-1 1 0 -1 0 0 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,14 +96,14 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0 1
coord DEF COORD ExactCoordinate {
ratPoint [-1 0 -1,
-1 -1 0,
0 0 1,
-1 2 0,
-1 1 0
-1 0 0
]
coord DEF COORD EpecCoordinate {
exactPoint [-1 0 -1,
-1 -1 0,
0 0 1,
-1 2 0,
-1 1 0
-1 0 0
]
}
# Pointindex [6 7]
curveIndex [0 1 1 2 2 3 3 0 4 5]
@ -137,7 +135,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -199,20 +204,13 @@ Transform {
}
]
}
# The axes:
DEF AXES Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -12,8 +12,8 @@
-1 1 0
-2 1 0
0 0 1
0 1 0 -1 1 0 0 1
-1 0 -1 -2 -1 0 0 1
-2 -1 0 0 0 1 0 1
0 0 1 -2 1 0 0 1
0 1 0 -1 1 0 0 1
-2 1 0 -1 0 -1 0 1
0 0 1 -2 1 0 0 1

View File

@ -9,8 +9,6 @@ ColorBackground {
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
fieldOfView 2.96
# radiusScale 0.7
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 1.5 1.5 1.5
bboxSize 2 2 2
children [
Switch {
whichChoice 0
@ -98,13 +96,13 @@ Transform {
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD ExactCoordinate {
ratPoint [-1 0 -1,
-2 -1 0,
0 0 1,
-2 1 0,
0 1 0
-1 1 0
coord DEF COORD EpecCoordinate {
exactPoint [-1 0 -1,
-2 -1 0,
0 0 1,
-2 1 0,
0 1 0
-1 1 0
]
}
# Pointindex [6 7]
@ -137,7 +135,14 @@ Transform {
}
}
Shape {
appearance USE AXES_APP
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
@ -199,20 +204,13 @@ Transform {
}
]
}
# The axes:
DEF AXES Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {

View File

@ -0,0 +1,13 @@
3
0 0 -1 0 -1 -1 0
0 -1 1 0 -1 -1 0
0 0 -1 0 -1 0 0
0
4 3 1
0 0 -1
0 -1 -1
0 -1 0
0 -1 1
0 0 -1 0 -1 -1 0 2
0 -1 -1 0 -1 0 0 2
0 -1 1 0 -1 0 0 1

View File

@ -0,0 +1,267 @@
#VRML V2.0 utf8
Configuration {
accumulation Accumulation { enabled TRUE }
}
ColorBackground {
color 1 1 1 1
clearStencil TRUE
}
NavigationInfo { type [ "EXAMINE" "ANY" ] }
Viewpoint {
type "ORTHOGONAL"
}
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
DEF DRAW_OPAQUE_KEY SingleKeySensor { key "o" }
DEF DRAW_HALOED_KEY SingleKeySensor { key "l" state TRUE }
DEF DRAW_SURFACE_KEY SingleKeySensor { key "b" state TRUE }
DEF EXPORT_KEY SingleKeySensor { key "O" }
DEF SNAP_KEY SingleKeySensor { key "S" }
DEF VERTEX_SHAPE_KEY SingleKeySensor {
key "v"
boolean FALSE
numberOfStates 5
intState 2 # disc
}
DEF EDGE_SHAPE_KEY SingleKeySensor {
key "e"
boolean FALSE
numberOfStates 4
intState 2 # strip
}
DEF HIDE_SINGULARITIES_KEY SingleKeySensor {
boolean FALSE
key "s"
}
DEF HIDE_DISCONTINUITY_KEY SingleKeySensor {
boolean FALSE
key "d"
}
DEF SNAP Snapshot {
image Image { }
fileFormat "jpg"
sequence FALSE
dirName "."
fileName "test07"
}
Transform {
rotation 1 0 0 -1.5708
bboxCenter 0 0 0
bboxSize 2 2 2
children [
Switch {
whichChoice 0
children [
DEF ARRANGMENT Group {
children [
Shape {
drawDepth FALSE
appearance Appearance {
material Material {
diffuseColor 0.5 0.5 0.5
ambientIntensity 0.7
specularColor 0.5 0.5 0.5
}
}
geometry Sphere {
slices 32
stacks 32
}
}
Shape {
appearance Appearance {
material Material {
transparency 0.0001
}
}
geometry DEF GEOM ArrangementOnSphereMarked {
drawSurface FALSE
# drawOpaque TRUE
drawHaloed TRUE
aosEdgeStyle "strip"
aosEdgeRadius 0.03
aosEdgeLineWidth 3
aosVertexStyle "disc"
aosMarkedVertexStyle "none"
aosVertexRadius 0.1
aosVertexPointSize 6
aosIsolatedVertexStyle "disc"
# insertionStrategy "increment"
aosMarkedEdgeIndex 100
aosMarkedVertexIndex 0
coord DEF COORD EpecCoordinate {
exactPoint [0 0 -1, 0 -1 -1,
0 -1 1, 0 -1 -1,
0 0 -1, 0 -1 0
]
}
# Pointindex [6 7]
curveIndex [0 1 2 3 4 5]
}
}
]
}
]
}
# The singularity points:
DEF SINGULARITIES_SWITCH Switch {
whichChoice 0
children [
Group {
children [
Shape {
appearance DEF BOUNDARY_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.8 0.8 0.8
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 1
radius 0.05
}
}
Shape {
appearance DEF AXES_APP Appearance {
material Material {
# ambientIntensity 1
diffuseColor 0.4 0.4 0.4
# specularColor 0.3 0.3 0.3
# transparency 0.0001
}
}
geometry Sphere {
center 0 0 -1
radius 0.05
}
}
]
}
]
}
# The discontinuity arc:
DEF DISCONTINUITY_SWITCH Switch {
whichChoice 0
children [
Shape {
appearance USE BOUNDARY_APP
geometry Extrusion {
creaseAngle 2.0
beginCap TRUE
endCap TRUE
loop FALSE
crossSectionRadius 0.025
spine [
0 0 1,
-0.0980171 0 0.995185,
-0.19509 0 0.980785,
-0.290285 0 0.95694,
-0.382683 0 0.92388,
-0.471397 0 0.881921,
-0.55557 0 0.83147,
-0.634393 0 0.77301,
-0.707107 0 0.707107,
-0.77301 0 0.634393,
-0.83147 0 0.55557,
-0.881921 0 0.471397,
-0.92388 0 0.382683,
-0.95694 0 0.290285,
-0.980785 0 0.19509,
-0.995185 0 0.0980171,
-1 0 0,
-0.995185 0 -0.0980171,
-0.980785 0 -0.19509,
-0.95694 0 -0.290285,
-0.92388 0 -0.382683,
-0.881921 0 -0.471397,
-0.83147 0 -0.55557,
-0.77301 0 -0.634393,
-0.707107 0 -0.707107,
-0.634393 0 -0.77301,
-0.55557 0 -0.83147,
-0.471397 0 -0.881921,
-0.382683 0 -0.92388,
-0.290285 0 -0.95694,
-0.19509 0 -0.980785,
-0.0980171 0 -0.995185,
0 0 -1,
]
}
}
]
}
# The axes:
DEF AXES Transform {
scale 0.1 0.1 0.1
children [
Shape {
appearance USE AXES_APP
geometry Sphere { radius 0.1 }
}
DEF CS_AXIS Transform {
translation 0 1.5 0
children [
Shape {
appearance USE AXES_APP
geometry Cylinder {
radius 0.1
height 3
set_is_bottom_visible FALSE
set_is_top_visible FALSE
}
}
Transform {
translation 0 1.7 0
children [
Shape {
appearance USE AXES_APP
geometry Cone {
bottomRadius 0.2
height 0.4
}
}
]
}
]
}
Transform {
rotation 0 0 -1 1.57
children [ USE CS_AXIS ]
}
Transform {
rotation 1 0 0 1.57
children [ USE CS_AXIS ]
}
]
}
# Transform {
# translation 2 0 0
# children [
# USE ARRANGMENT
# ]
# }
]
}
ROUTE DRAW_OPAQUE_KEY.state TO GEOM.drawOpaque
ROUTE DRAW_HALOED_KEY.state TO GEOM.drawHaloed
ROUTE SNAP_KEY.state TO SNAP.trigger
# ROUTE EXPORT_KEY.press TO GEOM.export
ROUTE HIDE_DISCONTINUITY_KEY.intState TO DISCONTINUITY_SWITCH.whichChoice
ROUTE HIDE_SINGULARITIES_KEY.intState TO SINGULARITIES_SWITCH.whichChoice
ROUTE VERTEX_SHAPE_KEY.intState TO GEOM.aosVertexStyleId
ROUTE EDGE_SHAPE_KEY.intState TO GEOM.aosEdgeStyleId

View File

@ -8,7 +8,7 @@ r 0 0 0 1
3
0 0
0 1
s 0 0 0 1 1
r 0 0 1 0 1
s 0 0 0 1 1
r 0 1 1 1 1
r 0 1 0 2 1

View File

@ -5,3 +5,4 @@
./data/test_construction/geodesic_arcs_on_sphere/test05.txt
./data/test_construction/geodesic_arcs_on_sphere/test06.txt
./data/test_construction/geodesic_arcs_on_sphere/test07.txt
./data/test_construction/geodesic_arcs_on_sphere/test08.txt

View File

@ -11,7 +11,7 @@
int main (int argc, char * argv[])
{
Geom_traits traits;
Traits_adaptor_test<Geom_traits> test(traits);
Traits_adaptor_test<Geom_traits, Base_geom_traits> test(traits);
if (!test.parse(argc, argv)) return -1;
if (!test.init()) return -1;
if (!test.perform()) return -1;

View File

@ -5,7 +5,7 @@
#include "test_geom_traits.h"
typedef CGAL::Arr_traits_basic_adaptor_2<Base_geom_traits> Geom_traits;
typedef CGAL::Arr_traits_adaptor_2<Base_geom_traits> Geom_traits;
typedef Geom_traits::Point_2 Point_2;
typedef Geom_traits::Curve_2 Curve_2;
typedef Geom_traits::X_monotone_curve_2 X_monotone_curve_2;

View File

@ -3,6 +3,7 @@
#include <CGAL/enum.h>
#include <CGAL/Arr_enums.h>
#include <CGAL/Arr_tags.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/disable_warnings.h>
@ -103,32 +104,25 @@ private:
}
};
template <typename T_Geom_traits>
template <typename GeomTraits>
class Curve_compare {
private:
typedef T_Geom_traits Traits;
typedef GeomTraits Geom_traits;
const Traits& m_traits;
const Geom_traits& m_traits;
public:
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Traits::Point_2 Point_2;
typedef typename Geom_traits::X_monotone_curve_2 X_monotone_curve_2;
Curve_compare(const Traits& traits) : m_traits(traits) {}
Curve_compare(const Geom_traits& traits) : m_traits(traits) {}
bool operator()(const X_monotone_curve_2& c1, const X_monotone_curve_2& c2)
{
const Point_2& c1_left = m_traits.construct_min_vertex_2_object()(c1);
const Point_2& c2_left = m_traits.construct_min_vertex_2_object()(c2);
CGAL::Comparison_result res =
m_traits.compare_xy_2_object()(c1_left, c2_left);
if (res == CGAL::SMALLER) return true;
if (res == CGAL::LARGER) return false;
CGAL_assertion(res == CGAL::EQUAL);
res = m_traits.compare_y_at_x_right_2_object()(c1, c2, c1_left);
return (res == CGAL::SMALLER) ? true : false;
typedef CGAL::Arr_traits_adaptor_2<Geom_traits> Geom_traits_adaptor;
Geom_traits_adaptor geom_traits_adapter(m_traits);
typedef typename Geom_traits_adaptor::Compare_xy_2 Compare_xy_2;
Compare_xy_2 cmp_xy = geom_traits_adapter.compare_xy_2_object();
return (CGAL::SMALLER == cmp_xy(c1, c2));
}
};

View File

@ -708,6 +708,7 @@ user might encounter.
## I/O Functions ##
- \link PkgBGLIOFct CGAL::read_off() \endlink
- \link PkgBGLIOFct CGAL::write_off() \endlink
- \link PkgBGLIOFct CGAL::write_wrl() \endlink
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -4,7 +4,7 @@
project( BGL_LCC_Examples )
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.1)
# CGAL and its components
find_package( CGAL QUIET COMPONENTS )
@ -16,10 +16,6 @@ if ( NOT CGAL_FOUND )
endif()
# include helper file
include( ${CGAL_USE_FILE} )
# Boost and its components
find_package( Boost REQUIRED )
@ -32,14 +28,10 @@ if ( NOT Boost_FOUND )
endif()
# include for local directory
include_directories( BEFORE ../../include )
# Creating entries for all C++ files with "main" routine
# ##########################################################
include( CGAL_CreateSingleSourceCGALProgram )
# create a target per cppfile
file(GLOB_RECURSE cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(cppfile ${cppfiles})

View File

@ -15,11 +15,11 @@ typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
typedef boost::graph_traits<LCC>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator;
int main(int, char** argv)
int main(int argc, char** argv)
{
LCC lcc;
CGAL::read_off(argv[1], lcc);
CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc);
// This is the vector where the distance gets written to
std::vector<int> distance(lcc.vertex_attributes().size());

View File

@ -46,10 +46,10 @@ OutputIterator adjacent_vertices_V2(const LCC& g,
}
int main(int, char** argv)
int main(int argc, char** argv)
{
LCC lcc;
CGAL::read_off(argv[1], lcc);
CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc);
GraphTraits::vertex_iterator vi = vertices(lcc).first;
std::list<vertex_descriptor> V;

View File

@ -63,13 +63,13 @@ void calculate_face_normals(const HalfedgeGraph& g,
}
}
int main(int, char** argv)
int main(int argc, char** argv)
{
typedef boost::property_map<LCC, CGAL::face_index_t>::const_type
Face_index_map;
LCC lcc;
CGAL::read_off(argv[1], lcc);
CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc);
// Ad hoc property_map to store normals. Face_index_map is used to
// map face_descriptors to a contiguous range of indices. See

View File

@ -55,10 +55,10 @@ void fct(const LCC& lcc)
std::for_each(vb,ve, Fct());
}
int main(int, char** argv)
int main(int argc, char** argv)
{
LCC lcc;
CGAL::read_off(argv[1], lcc);
CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc);
fct(lcc);
return 0;

View File

@ -38,10 +38,10 @@ struct Source {
}
};
int main(int, char** argv)
int main(int argc, char** argv)
{
LCC lcc;
CGAL::read_off(argv[1], lcc);
CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc);
GraphTraits::vertex_descriptor vd = *(vertices(lcc).first);
typedef boost::transform_iterator<Source<LCC>,halfedge_around_target_iterator> adjacent_vertex_iterator;

View File

@ -4,7 +4,7 @@
project( BGL_OpenMesh_Examples )
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.1)
# CGAL and its components
find_package( CGAL QUIET COMPONENTS )
@ -16,10 +16,6 @@ if ( NOT CGAL_FOUND )
endif()
# include helper file
include( ${CGAL_USE_FILE} )
# Boost and its components
find_package( Boost REQUIRED )
@ -45,14 +41,10 @@ endif()
# include for local directory
# include for local package
include_directories( BEFORE ../../include )
# Creating entries for all C++ files with "main" routine
# ##########################################################
include( CGAL_CreateSingleSourceCGALProgram )
if(OpenMesh_FOUND)
create_single_source_cgal_program( "TriMesh.cpp" )
target_link_libraries( TriMesh PRIVATE ${OPENMESH_LIBRARIES} )

View File

@ -1,17 +1,11 @@
project( BGL_arrangement_2_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})

View File

@ -4,7 +4,7 @@
project( BGL_polyhedron_3_Examples )
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.1)
# CGAL and its components
find_package( CGAL QUIET COMPONENTS )
@ -16,10 +16,6 @@ if ( NOT CGAL_FOUND )
endif()
# include helper file
include( ${CGAL_USE_FILE} )
# Boost and its components
find_package( Boost REQUIRED )
@ -51,14 +47,10 @@ endif()
# include for local directory
# include for local package
include_directories( BEFORE ../../include )
# Creating entries for all C++ files with "main" routine
# ##########################################################
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "distance.cpp" )
create_single_source_cgal_program( "incident_vertices.cpp" )

View File

@ -15,10 +15,10 @@ typedef boost::graph_traits<Polyhedron>::vertex_iterator vertex_iterator;
int main(int, char** argv) {
int main(int argc, char** argv) {
Polyhedron P;
std::ifstream in(argv[1]);
std::ifstream in((argc>1)?argv[1]:"cube.off");
in >> P ;
// associate indices to the vertices using the "id()" field of the vertex.

View File

@ -44,9 +44,9 @@ adjacent_vertices_V2(const Polyhedron& g,
}
int main(int, char** argv)
int main(int argc, char** argv)
{
std::ifstream in(argv[1]);
std::ifstream in((argc>1)?argv[1]:"cube.off");
Polyhedron P;
in >> P;
GraphTraits::vertex_iterator vi = vertices(P).first;

View File

@ -63,14 +63,14 @@ void calculate_face_normals(const HalfedgeGraph& g,
}
}
int main(int, char** argv)
int main(int argc, char** argv)
{
typedef boost::property_map<
Polyhedron,
CGAL::face_index_t
>::const_type Face_index_map;
std::ifstream in(argv[1]);
std::ifstream in((argc>1)?argv[1]:"cube.off");
Polyhedron P;
in >> P ;

View File

@ -55,10 +55,10 @@ void fct(const Polyhedron& p)
std::for_each(vb,ve, Fct());
}
int main(int, char** argv)
int main(int argc, char** argv)
{
Polyhedron P;
std::ifstream in(argv[1]);
std::ifstream in((argc>1)?argv[1]:"cube.off");
in >> P ;
fct(P);

View File

@ -37,9 +37,9 @@ struct Source {
}
};
int main(int, char** argv)
int main(int argc, char** argv)
{
std::ifstream in(argv[1]);
std::ifstream in((argc>1)?argv[1]:"cube.off");
Polyhedron P;
in >> P;
GraphTraits::vertex_descriptor vd = *(vertices(P).first);

View File

@ -1,6 +1,6 @@
project( BGL_surface_mesh_Examples )
cmake_minimum_required( VERSION 2.8.10 )
cmake_minimum_required(VERSION 3.1)
find_package( CGAL QUIET )
@ -9,12 +9,7 @@ if ( NOT CGAL_FOUND )
return()
endif()
include( ${CGAL_USE_FILE} )
# include for local package
include_directories( BEFORE "../../include" )
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "prim.cpp" )
create_single_source_cgal_program( "gwdwg.cpp" )

View File

@ -25,10 +25,10 @@ int main()
Point_3(1,-1,-1),
Point_3(1,1,-1),
Point_3(-1,1,-1),
Point_3(-1,1,1),
Point_3(-1,-1,1),
Point_3(1,-1,1),
Point_3(1,1,1),
Point_3(-1,1,1),
sm
);
@ -45,10 +45,10 @@ int main()
Point_3(0.5,-0.5,-0.5),
Point_3(0.5,0.5,-0.5),
Point_3(-0.5,0.5,-0.5),
Point_3(-0.5,0.5,0.5),
Point_3(-0.5,-0.5,0.5),
Point_3(0.5,-0.5,0.5),
Point_3(0.5,0.5,0.5),
Point_3(-0.5,0.5,0.5),
poly
);
pvertex_descriptor pvd = * vertices(pmesh).first;

View File

@ -13,11 +13,11 @@ typedef CGAL::Surface_mesh<Point> Mesh;
typedef boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
int main(int, char* argv[])
int main(int argc, char* argv[])
{
Mesh P;
//std::cin >> P;
std::ifstream in(argv[1]);
std::ifstream in((argc>1)?argv[1]:"data/prim.off");
in >> P;
Mesh::Property_map<vertex_descriptor,vertex_descriptor> predecessor;
predecessor = P.add_property_map<vertex_descriptor,vertex_descriptor>("v:predecessor").first;

View File

@ -1,24 +1,17 @@
project( BGL_triangulation_2_Examples )
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program( "${cppfile}" )
endforeach()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")

View File

@ -585,8 +585,16 @@ add_face(const VertexRange& vr, Graph& g)
std::vector<vertex_descriptor> vertices(vr.begin(), vr.end()); // quick and dirty copy
unsigned int n = (unsigned int)vertices.size();
//check that every vertex is unique
std::sort(vertices.begin(), vertices.end());
if(std::adjacent_find(vertices.begin(), vertices.end()) != vertices.end()){
return boost::graph_traits<Graph>::null_face();
}
std::copy(vr.begin(), vr.end(), vertices.begin());
// don't allow degenerated faces
CGAL_assertion(n > 2);
if(n <= 2){
return boost::graph_traits<Graph>::null_face();
}
std::vector<halfedge_descriptor> halfedges(n);
std::vector<bool> is_new(n);

View File

@ -129,7 +129,7 @@ struct Face_filtered_graph
* a property map containing an index for each face initialized from 0 to `num_vertices(graph)`
* \cgalParamEnd
* \cgalParamBegin{vertex_index_map}
* a property map containing an index for each vertex initialized 0 to `num_vertices(vertex)`
* a property map containing an index for each vertex initialized 0 to `num_vertices(graph)`
* \cgalParamEnd
* \cgalParamBegin{halfedge_index_map}
* a property map containing an index for each halfedge initialized 0 to `num_halfedges(graph)`
@ -189,7 +189,7 @@ struct Face_filtered_graph
* a property map containing an index for each face initialized from 0 to `num_vertices(graph)`
* \cgalParamEnd
* \cgalParamBegin{vertex_index_map}
* a property map containing an index for each vertex initialized 0 to `num_vertices(vertex)`
* a property map containing an index for each vertex initialized 0 to `num_vertices(graph)`
* \cgalParamEnd
* \cgalParamBegin{halfedge_index_map}
* a property map containing an index for each halfedge initialized 0 to `num_halfedges(graph)`
@ -236,7 +236,7 @@ struct Face_filtered_graph
* a property map containing an index for each face initialized from 0 to `num_vertices(graph)`
* \cgalParamEnd
* \cgalParamBegin{vertex_index_map}
* a property map containing an index for each vertex initialized 0 to `num_vertices(vertex)`
* a property map containing an index for each vertex initialized 0 to `num_vertices(graph)`
* \cgalParamEnd
* \cgalParamBegin{halfedge_index_map}
* a property map containing an index for each halfedge initialized 0 to `num_halfedges(graph)`

View File

@ -36,12 +36,15 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/tuple/tuple.hpp>
#include <cstdlib>
namespace CGAL {
namespace METIS {
template<typename TriangleMesh, typename METIS_options, typename NamedParameters>
void partition_dual_graph(const TriangleMesh& tm, int nparts,
void partition_dual_graph(const TriangleMesh& tm,
int nparts,
METIS_options options, // options array
const NamedParameters& np)
{
@ -93,11 +96,11 @@ void partition_dual_graph(const TriangleMesh& tm, int nparts,
idx_t objval;
// partition info for the nodes
idx_t* npart = (idx_t*) calloc(nn, sizeof(idx_t));
idx_t* npart = (idx_t*) calloc(num_vertices(tm), sizeof(idx_t));
CGAL_assertion(npart != NULL);
// partition info for the elements
idx_t* epart = (idx_t*) calloc(ne, sizeof(idx_t));
idx_t* epart = (idx_t*) calloc(num_faces(tm), sizeof(idx_t));
CGAL_assertion(epart != NULL);
// do not support Fortran-style arrays
@ -118,6 +121,12 @@ void partition_dual_graph(const TriangleMesh& tm, int nparts,
Output_face_partition_ids fo;
vo(tm, indices, npart, get_param(np, internal_np::vertex_partition_id));
fo(tm, epart, get_param(np, internal_np::face_partition_id));
delete[] eptr;
delete[] eind;
std::free(npart);
std::free(epart);
}
template<typename TriangleMesh, typename NamedParameters>

View File

@ -34,6 +34,8 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/tuple/tuple.hpp>
#include <cstdlib>
namespace CGAL {
namespace METIS {
@ -76,7 +78,8 @@ struct Output_face_partition_ids
};
template<typename TriangleMesh, typename METIS_options, typename NamedParameters>
void partition_graph(const TriangleMesh& tm, int nparts,
void partition_graph(const TriangleMesh& tm,
int nparts,
METIS_options options, // pointer to the options array
const NamedParameters& np)
{
@ -125,11 +128,11 @@ void partition_graph(const TriangleMesh& tm, int nparts,
idx_t objval;
// partition info for the nodes
idx_t* npart = (idx_t*) calloc(nn, sizeof(idx_t));
idx_t* npart = (idx_t*) calloc(num_vertices(tm), sizeof(idx_t));
CGAL_assertion(npart != NULL);
// partition info for the elements
idx_t* epart = (idx_t*) calloc(ne, sizeof(idx_t));
idx_t* epart = (idx_t*) calloc(num_faces(tm), sizeof(idx_t));
CGAL_assertion(epart != NULL);
// do not support Fortran-style arrays
@ -150,6 +153,12 @@ void partition_graph(const TriangleMesh& tm, int nparts,
Output_face_partition_ids fo;
vo(tm, indices, npart, get_param(np, internal_np::vertex_partition_id));
fo(tm, epart, get_param(np, internal_np::face_partition_id));
delete[] eptr;
delete[] eind;
std::free(npart);
std::free(epart);
}
template<typename TriangleMesh, typename NamedParameters>

View File

@ -837,6 +837,8 @@ make_quad(const P& p0, const P& p1, const P& p2, const P& p3, Graph& g)
* \ingroup PkgBGLHelperFct
* \brief Creates an isolated hexahedron
* with its vertices initialized to `p0`, `p1`, ...\ , and `p7`, and adds it to the graph `g`.
* \image html hexahedron.png
* \image latex hexahedron.png
* \returns the halfedge that has the target vertex associated with `p0`, in the face with the vertices with the points `p0`, `p1`, `p2`, and `p3`.
**/
template<typename Graph, typename P>
@ -868,16 +870,16 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3,
ppmap[v6] = p6;
ppmap[v7] = p7;
halfedge_descriptor ht = internal::make_quad(v7, v4, v5, v6, g);
halfedge_descriptor hb = prev(internal::make_quad(v1, v0, v3, v2, g),g);
halfedge_descriptor ht = internal::make_quad(v4, v5, v6, v7, g);
halfedge_descriptor hb = prev(internal::make_quad(v0, v3, v2, v1, g),g);
for(int i=0; i <4; i++){
halfedge_descriptor h = halfedge(add_edge(g),g);
set_target(h,target(hb,g),g);
set_next(h,opposite(hb,g),g);
set_next(opposite(next(ht,g),g),h,g);
set_next(opposite(prev(ht,g),g),h,g);
h = opposite(h,g);
set_target(h,target(ht,g),g);
set_next(h,opposite(ht,g),g);
set_target(h,source(prev(ht,g),g),g);
set_next(h,opposite(next(next(ht,g),g),g),g);
set_next(opposite(next(hb,g),g),h,g);
hb = next(hb,g);
ht = prev(ht,g);
@ -892,6 +894,8 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3,
* \ingroup PkgBGLHelperFct
* \brief Creates an isolated tetrahedron
* with its vertices initialized to `p0`, `p1`, `p2`, and `p3`, and adds it to the graph `g`.
* \image html tetrahedron.png
* \image latex tetrahedron.png
* \returns the halfedge that has the target vertex associated with `p0`, in the face with the vertices with the points `p0`, `p1`, and `p2`.
**/
template<typename Graph, typename P>
@ -1081,7 +1085,7 @@ make_regular_prism(
* \ingroup PkgBGLHelperFct
* \brief Creates a pyramid, outward oriented, having `nb_vertices` vertices in its base and adds it to the graph `g`.
*
* If `center` is (0, 0, 0), then the first point of the base is (`radius`, 0`, 0)
* If `center` is `(0, 0, 0)`, then the first point of the base is `(radius, 0, 0)`
* \param nb_vertices the number of vertices in the base. It must be greater than or equal to 3.
* \param g the graph in which the pyramid will be created
* \param base_center the center of the circle in which the base is inscribed.

View File

@ -36,6 +36,89 @@
#include <CGAL/boost/graph/named_function_params.h>
namespace CGAL {
/*!
\ingroup PkgBGLIOFct
writes the graph `g` in the wrl format (VRML 2.0).
\cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
* \cgalNamedParamsEnd
*/
template <typename FaceGraph, typename NamedParameters>
bool write_wrl(std::ostream& os,
const FaceGraph& g,
const NamedParameters& np)
{
typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
typedef typename boost::graph_traits<FaceGraph>::vertices_size_type vertices_size_type;
typename Polygon_mesh_processing::GetVertexPointMap<FaceGraph, NamedParameters>::const_type
vpm = choose_param(get_param(np, internal_np::vertex_point),
get_const_property_map(CGAL::vertex_point, g));
boost::container::flat_map<vertex_descriptor,vertices_size_type> reindex;
int n = 0;
os << "#VRML V2.0 utf8\n"
"Group {\n"
"children [\n"
"Shape {\n"
"appearance DEF A1 Appearance {\n"
"material Material {\n"
"diffuseColor .6 .5 .9\n"
"}\n"
"}\n"
"appearance\n"
"Appearance {\n"
"material DEF Material Material {}\n"
"}\n"
"}\n"
"Group {\n"
"children [\n"
"Shape {\n"
"appearance Appearance { material USE Material }\n"
"geometry IndexedFaceSet {\n"
"convex FALSE\n"
"solid FALSE\n"
"coord Coordinate {\n"
"point [\n";
BOOST_FOREACH(vertex_descriptor v, vertices(g)){
os << get(vpm,v) << ",\n";
reindex[v]=n++;
}
os << "] #point\n"
"} #coord Coordinate\n"
"coordIndex [\n";
BOOST_FOREACH(face_descriptor f, faces(g)){
BOOST_FOREACH(vertex_descriptor v, vertices_around_face(halfedge(f,g),g)){
os << reindex[v] << ",";
}
os << "-1,\n";
}
os << "] #coordIndex\n"
"} #geometry\n"
"} #Shape\n"
"] #children\n"
"} #group\n"
"]\n"
"}\n";
return os.good();
}
template <typename FaceGraph>
bool write_wrl(std::ostream& os,
const FaceGraph& g)
{
return write_wrl(os, g,
parameters::all_default());
}
/*!
\ingroup PkgBGLIOFct
writes the graph `g` in the OFF format.

View File

@ -325,11 +325,17 @@ namespace CGAL {
template<typename PointRange, typename NamedParameters>
class GetK
{
typedef typename boost::property_traits<
typename GetPointMap<PointRange, NamedParameters>::type
>::value_type Point;
typedef typename GetPointMap<PointRange, NamedParameters>::type Vpm;
typedef typename Kernel_traits<
typename boost::property_traits<Vpm>::value_type
>::Kernel Default_kernel;
public:
typedef typename CGAL::Kernel_traits<Point>::Kernel Kernel;
typedef typename boost::lookup_named_param_def <
internal_np::geom_traits_t,
NamedParameters,
Default_kernel
> ::type Kernel;
};
template<typename PointRange, typename NamedParameters>
@ -399,6 +405,29 @@ namespace CGAL {
> ::type type;
};
template<typename PointRange, typename NamedParameters>
class GetIsConstrainedMap
{
struct DummyConstrainedMap
{
typedef typename std::iterator_traits<typename PointRange::iterator>::value_type key_type;
typedef bool value_type;
typedef value_type reference;
typedef boost::readable_property_map_tag category;
typedef DummyConstrainedMap Self;
friend reference get(const Self&, const key_type&) { return false; }
};
public:
typedef DummyConstrainedMap NoMap;
typedef typename boost::lookup_named_param_def <
internal_np::point_is_constrained_t,
NamedParameters,
DummyConstrainedMap //default
> ::type type;
};
} // namespace Point_set_processing_3
template<typename NamedParameters, typename DefaultSolver>

View File

@ -117,3 +117,4 @@ CGAL_add_named_parameter(plane_t, plane_map, plane_map)
CGAL_add_named_parameter(plane_index_t, plane_index_map, plane_index_map)
CGAL_add_named_parameter(select_percentage_t, select_percentage, select_percentage)
CGAL_add_named_parameter(require_uniform_sampling_t, require_uniform_sampling, require_uniform_sampling)
CGAL_add_named_parameter(point_is_constrained_t, point_is_constrained, point_is_constrained_map)

View File

@ -4,7 +4,7 @@
project( BGL_Tests )
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.1)
@ -18,10 +18,6 @@ if ( NOT CGAL_FOUND )
endif()
# include helper file
include( ${CGAL_USE_FILE} )
# Boost and its components
find_package( Boost )
@ -42,13 +38,10 @@ endif()
# include for local package
include_directories( BEFORE ../../include )
# Creating entries for all .cpp/.C files with "main" routine
# ##########################################################
include( CGAL_CreateSingleSourceCGALProgram )
if(OpenMesh_FOUND)
create_single_source_cgal_program( "graph_concept_OpenMesh.cpp" )
target_link_libraries( graph_concept_OpenMesh PRIVATE ${OPENMESH_LIBRARIES} )
@ -104,6 +97,8 @@ create_single_source_cgal_program( "test_graph_traits.cpp" )
create_single_source_cgal_program( "test_Properties.cpp" )
create_single_source_cgal_program( "test_wrl.cpp" )
if(OpenMesh_FOUND)
target_link_libraries( test_clear PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries( test_Euler_operations PRIVATE ${OPENMESH_LIBRARIES})

View File

@ -30,7 +30,7 @@ typedef CGAL::Halfedge_around_target_iterator<Polyhedron> halfedge_around_target
typedef CGAL::Halfedge_around_face_iterator<Polyhedron> halfedge_around_face_iterator;
typedef CGAL::Face_around_face_iterator<Polyhedron> face_around_face_iterator;
typedef CGAL::Vertex_around_target_iterator<Polyhedron> vertex_around_target_iterator;
int main(int, char* argv[])
int main(int argc, char* argv[])
{
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_face_circulator>)) CGAL_UNUSED;
@ -49,7 +49,7 @@ int main(int, char* argv[])
BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator<in_edge_iterator>)) CGAL_UNUSED;
BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator<out_edge_iterator>)) CGAL_UNUSED;
std::ifstream in(argv[1]);
std::ifstream in((argc>1)?argv[1]:"data/cube.off");
Polyhedron P;
in >> P;

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