Merge branch 'releases/CGAL-4.14-branch'

This commit is contained in:
Laurent Rineau 2019-07-03 11:18:20 +02:00
commit c0ba28f80a
20 changed files with 244 additions and 99 deletions

View File

@ -46,15 +46,14 @@ MA 02110-1301, USA. */
#include <string>
#include <cstdio>
using namespace std;
namespace CORE {
CGAL_INLINE_FUNCTION
int
__gmp_istream_set_base (istream &i, char &c, bool &zero, bool &showbase)
__gmp_istream_set_base (std::istream &i, char &c, bool &zero, bool &showbase)
{
int base;
using std::ios;
zero = showbase = false;
switch (i.flags() & ios::basefield)
@ -96,7 +95,7 @@ __gmp_istream_set_base (istream &i, char &c, bool &zero, bool &showbase)
CGAL_INLINE_FUNCTION
void
__gmp_istream_set_digits (string &s, istream &i, char &c, bool &ok, int base)
__gmp_istream_set_digits (std::string &s, std::istream &i, char &c, bool &ok, int base)
{
switch (base)
{
@ -131,13 +130,14 @@ __gmp_istream_set_digits (string &s, istream &i, char &c, bool &ok, int base)
}
CGAL_INLINE_FUNCTION
istream &
//operator>> (istream &i, mpz_ptr z)
io_read (istream &i, mpz_ptr z)
std::istream &
//operator>> (std::istream &i, mpz_ptr z)
io_read (std::istream &i, mpz_ptr z)
{
using namespace std;
int base;
char c = 0;
string s;
std::string s;
bool ok = false, zero, showbase;
i.get(c); // start reading
@ -175,13 +175,14 @@ io_read (istream &i, mpz_ptr z)
}
CGAL_INLINE_FUNCTION
istream &
//operator>> (istream &i, mpq_ptr q)
io_read (istream &i, mpq_ptr q)
std::istream &
//operator>> (std::istream &i, mpq_ptr q)
io_read (std::istream &i, mpq_ptr q)
{
using namespace std;
int base;
char c = 0;
string s;
std::string s;
bool ok = false, zero, showbase;
i.get(c); // start reading
@ -253,9 +254,9 @@ io_read (istream &i, mpq_ptr q)
}
CGAL_INLINE_FUNCTION
ostream&
//operator<< (ostream &o, mpz_srcptr z)
io_write (ostream &o, mpz_srcptr z)
std::ostream&
//operator<< (std::ostream &o, mpz_srcptr z)
io_write (std::ostream &o, mpz_srcptr z)
{
char *str = new char [mpz_sizeinbase(z,10) + 2];
str = mpz_get_str(str, 10, z);
@ -265,9 +266,9 @@ io_write (ostream &o, mpz_srcptr z)
}
CGAL_INLINE_FUNCTION
ostream&
//operator<< (ostream &o, mpq_srcptr q)
io_write (ostream &o, mpq_srcptr q)
std::ostream&
//operator<< (std::ostream &o, mpq_srcptr q)
io_write (std::ostream &o, mpq_srcptr q)
{
// size according to GMP documentation
char *str = new char [mpz_sizeinbase(mpq_numref(q), 10) +

View File

@ -65,7 +65,6 @@
#include <CGAL/tss.h>
namespace CORE {
using namespace std;
class Expr;
// ==================================================
// Typedefs
@ -117,25 +116,25 @@ public:
Polynomial(const Polynomial &);
Polynomial(const VecNT &);
Polynomial(int n, const char* s[]);
Polynomial(const string & s, char myX='x');
Polynomial(const std::string & s, char myX='x');
Polynomial(const char* s, char myX='x');
~Polynomial();
private:
void constructX(int n, Polynomial<NT>& P);
void constructFromString(string & s, char myX='x');
void constructFromString(std::string & s, char myX='x');
int getnumber(const char* c, int i, unsigned int len, Polynomial<NT> & P);
bool isint(char c);
int getint(const char* c, int i, unsigned int len, int & n);
int matchparen(const char* cstr, int start);
int getbasicterm(string & s, Polynomial<NT> & P);
int getterm(string & s, Polynomial<NT> & P);
int getbasicterm(std::string & s, Polynomial<NT> & P);
int getterm(std::string & s, Polynomial<NT> & P);
public:
//Returns a Polynomial corresponding to s, which is supposed to
//contain as place-holders the chars 'x' and 'y'.
Polynomial<NT> getpoly(string & s);
Polynomial<NT> getpoly(std::string & s);
// Assignment:
Polynomial & operator=(const Polynomial&);

View File

@ -131,21 +131,21 @@ Polynomial<NT>::Polynomial(int n, const char * s[]) {
// want to generalize this to BigFloat, etc.
//
template <class NT>
Polynomial<NT>::Polynomial(const string & s, char myX) {
string ss(s);
Polynomial<NT>::Polynomial(const std::string & s, char myX) {
std::string ss(s);
constructFromString(ss, myX);
}
template <class NT>
Polynomial<NT>::Polynomial(const char * s, char myX) {
string ss(s);
std::string ss(s);
constructFromString(ss, myX);
}
template <class NT>
void Polynomial<NT>::constructFromString(string & s, char myX) {
void Polynomial<NT>::constructFromString(std::string & s, char myX) {
if(myX != 'x' || myX != 'X'){
//Replace myX with 'x'.
string::size_type loc = s.find(myX, 0);
while(loc != string::npos){
std::string::size_type loc = s.find(myX, 0);
while(loc != std::string::npos){
s.replace(loc,1,1,'x');
loc = s.find(myX, loc+1);
}
@ -241,7 +241,7 @@ int Polynomial<NT>::matchparen(const char* cstr, int start){
template <class NT>
int Polynomial<NT>::getbasicterm(string & s, Polynomial<NT> & P){
int Polynomial<NT>::getbasicterm(std::string & s, Polynomial<NT> & P){
const char * cstr = s.c_str();
unsigned int len = s.length();
int i=0;
@ -254,7 +254,7 @@ int Polynomial<NT>::getbasicterm(string & s, Polynomial<NT> & P){
}else if(cstr[i] =='('){
int oldi = i;
i = matchparen(cstr, i);
string t = s.substr(oldi+1, i -oldi -1);
std::string t = s.substr(oldi+1, i -oldi -1);
P = getpoly(t);
}else{
#ifdef CGAL_CORE_TRACE
@ -272,7 +272,7 @@ int Polynomial<NT>::getbasicterm(string & s, Polynomial<NT> & P){
template <class NT>
int Polynomial<NT>::getterm(string & s, Polynomial<NT> & P){
int Polynomial<NT>::getterm(std::string & s, Polynomial<NT> & P){
unsigned int len = s.length();
if(len == 0){// Zero Polynomial
P=Polynomial<NT>();
@ -280,7 +280,7 @@ int Polynomial<NT>::getterm(string & s, Polynomial<NT> & P){
}
unsigned int ind, oind;
const char* cstr =s.c_str();
string t;
std::string t;
//P will be used to accumulate the product of basic terms.
ind = getbasicterm(s, P);
while(ind != len-1 && cstr[ind + 1]!='+' && cstr[ind + 1]!='-' ){
@ -304,11 +304,11 @@ int Polynomial<NT>::getterm(string & s, Polynomial<NT> & P){
}
template <class NT>
Polynomial<NT> Polynomial<NT>::getpoly(string & s){
Polynomial<NT> Polynomial<NT>::getpoly(std::string & s){
//Remove white spaces from the string
string::size_type cnt=s.find(' ',0);
while(cnt != string::npos){
std::string::size_type cnt=s.find(' ',0);
while(cnt != std::string::npos){
s.erase(cnt, 1);
cnt = s.find(' ', cnt);
}
@ -321,10 +321,10 @@ Polynomial<NT> Polynomial<NT>::getpoly(string & s){
//To handle the case when there is one '=' sign
//Suppose s is of the form s1 = s2. Then we assign s to
//s1 + (-1)(s2) and reset len
string::size_type loc;
if((loc=s.find('=',0)) != string::npos){
std::string::size_type loc;
if((loc=s.find('=',0)) != std::string::npos){
s.replace(loc,1,1,'+');
string s3 = "(-1)(";
std::string s3 = "(-1)(";
s.insert(loc+1, s3);
len = s.length();
s.insert(len, 1, ')');
@ -332,7 +332,7 @@ Polynomial<NT> Polynomial<NT>::getpoly(string & s){
len = s.length();
const char *cstr = s.c_str();
string t;
std::string t;
Polynomial<NT> P;
// P will be the polynomial in which we accumulate the
//sum and difference of the different terms.
@ -966,7 +966,7 @@ BigInt Polynomial<NT>::UpperBound() const {
lhsNeg.makeCeilExact();
/* compute B^{deg} */
if (rhs <= max(lhsPos,lhsNeg)) {
if (rhs <= (std::max)(lhsPos,lhsNeg)) {
B <<= 1;
rhs *= (BigInt(1)<<deg);
} else

View File

@ -155,6 +155,10 @@ public:
double vy() const { return image_ptr->vy; }
double vz() const { return image_ptr->vz; }
double tx() const { return image_ptr->tx; }
double ty() const { return image_ptr->ty; }
double tz() const { return image_ptr->tz; }
float value(const std::size_t i,
const std::size_t j,
const std::size_t k) const

View File

@ -69,6 +69,28 @@ public:
std::shared_ptr<std::vector<std::size_t> > neighbors;
/// \endcond
/// \cond SKIP_IN_MANUAL
class Point_idx_to_point_unary_function
{
public:
typedef std::size_t argument_type;
typedef typename ItemMap::reference result_type;
typedef boost::readable_property_map_tag category;
const ItemRange* m_range;
ItemMap m_item_map;
Point_idx_to_point_unary_function (const ItemRange* range, ItemMap item_map)
: m_range (range), m_item_map (item_map)
{ }
result_type operator() (const argument_type& arg) const
{
return get (m_item_map, *(m_range->begin() + arg));
}
};
/// \endcond
private:
const ItemRange* m_range;
ItemMap m_item_map;
@ -139,14 +161,12 @@ public:
*/
const CGAL::Bbox_3& bbox() const
{
auto transform = [&](const std::size_t& idx) -> typename ItemMap::reference
{
return get (m_item_map, *(m_range->begin() + idx));
};
if (m_bounding_box == CGAL::Bbox_3())
{
Point_idx_to_point_unary_function transform (m_range, m_item_map);
m_bounding_box = CGAL::bbox_3 (boost::make_transform_iterator (m_inliers->begin(), transform),
boost::make_transform_iterator (m_inliers->end(), transform));
}
return m_bounding_box;
}

View File

@ -98,6 +98,21 @@ function(cgal_add_compilation_test exe_name)
COMMAND ${TIME_COMMAND} "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "${exe_name}")
set_property(TEST "compilation_of__${exe_name}"
APPEND PROPERTY LABELS "${PROJECT_NAME}")
if(NOT TARGET cgal_check_build_system)
add_custom_target(cgal_check_build_system)
endif()
if(NOT TEST check_build_system)
add_test(NAME "check_build_system"
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "cgal_check_build_system")
if(POLICY CMP0066) # cmake 3.7 or later
set_property(TEST "check_build_system"
PROPERTY FIXTURES_SETUP "check_build_system_SetupFixture")
endif()
endif()
if(POLICY CMP0066) # cmake 3.7 or later
set_property(TEST "compilation_of__${exe_name}"
APPEND PROPERTY FIXTURES_REQUIRED "check_build_system_SetupFixture")
endif()
endfunction(cgal_add_compilation_test)
function(cgal_setup_test_properties test_name)

View File

@ -58,7 +58,7 @@ void test();
int
main()
{
CGAL::force_ieee_double_precision();
CGAL::Set_ieee_double_precision double_precision_guard;
typedef CGAL::Cartesian<double> Clsdb;
typedef CGAL::Filtered_kernel<Clsdb> Clsd;

View File

@ -36,9 +36,6 @@ _test_cls_tetrahedron_3(const R& )
typedef typename R::RT RT;
typedef typename R::FT FT;
typename R::Tetrahedron_3 it;
CGAL::Tetrahedron_3<R> t0(it);
RT n0 = 0;
RT n1 = 12;
RT n2 = 16;
@ -60,6 +57,10 @@ _test_cls_tetrahedron_3(const R& )
CGAL::Point_3<R> ps1( n7, n0, n0, n5); // (3, 0, 0)
CGAL::Point_3<R> ps0( CGAL::ORIGIN ); // (0, 0, 0)
typename R::Tetrahedron_3 it0; // check the default-constructor
typename R::Tetrahedron_3 it(p1,p2,p3,p4);
CGAL::Tetrahedron_3<R> t0(it);
const CGAL::Tetrahedron_3<R> t1(p1,p2,p3,p4);
CGAL::Tetrahedron_3<R> t2(p2,p1,p3,p4);
CGAL::Tetrahedron_3<R> t3(ps0,ps1,ps2,ps3); // positive oriented

View File

@ -36,9 +36,6 @@ _test_cls_triangle_3(const R& )
typedef typename R::RT RT;
typedef typename R::FT FT;
typename R::Triangle_3 it;
CGAL::Triangle_3<R> t0(it);
RT n0 = 0;
RT n1 = 12;
RT n2 = 16;
@ -61,7 +58,10 @@ _test_cls_triangle_3(const R& )
CGAL::Point_3<R> ps2( n0, n7, n0, n5); // (0, 3, 0)
CGAL::Point_3<R> ps1( n7, n0, n0, n5); // (3, 0, 0)
typename R::Triangle_3 it; // test default-constructor
const CGAL::Triangle_3<R> t1(p1,p2,p3);
CGAL::Triangle_3<R> t0(t1);
CGAL::Triangle_3<R> t2(p4,p2,p3);
CGAL::Triangle_3<R> t3(ps1,ps2,ps3);
CGAL::Triangle_3<R> t4(ps2,ps1,ps3);

View File

@ -221,8 +221,8 @@ test_new_3(const R& rep)
typename R::Construct_tetrahedron_3 construct_tetrahedron
= rep.construct_tetrahedron_3_object();
Tetrahedron_3 th1;
Tetrahedron_3 th2 = construct_tetrahedron(p2,p3,p4,p5);
Tetrahedron_3 th0; // test default-constructor
Tetrahedron_3 th2 = construct_tetrahedron(p2,p3,p4,p5), th1 = th2;
typename R::Construct_iso_cuboid_3 construct_iso_cuboid
= rep.construct_iso_cuboid_3_object();

View File

@ -52,19 +52,22 @@ if ( CGAL_FOUND )
include( ${EIGEN3_USE_FILE} )
endif()
set(VTK_LIBS "")
find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE)
if(VTK_FOUND)
include(${VTK_USE_FILE})
if ("${VTK_VERSION_MAJOR}" GREATER "5")
message(STATUS "VTK found")
set( VTK_LIBS vtkImagingGeneral vtkIOImage )
else()
message(STATUS "VTK version 6.0 or greater is required")
endif()
else()
message(STATUS "VTK was not found")
find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE)
if(VTK_FOUND)
if(VTK_USE_FILE)
include(${VTK_USE_FILE})
endif()
if ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5)
message(STATUS "VTK found")
if(TARGET VTK::IOImage)
set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage)
endif()
else()
message(STATUS "VTK version 6.0 or greater is required")
endif()
else()
message(STATUS "VTK was not found")
endif()
# Compilable examples
@ -87,9 +90,10 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "mesh_polyhedral_complex.cpp" )
create_single_source_cgal_program( "mesh_polyhedral_complex_sm.cpp" )
if( WITH_CGAL_ImageIO )
if( VTK_FOUND AND "${VTK_VERSION_MAJOR}" GREATER "5" )
if( VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) )
add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp )
target_link_libraries( mesh_3D_gray_vtk_image ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBS})
target_link_libraries( mesh_3D_gray_vtk_image ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES})
cgal_add_test( mesh_3D_gray_vtk_image )
endif()
create_single_source_cgal_program( "mesh_3D_gray_image.cpp" )

View File

@ -283,7 +283,7 @@ typedef boost::variant<const std::vector<double>*, const std::vector<uint8_t>*,
template <class C3T3>
void output_to_vtu_with_attributes(std::ostream& os,
const C3T3& c3t3,
std::vector<std::pair<const char*, const Vtu_attributes> >&attributes,
std::vector<std::pair<const char*, Vtu_attributes> >&attributes,
IO::Mode mode = IO::BINARY)
{
//CGAL_assertion(attributes.size() == attribute_types.size());
@ -372,7 +372,7 @@ void output_to_vtu(std::ostream& os,
mids.push_back(v);
}
std::vector<std::pair<const char*, const Vtu_attributes > > atts;
std::vector<std::pair<const char*, Vtu_attributes > > atts;
Vtu_attributes v = &mids;
atts.push_back(std::make_pair("MeshDomain", v));
output_to_vtu_with_attributes(os, c3t3, atts, mode);

View File

@ -109,12 +109,12 @@ private:
/// Returns a box enclosing image \c im
Bbox_3 compute_bounding_box(const Image& im) const
{
return Bbox_3(-im.vx(),
-im.vy(),
-im.vz(),
double(im.xdim()+1)*im.vx(),
double(im.ydim()+1)*im.vy(),
double(im.zdim()+1)*im.vz());
return Bbox_3(-im.vx()+im.tx(),
-im.vy()+im.ty(),
-im.vz()+im.tz(),
double(im.xdim()+1)*im.vx()+im.tx(),
double(im.ydim()+1)*im.vy()+im.ty(),
double(im.zdim()+1)*im.vz()+im.tz());
}
}; // end class Labeled_image_mesh_domain_3

View File

@ -88,10 +88,10 @@ namespace internal {
/// Returns a box enclosing image \c im
inline Bbox_3 compute_bounding_box(const Image_3& im)
{
return Bbox_3(-1,-1,-1,
double(im.xdim())*im.vx()+1,
double(im.ydim())*im.vy()+1,
double(im.zdim())*im.vz()+1);
return Bbox_3(-1+im.tx(),-1+im.ty(),-1+im.tz(),
double(im.xdim())*im.vx()+im.tx()+1,
double(im.ydim())*im.vy()+im.ty()+1,
double(im.zdim())*im.vz()+im.tz()+1);
}
template <typename Image_values_to_subdom_indices>

View File

@ -33,13 +33,17 @@ target_link_libraries(lcc_io_plugin PUBLIC scene_lcc_item)
find_package(VTK QUIET COMPONENTS
vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML vtkFiltersCore vtkFiltersSources)
if (VTK_FOUND)
include(${VTK_USE_FILE})
if ("${VTK_VERSION_MAJOR}" GREATER "5")
if(VTK_USE_FILE)
include(${VTK_USE_FILE})
endif()
if ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5)
if(TARGET VTK::CommonCore)
set(VTK_LIBRARIES VTK::CommonCore VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::FiltersCore VTK::FiltersSources)
endif()
if(VTK_LIBRARIES)
polyhedron_demo_plugin(vtk_plugin VTK_io_plugin KEYWORDS IO Mesh_3)
target_link_libraries(vtk_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_c3t3_item scene_points_with_normal_item
vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML
vtkFiltersCore vtkFiltersSources)
${VTK_LIBRARIES})
else()
message(STATUS "NOTICE : the vtk IO plugin needs VTK libraries and will not be compiled.")

View File

@ -11,15 +11,18 @@ polyhedron_demo_plugin(mesh_3_plugin Mesh_3_plugin
target_link_libraries(mesh_3_plugin PUBLIC scene_polygon_soup_item scene_polylines_item scene_implicit_function_item scene_image_item
scene_surface_mesh_item scene_c3t3_item ${OPENGL_gl_LIBRARY} )
set(VTK_LIBS "")
find_package(VTK QUIET COMPONENTS
vtkImagingGeneral vtkIOImage NO_MODULE)
if (VTK_FOUND)
include(${VTK_USE_FILE})
if ("${VTK_VERSION_MAJOR}" GREATER "5")
if(VTK_USE_FILE)
include(${VTK_USE_FILE})
endif()
if ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5)
if(TARGET VTK::IOImage)
set(VTK_LIBRARIES VTK::IOImage)
endif()
if(VTK_LIBRARIES)
add_definitions(-DCGAL_USE_VTK)
set(VTK_LIBS vtkImagingGeneral vtkIOImage)
else()
message(STATUS "NOTICE : the DICOM files (.dcm) need VTK libraries to be open and will not be able to.")
endif()
@ -34,7 +37,7 @@ find_package(Boost QUIET OPTIONAL_COMPONENTS filesystem)
if(Boost_FILESYSTEM_FOUND)
qt5_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui)
polyhedron_demo_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp Raw_image_dialog.cpp ${imgUI_FILES} ${VOLUME_MOC_OUTFILES} KEYWORDS IO Mesh_3)
target_link_libraries(io_image_plugin PUBLIC scene_image_item ${VTK_LIBS} CGAL::CGAL_ImageIO)
target_link_libraries(io_image_plugin PUBLIC scene_image_item ${VTK_LIBRARIES} CGAL::CGAL_ImageIO)
if(TARGET Boost::filesystem)
target_link_libraries(io_image_plugin PUBLIC Boost::filesystem)
else()

View File

@ -1859,7 +1859,9 @@ void test_rebind(const PT& /*traits*/){
typedef typename AT::Rational Rational;
const int dimension = 4;
typedef typename PT:: template Rebind<Integer,4>::Other PT_Integer_4;
CGAL_USE_TYPE(PT_Integer_4);
typedef typename PT:: template Rebind<Rational,4>::Other PT_Rational_4;
CGAL_USE_TYPE(PT_Rational_4);
CGAL_static_assertion((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type,
Integer>::value));
CGAL_static_assertion((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type,

View File

@ -93,14 +93,17 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${prj} )
set(VTK_LIBS "")
find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE)
if(VTK_FOUND)
include(${VTK_USE_FILE})
if ("${VTK_VERSION_MAJOR}" GREATER "5")
if(VTK_USE_FILE)
include(${VTK_USE_FILE})
endif()
if ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5)
message(STATUS "VTK found")
add_definitions(-DCGAL_USE_VTK)
set(VTK_LIBS vtkImagingGeneral vtkIOImage)
if(TARGET VTK::IOImage)
set(VTK_LIBRARIES VTK::IOImage VTK::ImagingGeneral)
endif()
else()
message(STATUS "Vtk must be at least Rel 6")
endif()
@ -111,7 +114,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
target_link_libraries( ${prj} PRIVATE
CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_ImageIO
${OPENGL_LIBRARIES}
${VTK_LIBS} )
${VTK_LIBRARIES} )
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
cgal_add_compilation_test(${prj})

View File

@ -742,13 +742,13 @@ Polyline_constraint_hierarchy_2<T,Compare,Data>::concatenate2(Constraint_id firs
// now we really concatenate the vertex lists
// Note that all iterators pointing into second remain valid.
first.vl_ptr()->pop_back(); // because it is the same as second.front()
Vertex_it back_it = first.vl_ptr()->skip_end();
--back_it;
Vertex_it back_it = second.vl_ptr()->skip_begin();
second.vl_ptr()->splice(second.vl_ptr()->skip_begin(), *(first.vl_ptr()), first.vl_ptr()->skip_begin(), first.vl_ptr()->skip_end());
// Note that for VC8 with iterator debugging the iterators pointing into second
// are NOT valid So we have to update them
for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end();
for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = back_it;
++succ != end;
++it){
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));

View File

@ -0,0 +1,89 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polygon_2<K> Polygon_2;
typedef CGAL::Exact_intersections_tag Itag_;
typedef CGAL::Constrained_Delaunay_triangulation_2<K,CGAL::Default, Itag_> CDT;
typedef CGAL::Constrained_triangulation_plus_2<CDT> CDTP;
typedef CDTP::Point Point;
typedef CDTP::Constraint_id Cid;
typedef CDTP::Vertex_handle Vertex_handle;
typedef CDTP::Constraint_id Constraint_id;
typedef CDTP::Vertices_in_constraint_iterator Vertices_in_constraint_iterator;
int countVertex(CDTP &cdtp, CDTP::Constraint_id id)
{
Vertices_in_constraint_iterator v=cdtp.vertices_in_constraint_begin(id);
int count=0;
while(v!=cdtp.vertices_in_constraint_end(id))
{
count++;
v++;
}
return count;
}
int main()
{
CDTP cdtp;
std::list<Point> pointsListCollinear;
pointsListCollinear.push_back(Point(0,0));
pointsListCollinear.push_back(Point(0,1));
pointsListCollinear.push_back(Point(0,2));
pointsListCollinear.push_back(Point(0,3));
pointsListCollinear.push_back(Point(0,4));
pointsListCollinear.push_back(Point(0,5));
std::list<Point> pointsListNoCollinear;
pointsListNoCollinear.push_back(Point(1,0));
pointsListNoCollinear.push_back(Point(2,1));
pointsListNoCollinear.push_back(Point(4,2));
pointsListNoCollinear.push_back(Point(2,3));
pointsListNoCollinear.push_back(Point(4,4));
pointsListNoCollinear.push_back(Point(1,5));
Constraint_id ctIdCollinear=cdtp.insert_constraint(pointsListCollinear.begin(),pointsListCollinear.end());
Constraint_id ctIdNoCollinear=cdtp.insert_constraint(pointsListNoCollinear.begin(),pointsListNoCollinear.end());
//******************************* attempt with the collinear constraint
Vertices_in_constraint_iterator vertexToRemoveCollinear=cdtp.vertices_in_constraint_begin(ctIdCollinear);
vertexToRemoveCollinear++;
vertexToRemoveCollinear++;
std::cout<<"attempt to remove vertex "<<(*vertexToRemoveCollinear)->point().x()<<" , "<<(*vertexToRemoveCollinear)->point().y() <<std::endl;
cdtp.remove_vertex_from_constraint(ctIdCollinear,vertexToRemoveCollinear);
std::cout<<"number of subconstraints "<<cdtp.number_of_subconstraints()<<std::endl; //--> 5, expected 4
std::cout<<"number of constraints "<<cdtp.number_of_constraints()<<std::endl; //--> 1
std::cout<<"number of vertex in constraint "<<countVertex(cdtp,ctIdCollinear)<<std::endl; //--> 6, expected 5
//******************************* attempt with the collinear constraint
Vertices_in_constraint_iterator vertexToRemoveNoCollinear=cdtp.vertices_in_constraint_begin(ctIdNoCollinear);
vertexToRemoveNoCollinear++;
vertexToRemoveNoCollinear++;
std::cout<<"attempt to remove vertex "<<(*vertexToRemoveNoCollinear)->point().x()<<" , "<<(*vertexToRemoveNoCollinear)->point().y() << std::endl;
cdtp.remove_vertex_from_constraint(ctIdNoCollinear,vertexToRemoveNoCollinear);
std::cout<<"number of subconstraints "<<cdtp.number_of_subconstraints()<<std::endl; //--> 4, ok
std::cout<<"number of constraints "<<cdtp.number_of_constraints()<<std::endl; //--> 1
std::cout<<"number of vertex in constraint "<<countVertex(cdtp,ctIdNoCollinear)<<std::endl; //--> 5, ok
return 0;
}