Merge branch 'Tangential_complex-cjamin-old' into Tangential_complex-cjamin

This commit is contained in:
Clement Jamin 2015-01-09 15:06:07 +01:00
commit fde42657b3
46 changed files with 4909 additions and 133 deletions

View File

@ -204,7 +204,7 @@ launch()
/*mesher_->initialize();
#ifdef CGAL_MESH_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
while ( ! mesher_->is_algorithm_done() && continue_ )

View File

@ -2607,7 +2607,7 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells,
# ifdef CGAL_MESH_3_PROFILING
std::cerr << std::endl << " Updating cells...";
WallClockTimer t;
Wall_clock_timer t;
size_t num_cells = c3t3_.number_of_cells_in_complex();
# endif

View File

@ -311,7 +311,7 @@ private:
#ifdef CGAL_MESH_3_PROFILING
std::cerr << "Computing moves...";
WallClockTimer t;
Wall_clock_timer t;
#endif
@ -690,7 +690,7 @@ operator()(int nb_iterations, Visitor visitor)
running_time_.start();
#ifdef CGAL_MESH_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
// Fill set containing moving vertices
@ -898,7 +898,7 @@ update_mesh(const Moves_vector& moves,
#ifdef CGAL_MESH_3_PROFILING
std::cerr << "Moving vertices...";
WallClockTimer t;
Wall_clock_timer t;
#endif
#ifdef CGAL_LINKED_WITH_TBB

View File

@ -320,7 +320,7 @@ Mesher_3<C3T3,MC,MD>::refine_mesh(std::string dump_after_refine_surface_prefix)
#ifdef CGAL_MESH_3_PROFILING
std::cerr << "Refining facets..." << std::endl;
WallClockTimer t;
Wall_clock_timer t;
#endif
facets_mesher_.refine(facets_visitor_);
#ifdef CGAL_MESH_3_PROFILING
@ -476,7 +476,7 @@ initialize()
{
#ifdef CGAL_MESH_3_PROFILING
std::cerr << "Initializing... ";
WallClockTimer t;
Wall_clock_timer t;
#endif
//=====================================
// Bounding box estimation

View File

@ -194,7 +194,7 @@ protected:
#ifdef CGAL_MESH_3_PROFILING
protected:
WallClockTimer m_timer;
Wall_clock_timer m_timer;
#endif
public:

View File

@ -28,10 +28,10 @@
// TBB timers
#ifdef CGAL_LINKED_WITH_TBB
#include <tbb/tick_count.h>
struct WallClockTimer
struct Wall_clock_timer
{
tbb::tick_count t;
WallClockTimer()
Wall_clock_timer()
{
t = tbb::tick_count::now();
}
@ -48,10 +48,10 @@
#else
#include <CGAL/Real_timer.h>
struct WallClockTimer
struct Wall_clock_timer
{
CGAL::Real_timer t;
WallClockTimer()
Wall_clock_timer()
{
t.start();
}

View File

@ -632,7 +632,7 @@ scan_triangulation_impl()
typedef typename Tr::Finite_cells_iterator Finite_cell_iterator;
#ifdef CGAL_MESH_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif

View File

@ -882,7 +882,7 @@ scan_triangulation_impl()
typedef typename Tr::Finite_facets_iterator Finite_facet_iterator;
#ifdef CGAL_MESH_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
#ifdef CGAL_MESH_3_VERY_VERBOSE

View File

@ -799,7 +799,7 @@ operator()(Visitor visitor)
running_time_.start();
#ifdef CGAL_MESH_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
// Build priority queue (we use one queue for all steps)

View File

@ -453,7 +453,7 @@ public: // methods
operator()(Visitor visitor = Visitor())
{
#ifdef CGAL_MESH_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
Mesh_optimization_return_code ret =
@ -964,7 +964,7 @@ pump_vertices(double sliver_criterion_limit,
Visitor& visitor)
{
#ifdef CGAL_MESH_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
init(sliver_criterion_limit);

View File

@ -0,0 +1,53 @@
// Copyright (c) 2014
// INRIA Saclay-Ile de France (France)
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Marc Glisse
#ifndef CGAL_EPECK_D_H
#define CGAL_EPECK_D_H
#include <CGAL/NewKernel_d/Cartesian_base.h>
#include <CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h>
#include <CGAL/NewKernel_d/Kernel_d_interface.h>
#include <CGAL/internal/Exact_type_selector.h>
namespace CGAL {
#define CGAL_BASE \
Cartesian_base_d<internal::Exact_field_selector<double>::Type, Dim>
template<class Dim>
struct Epeck_d_help1
: CGAL_BASE
{
CGAL_CONSTEXPR Epeck_d_help1(){}
CGAL_CONSTEXPR Epeck_d_help1(int d):CGAL_BASE(d){}
};
#undef CGAL_BASE
#define CGAL_BASE \
Kernel_d_interface< \
Cartesian_wrap< \
Epeck_d_help1<Dim>, \
Epeck_d<Dim> > >
template<class Dim>
struct Epeck_d
: CGAL_BASE
{
CGAL_CONSTEXPR Epeck_d(){}
CGAL_CONSTEXPR Epeck_d(int d):CGAL_BASE(d){}
};
#undef CGAL_BASE
}
#endif

View File

@ -30,7 +30,7 @@ namespace CGAL {
template < typename Base_, typename AK_, typename EK_ >
struct Cartesian_filter_K : public Base_,
private Store_kernel<AK_>, private Store_kernel2<EK_>
private Store_kernel<AK_>, private Store_kernel2<EK_>
{
CGAL_CONSTEXPR Cartesian_filter_K(){}
CGAL_CONSTEXPR Cartesian_filter_K(int d):Base_(d){}
@ -61,11 +61,11 @@ struct Cartesian_filter_K : public Base_,
template<class T> struct Type : Get_type<Kernel_base,T> {};
template<class T,class D=void,class=typename Get_functor_category<Cartesian_filter_K,T>::type> struct Functor :
Inherit_functor<Kernel_base,T,D> {};
Inherit_functor<Kernel_base,T,D> {};
template<class T,class D> struct Functor<T,D,Predicate_tag> {
typedef typename Get_functor<AK, T>::type AP;
typedef typename Get_functor<EK, T>::type EP;
typedef Filtered_predicate2<EP,AP,C2E,C2A> type;
typedef typename Get_functor<AK, T>::type AP;
typedef typename Get_functor<EK, T>::type EP;
typedef Filtered_predicate2<EP,AP,C2E,C2A> type;
};
// TODO:
// template<class T> struct Functor<T,No_filter_tag,Predicate_tag> :

View File

@ -73,6 +73,7 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
typedef typename Get_functor<Base, In_flat_power_test_tag>::type In_flat_power_test_d;
typedef typename Get_functor<Base, Point_to_vector_tag>::type Point_to_vector_d;
typedef typename Get_functor<Base, Vector_to_point_tag>::type Vector_to_point_d;
typedef typename Get_functor<Base, Translated_point_tag>::type Translated_point_d;
typedef typename Get_functor<Base, Scaled_vector_tag>::type Scaled_vector_d;
typedef typename Get_functor<Base, Difference_of_vectors_tag>::type Difference_of_vectors_d;
typedef typename Get_functor<Base, Difference_of_points_tag>::type Difference_of_points_d;
@ -184,6 +185,7 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
In_flat_power_test_d in_flat_power_test_d_object()const{ return In_flat_power_test_d(*this); }
Point_to_vector_d point_to_vector_d_object()const{ return Point_to_vector_d(*this); }
Vector_to_point_d vector_to_point_d_object()const{ return Vector_to_point_d(*this); }
Translated_point_d translated_point_d_object()const{ return Translated_point_d(*this); }
Scaled_vector_d scaled_vector_d_object()const{ return Scaled_vector_d(*this); }
Difference_of_vectors_d difference_of_vectors_d_object()const{ return Difference_of_vectors_d(*this); }
Difference_of_points_d difference_of_points_d_object()const{ return Difference_of_points_d(*this); }

View File

@ -57,7 +57,6 @@ template <class R_> struct Construct_sphere : Store_kernel<R_> {
typedef typename LA::Square_matrix Matrix;
typedef typename LA::Vector Vec;
typedef typename LA::Construct_vector CVec;
typedef typename Get_type<R_, Point_tag>::type Point;
typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
typename Get_functor<R_, Construct_ttag<Point_tag> >::type cp(this->kernel());
typename Get_functor<R_, Point_dimension_tag>::type pd(this->kernel());

View File

@ -75,6 +75,33 @@ template <class R_> struct Point_weight {
}
};
template <class R_> struct Power_distance : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Power_distance)
typedef typename Get_type<R_, Weighted_point_tag>::type first_argument_type;
typedef first_argument_type second_argument_type;
typedef typename Get_type<R_, FT_tag>::type result_type;
result_type operator()(first_argument_type const&a, second_argument_type const&b)const{
typename Get_functor<R_, Point_drop_weight_tag>::type pdw(this->kernel());
typename Get_functor<R_, Point_weight_tag>::type pw(this->kernel());
typename Get_functor<R_, Squared_distance_tag>::type sd(this->kernel());
return sd(pdw(a),pdw(b))-pw(a)-pw(b);
}
};
template <class R_> struct Power_distance_to_point : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Power_distance_to_point)
typedef typename Get_type<R_, Weighted_point_tag>::type first_argument_type;
typedef typename Get_type<R_, Point_tag>::type second_argument_type;
typedef typename Get_type<R_, FT_tag>::type result_type;
result_type operator()(first_argument_type const&a, second_argument_type const&b)const{
typename Get_functor<R_, Point_drop_weight_tag>::type pdw(this->kernel());
typename Get_functor<R_, Point_weight_tag>::type pw(this->kernel());
typename Get_functor<R_, Squared_distance_tag>::type sd(this->kernel());
return sd(pdw(a),b)-pw(a);
}
};
template<class R_> struct Power_test : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Power_test)
typedef R_ R;
@ -114,6 +141,56 @@ template<class R_> struct In_flat_power_test : private Store_kernel<R_> {
}
};
// Construct a point at (weighted) distance 0 from all the input
template <class R_> struct Power_center : Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Power_center)
typedef typename Get_type<R_, Weighted_point_tag>::type WPoint;
typedef WPoint result_type;
typedef typename Get_type<R_, Point_tag>::type Point;
typedef typename Get_type<R_, FT_tag>::type FT;
template <class Iter>
result_type operator()(Iter f, Iter e)const{
// 2*(x-y).c == (x^2-wx^2)-(y^2-wy^2)
typedef typename R_::LA LA;
typedef typename LA::Square_matrix Matrix;
typedef typename LA::Vector Vec;
typedef typename LA::Construct_vector CVec;
typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
typename Get_functor<R_, Construct_ttag<Point_tag> >::type cp(this->kernel());
typename Get_functor<R_, Point_dimension_tag>::type pd(this->kernel());
typename Get_functor<R_, Squared_distance_to_origin_tag>::type sdo(this->kernel());
typename Get_functor<R_, Power_distance_to_point_tag>::type pdp(this->kernel());
typename Get_functor<R_, Point_drop_weight_tag>::type pdw(this->kernel());
typename Get_functor<R_, Point_weight_tag>::type pw(this->kernel());
typename Get_functor<R_, Construct_ttag<Weighted_point_tag> >::type cwp(this->kernel());
WPoint const& wp0 = *f;
Point const& p0 = pdw(wp0);
int d = pd(p0);
FT const& n0 = sdo(p0) - pw(wp0);
Matrix m(d,d);
Vec b = typename CVec::Dimension()(d);
// Write the point coordinates in lines.
int i;
for(i=0; ++f!=e; ++i) {
WPoint const& wp=*f;
Point const& p=pdw(wp);
FT const& np = sdo(p) - pw(wp);
for(int j=0;j<d;++j) {
m(i,j)=2*(c(p,j)-c(p0,j));
b[i] = np - n0;
}
}
CGAL_assertion (i == d);
Vec res = typename CVec::Dimension()(d);;
//std::cout << "Mat: " << m << "\n Vec: " << one << std::endl;
LA::solve(res, CGAL_MOVE(m), CGAL_MOVE(b));
//std::cout << "Sol: " << res << std::endl;
Point center = cp(d,LA::vector_begin(res),LA::vector_end(res));
FT const& r2 = pdp (wp0, center);
return cwp(CGAL_MOVE(center), r2);
}
};
}
CGAL_KD_DEFAULT_TYPE(Weighted_point_tag,(CGAL::KerD::Weighted_point<K>),(Point_tag),());
CGAL_KD_DEFAULT_FUNCTOR(Construct_ttag<Weighted_point_tag>,(CartesianDKernelFunctors::Construct_weighted_point<K>),(Weighted_point_tag,Point_tag),());
@ -121,5 +198,8 @@ CGAL_KD_DEFAULT_FUNCTOR(Point_drop_weight_tag,(CartesianDKernelFunctors::Point_d
CGAL_KD_DEFAULT_FUNCTOR(Point_weight_tag,(CartesianDKernelFunctors::Point_weight<K>),(Weighted_point_tag,Point_tag),());
CGAL_KD_DEFAULT_FUNCTOR(Power_test_tag,(CartesianDKernelFunctors::Power_test<K>),(Weighted_point_tag),(Power_test_raw_tag,Point_drop_weight_tag,Point_weight_tag));
CGAL_KD_DEFAULT_FUNCTOR(In_flat_power_test_tag,(CartesianDKernelFunctors::In_flat_power_test<K>),(Weighted_point_tag),(In_flat_power_test_raw_tag,Point_drop_weight_tag,Point_weight_tag));
CGAL_KD_DEFAULT_FUNCTOR(Power_distance_tag,(CartesianDKernelFunctors::Power_distance<K>),(Weighted_point_tag,Point_tag),(Squared_distance_tag,Point_drop_weight_tag,Point_weight_tag));
CGAL_KD_DEFAULT_FUNCTOR(Power_distance_to_point_tag,(CartesianDKernelFunctors::Power_distance_to_point<K>),(Weighted_point_tag,Point_tag),(Squared_distance_tag,Point_drop_weight_tag,Point_weight_tag));
CGAL_KD_DEFAULT_FUNCTOR(Power_center_tag,(CartesianDKernelFunctors::Power_center<K>),(Weighted_point_tag,Point_tag),(Compute_point_cartesian_coordinate_tag,Construct_ttag<Point_tag>,Construct_ttag<Weighted_point_tag>,Point_dimension_tag,Squared_distance_to_origin_tag,Point_drop_weight_tag,Point_weight_tag,Power_distance_to_point_tag));
} // namespace CGAL
#endif

View File

@ -218,6 +218,8 @@ namespace CGAL {
CGAL_DECL_COMPUTE(Hyperplane_translation);
CGAL_DECL_COMPUTE(Value_at);
CGAL_DECL_COMPUTE(Point_weight);
CGAL_DECL_COMPUTE(Power_distance);
CGAL_DECL_COMPUTE(Power_distance_to_point);
#undef CGAL_DECL_COMPUTE
#define CGAL_DECL_ITER_OBJ(X,Y,Z,C) struct X##_tag {}; \
@ -268,6 +270,7 @@ namespace CGAL {
CGAL_DECL_CONSTRUCT(Point_to_vector,Vector);
CGAL_DECL_CONSTRUCT(Vector_to_point,Point);
CGAL_DECL_CONSTRUCT(Point_drop_weight,Point);
CGAL_DECL_CONSTRUCT(Power_center,Weighted_point);
#undef CGAL_DECL_CONSTRUCT
#if 0
#define CGAL_DECL_ITER_CONSTRUCT(X,Y) struct X##_tag {}; \

View File

@ -13,6 +13,7 @@
#include <CGAL/use.h>
#include <iostream>
#include <CGAL/NewKernel_d/Types/Weighted_point.h>
#include <cmath>
//typedef CGAL::Cartesian_base_d<double,CGAL::Dimension_tag<2> > K0;
//typedef CGAL::Cartesian_base_d<CGAL::Interval_nt_advanced,CGAL::Dimension_tag<2> > KA;
@ -73,6 +74,7 @@ void test2(){
typedef typename K1::Ray_d R;
typedef typename K1::Iso_box_d IB;
typedef typename K1::Flat_orientation_d FO;
typedef typename K1::Weighted_point_d WP;
//typedef K1::Construct_point CP;
typedef typename K1::Construct_point_d CP;
@ -120,6 +122,13 @@ void test2(){
typedef typename K1::Scalar_product_d SP;
typedef typename K1::Difference_of_vectors_d DV;
typedef typename K1::Difference_of_points_d DP;
typedef typename K1::Translated_point_d TP;
typedef typename CGAL::Get_functor<K1, CGAL::Power_center_tag>::type PC;
typedef typename CGAL::Get_functor<K1, CGAL::Power_distance_tag>::type PoD;
typedef typename K1::Weighted_point_d WP;
typedef typename K1::Construct_weighted_point_d CWP;
typedef typename K1::Point_drop_weight_d PDW;
typedef typename K1::Point_weight_d PW;
CGAL_USE_TYPE(AT);
CGAL_USE_TYPE(D);
@ -177,6 +186,12 @@ void test2(){
SP spr Kinit(scalar_product_d_object);
DV dv Kinit(difference_of_vectors_d_object);
DP dp Kinit(difference_of_points_d_object);
TP tp Kinit(translated_point_d_object);
PC pc (k);
CWP cwp Kinit(construct_weighted_point_d_object);
PDW pdw Kinit(point_drop_weight_d_object);
PW pw Kinit(point_weight_d_object);
PoD pod (k);
CGAL_USE(bc);
CGAL_USE(pol);
@ -185,11 +200,12 @@ void test2(){
CGAL_USE(cli);
CGAL_USE(cr);
CGAL_USE(cib);
using std::abs;
P a=cp(3,4);
assert(pd(a)==2);
assert(pv(a)[1]==4);
P b=vp(cv(5,6,7));
assert(fabs(b[0]-5./7)<.0001);
assert(abs(b[0]-5./7)<.0001);
assert(lc(b,a,1));
assert(!lc(a,b,0));
int rr[]={3,5,2};
@ -203,8 +219,8 @@ void test2(){
assert(cl(a,c)==CGAL::SMALLER);
assert(ll(b,c));
assert(cl(c,b)==CGAL::LARGER);
assert(fabs(m(a,c)[0]-3)<.0001);
assert(fabs(m(a,c)[1]-4.5)<.0001);
assert(abs(m(a,c)[0]-3)<.0001);
assert(abs(m(a,c)[1]-4.5)<.0001);
P d=cp(r,r+3,CGAL::Homogeneous_tag());
S s=cs(c,d);
std::cout << cc(a,1) << std::endl;
@ -253,9 +269,9 @@ void test2(){
assert(v.size()==1);
assert(lr(tab3+0,tab3+2)==1);
H h=ch(tab2+1,tab2+3);
assert(fabs(va(h,x2)-1)<.0001);
assert(fabs(va(h,x3)-1)<.0001);
assert(fabs(va(h,x1)+1)<.0001);
assert(abs(va(h,x2)-1)<.0001);
assert(abs(va(h,x3)-1)<.0001);
assert(abs(va(h,x1)+1)<.0001);
H h2=ch(tab2+1,tab2+3,x1,CGAL::ON_POSITIVE_SIDE);
assert(hops(h2,x1));
assert(os(h2,x1)==CGAL::ON_POSITIVE_SIDE);
@ -312,20 +328,35 @@ void test2(){
Sp sp = csp(tabz+0,tabz+3);
P cent0=cos(sp);
P cent1=cos(tabz+0,tabz+3);
assert(fabs(cent0[0]-2)<.0001);
assert(fabs(cent0[1]+3)<.0001);
assert(fabs(cent1[0]-2)<.0001);
assert(fabs(cent1[1]+3)<.0001);
assert(fabs(sp.squared_radius()-25)<.0001);
assert(abs(cent0[0]-2)<.0001);
assert(abs(cent0[1]+3)<.0001);
assert(abs(cent1[0]-2)<.0001);
assert(abs(cent1[1]+3)<.0001);
assert(abs(sp.squared_radius()-25)<.0001);
#if 1
// Fails for an exact kernel
P psp0=ps(sp,0);
P psp1=ps(sp,1);
P psp2=ps(sp,2);
assert(!ed(psp0,psp1));
assert(!ed(psp0,psp2));
assert(!ed(psp2,psp1));
assert(fabs(sd(cent0,psp0)-25)<.0001);
assert(fabs(sd(cent0,psp1)-25)<.0001);
assert(fabs(sd(cent0,psp2)-25)<.0001);
assert(abs(sd(cent0,psp0)-25)<.0001);
assert(abs(sd(cent0,psp1)-25)<.0001);
assert(abs(sd(cent0,psp2)-25)<.0001);
#endif
P x2py1 = tp(x2,y1);
assert(x2py1[1]==-2);
WP tw[]={cwp(cp(5,0),1.5),cwp(cp(2,std::sqrt(3)),1),cwp(cp(2,-std::sqrt(3)),1)};
WP xw=pc(tw+0,tw+3);
assert(abs(pod(xw,tw[0]))<.0001);
assert(abs(pod(xw,tw[1]))<.0001);
assert(abs(pod(xw,tw[2]))<.0001);
assert(pdw(xw)[0]<2.95);
assert(pdw(xw)[0]>2.5);
assert(pw(xw)<2.95);
assert(pw(xw)>2.5);
Sp un1; CGAL_USE(un1);
H un2; CGAL_USE(un2);
S un3; CGAL_USE(un3);
@ -418,6 +449,7 @@ void test3(){
SD sd Kinit(squared_distance_d_object);
PD pd Kinit(point_dimension_d_object);
AI ai Kinit(affinely_independent_d_object);
using std::abs;
P a; // Triangulation needs this :-(
a=cp(2,3,4);
assert(pd(a)==3);
@ -441,7 +473,7 @@ void test3(){
std::cout << *i << ' ';
std::cout << '\n';
P e=cp(-2,3,0);
assert(fabs(sd(e,a)-32)<.0001);
assert(abs(sd(e,a)-32)<.0001);
P tab[]={a,b,c,d,e};
std::cout << po (&tab[0],tab+4) << ' ';
std::cout << sos(&tab[0],tab+5) << ' ';

View File

@ -89,16 +89,26 @@ public:
struct Construct_cartesian_const_iterator_d: public Base_traits::Construct_cartesian_const_iterator_d{
PointPropertyMap ppmap;
using Base_traits::Construct_cartesian_const_iterator_d::operator();
Construct_cartesian_const_iterator_d(const typename Base_traits::Construct_cartesian_const_iterator_d& base, const PointPropertyMap& ppmap_)
:Base_traits::Construct_cartesian_const_iterator_d(base), ppmap(ppmap_){}
typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p) const
{ return this->operator() (get(ppmap,p)); }
{ return Base_traits::Construct_cartesian_const_iterator_d::operator() (get(ppmap,p)); }
typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p, int) const
{ return this->operator() (get(ppmap,p),0); }
{ return Base_traits::Construct_cartesian_const_iterator_d::operator() (get(ppmap,p),0); }
// These 2 additional operators forward the call to Base_traits.
// This is needed because of an undocumented requirement of
// Orthogonal_k_neighbor_search and Orthogonal_incremental_neighbor_search:
// Traits::Construct_cartesian_const_iterator should be callable
// on the query point type
typename Base_traits::Cartesian_const_iterator_d operator()(const typename Base_traits::Point_d& p) const
{ return Base_traits::Construct_cartesian_const_iterator_d::operator() (p); }
typename Base_traits::Cartesian_const_iterator_d operator()(const typename Base_traits::Point_d& p, int) const
{ return Base_traits::Construct_cartesian_const_iterator_d::operator() (p,0); }
};
struct Construct_iso_box_d: public Base::Construct_iso_box_d{

View File

@ -0,0 +1,77 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
project( Tangential_complex_benchmark )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
endif()
# Creates a new CMake option, turned ON by default
option(ACTIVATE_MSVC_PRECOMPILED_HEADERS
"Activate precompiled headers in MSVC"
OFF)
# Macro to add precompiled headers for MSVC
# This function does two things:
# 1. Enable precompiled headers on each file which is listed in "SourcesVar".
# 2. Add the content of "PrecompiledSource" (e.g. "StdAfx.cpp") to "SourcesVar".
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
IF(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS)
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
SET(Sources ${${SourcesVar}})
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\"")
SET_SOURCE_FILES_PROPERTIES(${Sources}
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeaders}\" /FI\"${PrecompiledHeader}\"")
# Add precompiled header to SourcesVar
LIST(APPEND ${SourcesVar} ${PrecompiledSource})
ENDIF(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS)
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
# The compiler might need more memory because of precompiled headers
if(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS AND NOT(MSVC_VERSION LESS 1310))
set(CGAL_C_FLAGS "${CGAL_C_FLAGS} /Zm1000")
set(CGAL_CXX_FLAGS "${CGAL_CXX_FLAGS} /Zm1000")
endif()
find_package(CGAL QUIET COMPONENTS Core )
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
find_package( TBB QUIET )
if( TBB_FOUND )
include(${TBB_USE_FILE})
list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
endif()
include( CGAL_CreateSingleSourceCGALProgram )
find_package(Eigen3 3.1.0)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
include_directories (BEFORE "../../include")
include_directories (BEFORE "include")
set (SOURCE_FILES "benchmark_tc.cpp")
ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" SOURCE_FILES)
create_single_source_cgal_program( ${SOURCE_FILES} )
else()
message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.")
endif()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()

View File

@ -0,0 +1,2 @@
// Build the precompiled headers.
#include "StdAfx.h"

View File

@ -0,0 +1,14 @@
#ifndef STDAFX_H
#define STDAFX_H
// CGAL
#include <CGAL/Tangential_complex/config.h>
#include <CGAL/Epick_d.h>
#include <CGAL/Regular_triangulation_euclidean_traits.h>
#include <CGAL/Regular_triangulation.h>
#include <CGAL/Delaunay_triangulation.h>
#include <CGAL/Tangential_complex/utilities.h>
#include <CGAL/Tangential_complex/Point_cloud.h>
#include <CGAL/Combination_enumerator.h>
#endif //STDAFX_H

View File

@ -0,0 +1,236 @@
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: $
// $Id: $
//
//
// Author(s) : Clement Jamin
//
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <ctime>
template<typename value_type = std::string>
class Simple_XML_exporter
{
public:
typedef value_type Value_type;
typedef std::vector<value_type> Element;
typedef std::map<std::string, value_type> Element_with_map;
typedef std::vector<Element> List_of_elements;
Simple_XML_exporter(
const std::string &list_name,
const std::string &element_name,
const std::vector<std::string> &subelement_names,
bool add_timestamp = true)
: m_list_name(list_name),
m_element_name(element_name),
m_subelement_names(subelement_names),
m_add_timestamp(add_timestamp)
{}
bool add_element(const Element &element)
{
if (element.size() == m_subelement_names.size())
{
m_list_of_elements.push_back(element);
return true;
}
else
{
std::cerr << "ERROR: element.size() == m_subelement_names.size()" << std::endl;
return false;
}
}
bool add_element(Element_with_map &element)
{
Element elt;
std::vector<std::string>::const_iterator
it_subelement_name = m_subelement_names.begin();
std::vector<std::string>::const_iterator
it_subelement_name_end = m_subelement_names.end();
for ( ; it_subelement_name != it_subelement_name_end ; ++it_subelement_name)
{
elt.push_back(element[*it_subelement_name]);
}
return add_element(elt);
}
bool export_to_xml(const std::string &filename) const
{
std::ofstream xmlfile;
xmlfile.open(filename.c_str());
xmlfile << "<?xml version='1.0'?>" << std::endl;
xmlfile << "<" << m_list_name << ">" << std::endl;
typename List_of_elements::const_iterator it_element = m_list_of_elements.begin();
typename List_of_elements::const_iterator it_element_end = m_list_of_elements.end();
for (int id = 1 ; it_element != it_element_end ; ++it_element, ++id)
{
xmlfile << " <" << m_element_name << ">" << std::endl;
std::vector<std::string>::const_iterator
it_subelement_name = m_subelement_names.begin();
std::vector<std::string>::const_iterator
it_subelement_name_end = m_subelement_names.end();
if (m_add_timestamp)
xmlfile << " <id> " << time(NULL) << " </id>" << std::endl;
for (int i = 0 ;
it_subelement_name != it_subelement_name_end ;
++it_subelement_name, ++i)
{
xmlfile
<< " <" << *it_subelement_name << "> "
<< (*it_element)[i]
<< " </" << *it_subelement_name << ">" << std::endl;
}
xmlfile << " </" << m_element_name << ">" << std::endl;
}
xmlfile << "</" << m_list_name << ">" << std::endl;
xmlfile.close();
return 0;
}
protected:
std::string m_list_name;
std::string m_element_name;
std::vector<std::string> m_subelement_names;
List_of_elements m_list_of_elements;
bool m_add_timestamp;
};
template<typename value_type = std::string>
class Streaming_XML_exporter
{
public:
typedef value_type Value_type;
typedef std::vector<value_type> Element;
typedef std::map<std::string, value_type> Element_with_map;
typedef std::vector<Element> List_of_elements;
Streaming_XML_exporter(
const std::string &filename,
const std::string &list_name,
const std::string &element_name,
const std::vector<std::string> &subelement_names,
bool add_timestamp = true)
: m_list_name(list_name),
m_element_name(element_name),
m_subelement_names(subelement_names),
m_add_timestamp(add_timestamp)
{
m_xml_fstream.open(filename.c_str());
if (m_xml_fstream.good())
{
m_xml_fstream << "<?xml version='1.0'?>" << std::endl;
m_xml_fstream << "<" << m_list_name << ">" << std::endl;
}
else
{
std::cerr << "Could not open file '" << filename << "'." << std::endl;
}
}
virtual ~Streaming_XML_exporter()
{
close_file();
}
void close_file()
{
m_xml_fstream.close();
}
bool add_element(const Element &element)
{
if (element.size() == m_subelement_names.size())
{
m_xml_fstream << " <" << m_element_name << ">" << std::endl;
std::vector<std::string>::const_iterator
it_subelement_name = m_subelement_names.begin();
std::vector<std::string>::const_iterator
it_subelement_name_end = m_subelement_names.end();
if (m_add_timestamp)
{
m_xml_fstream << " <id> " << time(NULL) << " </id>" << std::endl;
}
for (int i = 0 ;
it_subelement_name != it_subelement_name_end ;
++it_subelement_name, ++i)
{
m_xml_fstream
<< " <" << *it_subelement_name << "> "
<< element[i]
<< " </" << *it_subelement_name << ">" << std::endl;
}
m_xml_fstream << " </" << m_element_name << ">" << std::endl;
// Save current pointer position
std::ofstream::streampos pos = m_xml_fstream.tellp();
// Close the XML file (temporarily) so that the XML file is always correct
m_xml_fstream << "</" << m_list_name << ">" << std::endl;
// Restore the pointer position so that the next "add_element" will overwrite
// the end of the file
m_xml_fstream.seekp(pos);
m_xml_fstream.flush();
return true;
}
else
{
std::cerr << "ERROR: element.size() == m_subelement_names.size()" << std::endl;
return false;
}
}
bool add_element(Element_with_map &element)
{
Element elt;
std::vector<std::string>::const_iterator
it_subelement_name = m_subelement_names.begin();
std::vector<std::string>::const_iterator
it_subelement_name_end = m_subelement_names.end();
for ( ; it_subelement_name != it_subelement_name_end ; ++it_subelement_name)
{
elt.push_back(element[*it_subelement_name]);
}
return add_element(elt);
}
protected:
std::ofstream m_xml_fstream;
std::string m_list_name;
std::string m_element_name;
std::vector<std::string> m_subelement_names;
bool m_add_timestamp;
};

View File

@ -0,0 +1,231 @@
#include <CGAL/Epick_d.h>
#include <CGAL/Tangential_complex.h>
#include <CGAL/Random.h>
#include <CGAL/Mesh_3/Profiling_tools.h>
#include "../../test/Tangential_complex/test_utilities.h"
#include <fstream>
#include <math.h>
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/task_scheduler_init.h>
#endif
#include "XML_exporter.h"
#define CGAL_TC_EXPORT_PERFORMANCE_DATA
#define CGAL_TC_SET_PERFORMANCE_DATA(value_name, value) \
XML_perf_data::set(value_name, value);
class XML_perf_data
{
public:
typedef Streaming_XML_exporter<std::string> XML_exporter;
XML_perf_data(const std::string &filename)
: m_xml(filename, "ContainerPerformance", "Perf",
construct_subelements_names())
{}
virtual ~XML_perf_data()
{
}
static XML_perf_data &get()
{
static XML_perf_data singleton(build_filename());
return singleton;
}
template <typename Value_type>
static void set(const std::string &name, Value_type value)
{
get().set_data(name, value);
}
static void commit()
{
get().commit_current_element();
}
protected:
static std::string build_filename()
{
std::stringstream sstr;
sstr << "perf_logs/Performance_log_" << time(0) << ".xml";
return sstr.str();
}
static std::vector<std::string> construct_subelements_names()
{
std::vector<std::string> subelements;
subelements.push_back("Name");
subelements.push_back("Intrinsic_dim");
subelements.push_back("Ambient_dim");
subelements.push_back("Num_points");
subelements.push_back("Noise");
subelements.push_back("Info");
subelements.push_back("Init_time");
subelements.push_back("Comput_time");
subelements.push_back("Fix_time");
subelements.push_back("Fix_steps");
return subelements;
}
void set_data(const std::string &name, const std::string &value)
{
m_current_element[name] = value;
}
template <typename Value_type>
void set_data(const std::string &name, Value_type value)
{
std::stringstream sstr;
sstr << value;
set_data(name, sstr.str());
}
void commit_current_element()
{
m_xml.add_element(m_current_element);
m_current_element.clear();
}
XML_exporter m_xml;
XML_exporter::Element_with_map m_current_element;
};
const double NOISE = 0.01;
#ifdef _DEBUG
const int NUM_POINTS = 50;
#else
const int NUM_POINTS = 30000;
#endif
int main()
{
#ifdef CGAL_LINKED_WITH_TBB
# ifdef _DEBUG
tbb::task_scheduler_init init(1);
# else
tbb::task_scheduler_init init(10);
# endif
#endif
const int INTRINSIC_DIMENSION = 2;
const int AMBIENT_DIMENSION = 4;
typedef CGAL::Epick_d<CGAL::Dimension_tag<AMBIENT_DIMENSION> > Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_d Point;
bool stop = false;
//for (int i = 0, NUM_POINTS = 10000 ;
// NUM_POINTS <= 50000 && !stop ;
// ++i, NUM_POINTS += (i%3 == 0 ? 5000 : 0))
for (int i = 0 ; i < 5 && !stop ; ++i)
{
Kernel k;
Wall_clock_timer t;
CGAL::default_random = CGAL::Random(i);
std::cerr << "Random seed = " << i << std::endl;
#ifdef CGAL_TC_PROFILING
Wall_clock_timer t_gen;
#endif
//std::vector<Point> points;
//load_points_from_file<Point>(
// "data/points_10_10k.cin", std::back_inserter(points)/*, 600*/);
std::vector<Point> points =
//generate_points_on_circle_2<Kernel>(NUM_POINTS, 3.);
//generate_points_on_moment_curve<Kernel>(NUM_POINTS, AMBIENT_DIMENSION, 0., 1.);
//generate_points_on_plane<Kernel>(NUM_POINTS);
//generate_points_on_sphere_3<Kernel>(NUM_POINTS, 3.0);
//generate_points_on_sphere_d<Kernel>(NUM_POINTS, AMBIENT_DIMENSION, 3.0);
//generate_points_on_klein_bottle_3D<Kernel>(NUM_POINTS, 4., 3.);
generate_points_on_klein_bottle_4D<Kernel>(NUM_POINTS, 4., 3., NOISE);
//generate_points_on_klein_bottle_variant_5D<Kernel>(NUM_POINTS, 4., 3.);
CGAL_TC_SET_PERFORMANCE_DATA("Name", "Klein bottle 4D");
CGAL_TC_SET_PERFORMANCE_DATA("Intrinsic_dim", INTRINSIC_DIMENSION);
CGAL_TC_SET_PERFORMANCE_DATA("Ambient_dim", AMBIENT_DIMENSION);
CGAL_TC_SET_PERFORMANCE_DATA("Noise", NOISE);
XML_perf_data::set("Info", ""
#ifdef CGAL_TC_ONLY_CHANGE_SIMPLEX_WEIGHTS
"ONLY_CHANGE_SIMPLEX_WEIGHTS "
#endif
#ifdef CGAL_TC_GLOBAL_REFRESH
"GLOBAL_REFRESH "
#endif
);
#ifdef CGAL_TC_PROFILING
std::cerr << "Point set generated in " << t_gen.elapsed()
<< " seconds." << std::endl;
#endif
std::cerr << "Number of points before sparsification: "
<< points.size() << std::endl;
points = sparsify_point_set(
k, points, FT(INPUT_SPARSITY)*FT(INPUT_SPARSITY));
std::cerr << "Number of points after sparsification: "
<< points.size() << std::endl;
CGAL::Tangential_complex<
Kernel,
INTRINSIC_DIMENSION,
CGAL::Parallel_tag> tc(points.begin(), points.end(), k);
double init_time = t.elapsed(); t.reset();
//tc.estimate_intrinsic_dimension();
tc.compute_tangential_complex();
double computation_time = t.elapsed(); t.reset();
std::set<std::set<std::size_t> > incorrect_simplices;
//stop = !tc.check_if_all_simplices_are_in_the_ambient_delaunay(&incorrect_simplices);
t.reset();
unsigned int num_fix_steps = tc.fix_inconsistencies();
double fix_time = t.elapsed(); t.reset();
double export_time = -1.;
if (INTRINSIC_DIMENSION <= 3)
{
t.reset();
std::stringstream output_filename;
output_filename << "data/test_tc_" << INTRINSIC_DIMENSION
<< "_in_R" << AMBIENT_DIMENSION << ".off";
std::ofstream off_stream(output_filename.str().c_str());
tc.export_to_off(off_stream, true, &incorrect_simplices, true);
double export_time = t.elapsed(); t.reset();
}
/*else
tc.number_of_inconsistent_simplices();*/
std::cerr << std::endl
<< "================================================" << std::endl
<< "Number of vertices: " << tc.number_of_vertices() << std::endl
<< "Computation times (seconds): " << std::endl
<< " * Tangential complex: " << init_time + computation_time <<std::endl
<< " - Init + kd-tree = " << init_time << std::endl
<< " - TC computation = " << computation_time << std::endl
<< " * Fix inconsistencies: " << fix_time << " ("
<< num_fix_steps << " steps)" << std::endl
<< " * Export to OFF: " << export_time << std::endl
<< "================================================" << std::endl
<< std::endl;
CGAL_TC_SET_PERFORMANCE_DATA("Num_points", tc.number_of_vertices());
CGAL_TC_SET_PERFORMANCE_DATA("Init_time", init_time);
CGAL_TC_SET_PERFORMANCE_DATA("Comput_time", computation_time);
CGAL_TC_SET_PERFORMANCE_DATA("Fix_time", fix_time);
CGAL_TC_SET_PERFORMANCE_DATA("Fix_steps", num_fix_steps);
XML_perf_data::commit();
}
return 0;
}

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,340 @@
// Copyright (c) 2014 INRIA Sophia-Antipolis (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: $
// $Id: $
//
//
// Author(s) : Clement Jamin
#ifndef POINT_CLOUD_H
#define POINT_CLOUD_H
#include <CGAL/basic.h>
#include <CGAL/Bbox_3.h>
#include <CGAL/Dimension.h>
#ifdef CGAL_TC_USE_NANOFLANN
#include "nanoflann.hpp"
#include <array>
#include <utility>
#include <limits>
namespace CGAL {
namespace Tangential_complex_ {
// "dataset to kd-tree" adaptor class
template <typename K, typename Point_container_>
class Point_cloud_adaptator
{
public:
typedef typename Point_container_::value_type Point;
typedef typename CGAL::Kernel_traits<Point>::type Kernel;
typedef typename Kernel::FT FT;
/// The constructor that sets the data set source
Point_cloud_adaptator(Point_container_ &points, Kernel const& k)
: m_points(points), m_k(k)
{}
/// CRTP helper method
inline Point_container_ const& points() const
{
return m_points;
}
inline Point_container_& points()
{
return m_points;
}
// Must return the number of data points
inline size_t kdtree_get_point_count() const
{
return m_points.size();
}
// Returns the distance between the vector "p1[0:size-1]"
// and the data point with index "idx_p2" stored in the class:
inline FT kdtree_distance(
const FT *p1, const size_t idx_p2, size_t size) const
{
Point sp(p1, p1 + size);
return m_k.squared_distance_d_object()(sp, points()[idx_p2]);
}
// Returns the dim'th component of the idx'th point in the class:
// Since this is inlined and the "dim" argument is typically an
// immediate value, the "if/else's" are actually solved at compile time.
inline FT kdtree_get_pt(const size_t idx, int dim) const
{
return m_k.compute_coordinate_d_object()(points()[idx], dim);
}
// Optional bounding-box computation: return false to default to a standard
// bbox computation loop.
// Return true if the BBOX was already computed by the class and returned
// in "bb" so it can be avoided to redo it again.
// Look at bb.size() to find out the expected dimensionality
// (e.g. 2 or 3 for point clouds)
template <class Bbox>
bool kdtree_get_bbox(Bbox &bb) const
{
return false;
}
Kernel const& kernel() const
{
return m_k;
}
protected:
Point_container_& m_points; //!< A ref to the data set origin
Kernel const& m_k; //!< A const ref to the kernel
};
template <typename K, typename Point_container_>
class Point_cloud_data_structure
{
public:
typedef typename Point_container_::value_type Point;
typedef typename K Kernel;
typedef typename Kernel::FT FT;
static const int AMB_DIM = Ambient_dimension<Point>::value; // CJTODO: use Point_dimension_d or similar
/// Constructor
Point_cloud_data_structure(Point_container_ &points, Kernel const& k)
: m_adaptor(points, k),
m_kd_tree(AMB_DIM,
m_adaptor,
nanoflann::KDTreeSingleIndexAdaptorParams(10 /* max leaf */) )
{
m_kd_tree.buildIndex();
}
/*Point_container_ &points()
{
return m_adaptor.points();
}
const Point_container_ &points() const
{
return m_adaptor.points();
}*/
void query_ANN(const Point &sp,
std::size_t k,
size_t *neighbor_indices,
FT *squared_distance) const
{
/*std::vector<FT> sp_vec(
m_adaptor.kernel().construct_cartesian_const_iterator_d_object()(sp),
m_adaptor.kernel().construct_cartesian_const_iterator_d_object()(sp, 0));*/ // CJTODO remettre
std::vector<FT> sp_vec;
for (int i = 0 ; i < 4 ; ++i)
sp_vec.push_back(sp[i]);
nanoflann::KNNResultSet<FT> result_set(k);
result_set.init(neighbor_indices, squared_distance);
m_kd_tree.findNeighbors(result_set,
&sp_vec[0],
nanoflann::SearchParams());
/*std::cout << "knnSearch(nn="<< num_results <<"): \n";
for (int i = 0 ; i < num_results ; ++i)
{
std::cout << " * neighbor_indices = " << neighbor_indices [i]
<< " (out_dist_sqr = " << squared_distance[i] << ")"
<< std::endl;
}*/
}
void query_ball(const Point &sp,
const FT radius,
std::vector<std::pair<std::size_t, FT> > &neighbors,
bool sort_output = true)
{
/*std::vector<FT> sp_vec(
m_adaptor.kernel().construct_cartesian_const_iterator_d_object()(sp),
m_adaptor.kernel().construct_cartesian_const_iterator_d_object()(sp, 0));*/ // CJTODO remettre
std::vector<FT> sp_vec;
for (int i = 0 ; i < 4 ; ++i)
sp_vec.push_back(sp[i]);
m_kd_tree.radiusSearch(&sp_vec[0],
radius,
neighbors,
nanoflann::SearchParams(32, 0.f, sort_output));
/*std::cout << "radiusSearch(num="<< neighbors.size() <<"): \n";
for (const auto idx_and_dist : neighbors)
{
std::cout << " * neighbor_indices = " << idx_and_dist.first
<< " (out_dist_sqr = " << idx_and_dist.second << ")"
<< std::endl;
}*/
}
protected:
typedef Point_cloud_adaptator<Kernel, Point_container_> Adaptor;
typedef nanoflann::KDTreeSingleIndexAdaptor<
nanoflann::L2_Simple_Adaptor<FT, Adaptor> ,
Adaptor,
AMB_DIM // dim
> Kd_tree;
Adaptor m_adaptor;
Kd_tree m_kd_tree;
};
} // namespace Tangential_complex_
} //namespace CGAL
#else // !CGAL_TC_USE_NANOFLANN => use CGAL Spatial searching
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include <CGAL/Orthogonal_incremental_neighbor_search.h>
#include <CGAL/Search_traits.h>
#include <CGAL/Search_traits_adapter.h>
#include <CGAL/property_map.h>
#include <boost/tuple/tuple.hpp>
#include <boost/iterator/zip_iterator.hpp>
#include <boost/iterator/counting_iterator.hpp>
#include <boost/range/iterator_range.hpp>
#include <utility>
#include <limits>
namespace CGAL {
namespace Tangential_complex_ {
template <typename K, typename Point_container_>
class Point_cloud_data_structure
{
public:
typedef typename Point_container_::value_type Point;
typedef K Kernel;
typedef typename Kernel::FT FT;
typedef CGAL::Search_traits<
FT, Point,
typename Kernel::Cartesian_const_iterator_d,
typename Kernel::Construct_cartesian_const_iterator_d> Traits_base;
// using a pointer as a special property map type
typedef CGAL::Search_traits_adapter<
std::ptrdiff_t, Point*, Traits_base> STraits;
typedef CGAL::Orthogonal_k_neighbor_search<STraits> K_neighbor_search;
typedef typename K_neighbor_search::Tree Tree;
typedef typename K_neighbor_search::Distance Distance;
typedef typename K_neighbor_search::iterator KNS_iterator;
typedef K_neighbor_search KNS_range;
typedef CGAL::Orthogonal_incremental_neighbor_search<
STraits, Distance, CGAL::Sliding_midpoint<STraits>, Tree>
Incremental_neighbor_search;
typedef typename Incremental_neighbor_search::iterator INS_iterator;
typedef Incremental_neighbor_search INS_range;
static const int AMB_DIM = Ambient_dimension<Point>::value; // CJTODO: use Point_dimension_d or similar
/// Constructor
Point_cloud_data_structure(Point_container_ const& points)
: m_points(points),
m_tree(boost::counting_iterator<std::ptrdiff_t>(0),
boost::counting_iterator<std::ptrdiff_t>(points.size()),
typename Tree::Splitter(),
STraits((Point*)&(points[0])) )
{ }
/// Constructor
Point_cloud_data_structure(
Point_container_ const& points,
std::size_t begin_idx, std::size_t past_the_end_idx)
: m_points(points),
m_tree(
boost::counting_iterator<std::ptrdiff_t>(begin_idx),
boost::counting_iterator<std::ptrdiff_t>(past_the_end_idx),
typename Tree::Splitter(),
STraits((Point*)&(points[0])) )
{
}
/*Point_container_ &points()
{
return m_points;
}
const Point_container_ &points() const
{
return m_points;
}*/
// Be careful, this function invalidates the tree,
// which will be recomputed at the next query
void insert(std::ptrdiff_t point_idx)
{
m_tree.insert(point_idx);
}
KNS_range query_ANN(const
Point &sp,
unsigned int k,
bool sorted = true) const
{
// Initialize the search structure, and search all N points
// Note that we need to pass the Distance explicitly since it needs to
// know the property map
K_neighbor_search search(
m_tree,
sp,
k,
FT(0),
true,
Distance_adapter<std::ptrdiff_t,Point*,Euclidean_distance<Traits_base> >(
(Point*)&(m_points[0])),
sorted);
return search;
}
INS_range query_incremental_ANN(const Point &sp) const
{
// Initialize the search structure, and search all N points
// Note that we need to pass the Distance explicitly since it needs to
// know the property map
Incremental_neighbor_search search(
m_tree,
sp,
FT(0),
true,
Distance_adapter<std::ptrdiff_t,Point*,Euclidean_distance<Traits_base> >(
(Point*)&(m_points[0])) );
return search;
}
protected:
Point_container_ const& m_points;
Tree m_tree;
};
} // namespace Tangential_complex_
} //namespace CGAL
#endif // CGAL_TC_USE_NANOFLANN
#endif // POINT_CLOUD_H

View File

@ -0,0 +1,59 @@
// Copyright (c) 2014 INRIA Sophia-Antipolis (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: $
// $Id: $
//
//
// Author(s) : Clement Jamin
#ifndef CGAL_TC_CONFIG_H
#define CGAL_TC_CONFIG_H
#include <CGAL/config.h>
// Without TBB_USE_THREADING_TOOL Intel Inspector XE will report false
// positives in Intel TBB
// (http://software.intel.com/en-us/articles/compiler-settings-for-threading-error-analysis-in-intel-inspector-xe/)
#ifdef _DEBUG
# define TBB_USE_THREADING_TOOL
#endif
//========================= Debugging & profiling =============================
#define CGAL_TC_PROFILING
#define CGAL_TC_VERBOSE
// Solving inconsistencies: only change the weights of the inconsistent simplex
// or more?
//#define CGAL_TC_ONLY_CHANGE_SIMPLEX_WEIGHTS
// Otherwise...
const int CGAL_TC_NUMBER_OF_ADDITIONNAL_PERTURBED_POINTS = 1;
//========================= Strategy ==========================================
//#define CGAL_TC_USE_NANOFLANN
//#define CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
#define CGAL_TC_GLOBAL_REFRESH
//#define CGAL_TC_ON_DEMAND_REFRESH // CJTODO: not implemented yet
// The idea is to perform a global refresh + some local refreshes, just
// for local tri where there are some inconsistencies
// But be careful: refreshing the TC may invalidate cells, so the
// incident cells have to be recomputed again
//========================= Parameters ========================================
const std::size_t NUM_POINTS_FOR_PCA = 50;
const double INPUT_SPARSITY = 0.05;
#endif // CGAL_TC_CONFIG_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
// Copyright (c) 2014 INRIA Sophia-Antipolis (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: $
// $Id: $
//
//
// Author(s) : Clement Jamin
#ifndef CGAL_TC_UTILITIES_H
#define CGAL_TC_UTILITIES_H
#include <CGAL/basic.h>
#include <CGAL/Dimension.h>
#include <vector>
namespace CGAL {
namespace Tangential_complex_ {
template <typename K>
std::vector<typename K::Vector_d>
compute_gram_schmidt_basis(
std::vector<typename K::Vector_d> const& input_basis,
K const& kernel)
{
typedef typename K::FT FT;
typedef typename K::Vector_d Vector;
typedef std::vector<Vector> Basis;
const int D = Ambient_dimension<Vector>::value; // CJTODO: use Point_dimension_d or similar
// Kernel functors
typename K::Squared_length_d sqlen = kernel.squared_length_d_object();
typename K::Scaled_vector_d scaled_vec = kernel.scaled_vector_d_object();
typename K::Scalar_product_d inner_pdct = kernel.scalar_product_d_object();
typename K::Difference_of_vectors_d diff_vec = kernel.difference_of_vectors_d_object();
Basis output_basis;
typename Basis::const_iterator inb_it = input_basis.begin();
typename Basis::const_iterator inb_it_end = input_basis.end();
for (int i = 0 ; inb_it != inb_it_end ; ++inb_it, ++i)
{
Vector u = *inb_it;
typename Basis::iterator outb_it = output_basis.begin();
for (int j = 0 ; j < i ; ++j)
{
Vector const& ej = *outb_it;
Vector u_proj = scaled_vec(ej, inner_pdct(u, ej));
u = diff_vec(u, u_proj);
}
output_basis.push_back(
scaled_vec(u, FT(1)/CGAL::sqrt(sqlen(u))));
}
return output_basis;
}
} // namespace Tangential_complex_
} //namespace CGAL
#endif // CGAL_TC_UTILITIES_H

View File

@ -0,0 +1,2 @@
INRIA Sophia-Antipolis (France)

View File

@ -0,0 +1,3 @@
Tangential complex
This CGAL component provides an implementation of the tangential complex.

View File

@ -0,0 +1 @@
GPL (v3 or later)

View File

@ -0,0 +1 @@
Clément Jamin <clement.jamin.pro@gmail.com>

View File

@ -0,0 +1,77 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
project( Tangential_complex_test )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
endif()
# Creates a new CMake option, turned ON by default
option(ACTIVATE_MSVC_PRECOMPILED_HEADERS
"Activate precompiled headers in MSVC"
OFF)
# Macro to add precompiled headers for MSVC
# This function does two things:
# 1. Enable precompiled headers on each file which is listed in "SourcesVar".
# 2. Add the content of "PrecompiledSource" (e.g. "StdAfx.cpp") to "SourcesVar".
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
IF(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS)
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
SET(Sources ${${SourcesVar}})
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\"")
SET_SOURCE_FILES_PROPERTIES(${Sources}
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeaders}\" /FI\"${PrecompiledHeader}\"")
# Add precompiled header to SourcesVar
LIST(APPEND ${SourcesVar} ${PrecompiledSource})
ENDIF(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS)
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
# The compiler might need more memory because of precompiled headers
if(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS AND NOT(MSVC_VERSION LESS 1310))
set(CGAL_C_FLAGS "${CGAL_C_FLAGS} /Zm1000")
set(CGAL_CXX_FLAGS "${CGAL_CXX_FLAGS} /Zm1000")
endif()
find_package(CGAL QUIET COMPONENTS Core )
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
find_package( TBB QUIET )
if( TBB_FOUND )
include(${TBB_USE_FILE})
list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
endif()
include( CGAL_CreateSingleSourceCGALProgram )
find_package(Eigen3 3.1.0)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
include_directories (BEFORE "../../include")
include_directories (BEFORE "include")
set (SOURCE_FILES "test_tangential_complex.cpp")
ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" SOURCE_FILES)
create_single_source_cgal_program( ${SOURCE_FILES} )
else()
message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.")
endif()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()

View File

@ -0,0 +1,2 @@
// Build the precompiled headers.
#include "StdAfx.h"

View File

@ -0,0 +1,14 @@
#ifndef STDAFX_H
#define STDAFX_H
// CGAL
#include <CGAL/Tangential_complex/config.h>
#include <CGAL/Epick_d.h>
#include <CGAL/Regular_triangulation_euclidean_traits.h>
#include <CGAL/Regular_triangulation.h>
#include <CGAL/Delaunay_triangulation.h>
#include <CGAL/Tangential_complex/utilities.h>
#include <CGAL/Tangential_complex/Point_cloud.h>
#include <CGAL/Combination_enumerator.h>
#endif //STDAFX_H

View File

@ -0,0 +1,124 @@
//#undef CGAL_LINKED_WITH_TBB // CJTODO TEMP
// Without TBB_USE_THREADING_TOOL Intel Inspector XE will report false positives in Intel TBB
// (http://software.intel.com/en-us/articles/compiler-settings-for-threading-error-analysis-in-intel-inspector-xe/)
#ifdef _DEBUG
# define TBB_USE_THREADING_TOOL
#endif
#include <CGAL/Epick_d.h>
#include <CGAL/Tangential_complex.h>
#include <CGAL/Random.h>
#include <CGAL/Mesh_3/Profiling_tools.h>
#include "test_utilities.h"
#include <fstream>
#include <math.h>
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/task_scheduler_init.h>
#endif
#ifdef _DEBUG
const int NUM_POINTS = 50;
#else
const int NUM_POINTS = 10000;
#endif
int main()
{
#ifdef CGAL_LINKED_WITH_TBB
# ifdef _DEBUG
tbb::task_scheduler_init init(1);
# else
tbb::task_scheduler_init init(10);
# endif
#endif
const int INTRINSIC_DIMENSION = 2;
const int AMBIENT_DIMENSION = 4;
typedef CGAL::Epick_d<CGAL::Dimension_tag<AMBIENT_DIMENSION> > Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_d Point;
int i = 0;
bool stop = false;
//for ( ; !stop ; ++i)
{
Kernel k;
Wall_clock_timer t;
CGAL::default_random = CGAL::Random(i);
std::cerr << "Random seed = " << i << std::endl;
#ifdef CGAL_TC_PROFILING
Wall_clock_timer t_gen;
#endif
std::vector<Point> points =
//generate_points_on_circle_2<Kernel>(NUM_POINTS, 3.);
//generate_points_on_moment_curve<Kernel>(NUM_POINTS, AMBIENT_DIMENSION, 0., 1.);
//generate_points_on_plane<Kernel>(NUM_POINTS);
//generate_points_on_sphere_3<Kernel>(NUM_POINTS, 3.0);
//generate_points_on_sphere_d<Kernel>(NUM_POINTS, AMBIENT_DIMENSION, 3.0);
//generate_points_on_klein_bottle_3D<Kernel>(NUM_POINTS, 4., 3.);
generate_points_on_klein_bottle_4D<Kernel>(NUM_POINTS, 4., 3.);
//generate_points_on_klein_bottle_variant_5D<Kernel>(NUM_POINTS, 4., 3.);
#ifdef CGAL_TC_PROFILING
std::cerr << "Point set generated in " << t_gen.elapsed()
<< " seconds." << std::endl;
#endif
points = sparsify_point_set(
k, points, FT(INPUT_SPARSITY)*FT(INPUT_SPARSITY));
std::cerr << "Number of points after sparsification: "
<< points.size() << std::endl;
CGAL::Tangential_complex<
Kernel,
INTRINSIC_DIMENSION,
CGAL::Parallel_tag> tc(points.begin(), points.end(), k);
double init_time = t.elapsed(); t.reset();
tc.compute_tangential_complex();
double computation_time = t.elapsed(); t.reset();
std::set<std::set<std::size_t> > incorrect_simplices;
//stop = !tc.check_if_all_simplices_are_in_the_ambient_delaunay(&incorrect_simplices);
t.reset();
tc.fix_inconsistencies();
double fix_time = t.elapsed(); t.reset();
double export_time = -1.;
if (INTRINSIC_DIMENSION <= 3)
{
t.reset();
std::stringstream output_filename;
output_filename << "data/test_tc_" << INTRINSIC_DIMENSION
<< "_in_R" << AMBIENT_DIMENSION << ".off";
std::ofstream off_stream(output_filename.str().c_str());
tc.export_to_off(off_stream, true, &incorrect_simplices, true);
double export_time = t.elapsed(); t.reset();
}
/*else
tc.number_of_inconsistent_simplices();*/
std::cerr << std::endl
<< "================================================" << std::endl
<< "Number of vertices: " << tc.number_of_vertices() << std::endl
<< "Computation times (seconds): " << std::endl
<< " * Tangential complex: " << init_time + computation_time
<< std::endl
<< " - Init + kd-tree = " << init_time << std::endl
<< " - TC computation = " << computation_time << std::endl
<< " * Fix inconsistencies: " << fix_time << std::endl
<< " * Export to OFF: " << export_time << std::endl
<< "================================================" << std::endl
<< std::endl;
}
return 0;
}

View File

@ -0,0 +1,460 @@
// Copyright (c) 2014 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Clement Jamin
//
//******************************************************************************
// File Description :
//
//******************************************************************************
#ifndef CGAL_TC_TEST_TEST_UTILITIES_H
#define CGAL_TC_TEST_TEST_UTILITIES_H
#include <CGAL/Random.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/point_generators_d.h>
#include <CGAL/Tangential_complex/Point_cloud.h>
// Actually, this is very slow because the "m_points_ds->insert"
// cleans the tree, which is thus built at each query_ANN call
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
template <typename Kernel, typename Point_container>
class Point_sparsifier
{
public:
typedef typename Kernel::FT FT;
typedef typename Point_container::value_type Point;
typedef typename CGAL::Tangential_complex_::Point_cloud_data_structure<
Kernel, Point_container> Points_ds;
typedef typename Points_ds::KNS_range KNS_range;
// We can't instantiate m_points_ds right now since it requires that
// points is not empty (which be the case here)
Point_sparsifier(Point_container &points,
FT sparsity = FT(INPUT_SPARSITY*INPUT_SPARSITY))
: m_points(points), m_sparsity(sparsity), m_points_ds(NULL)
{}
bool try_to_insert_point(const Point &p)
{
if (m_points_ds == NULL)
{
m_points.push_back(p);
m_points_ds = new Points_ds(m_points);
m_points_ds->insert(0);
return true;
}
else
{
KNS_range kns_range = m_points_ds->query_ANN(p, 1, false);
if (kns_range.begin()->second >= m_sparsity)
{
m_points.push_back(p);
m_points_ds->insert(m_points.size() - 1);
return true;
}
}
return false;
}
private:
Point_container & m_points;
Points_ds * m_points_ds;
FT m_sparsity;
};
#endif
template <typename Kernel, typename Point_container>
std::vector<typename Point_container::value_type>
sparsify_point_set(
const Kernel &k, Point_container const& input_pts,
typename Kernel::FT min_squared_dist)
{
typedef typename Point_container::value_type Point;
typedef typename CGAL::Tangential_complex_::Point_cloud_data_structure<
Kernel, Point_container> Points_ds;
typedef typename Points_ds::INS_iterator INS_iterator;
typedef typename Points_ds::INS_range INS_range;
typename Kernel::Squared_distance_d sqdist = k.squared_distance_d_object();
#ifdef CGAL_TC_PROFILING
Wall_clock_timer t;
#endif
// Create the output container
std::vector<typename Point_container::value_type> output;
Points_ds points_ds(input_pts);
// Parse the following points, and add them if they are not too close to
// the other points
std::size_t pt_idx = 0;
for (typename Point_container::const_iterator it_pt = input_pts.begin() ;
it_pt != input_pts.end();
++it_pt, ++pt_idx)
{
INS_range ins_range = points_ds.query_incremental_ANN(*it_pt);
// Drop it if there is another point that:
// - is closer that min_squared_dist
// - and has a higher index
for (INS_iterator nn_it = ins_range.begin() ;
nn_it != ins_range.end() ;
++nn_it)
{
std::size_t neighbor_point_idx = nn_it->first;
typename Kernel::FT sq_dist = nn_it->second;
// The neighbor is further, we keep the point
if (sq_dist >= min_squared_dist)
{
output.push_back(*it_pt);
break;
}
// The neighbor is close and it has a higher index
else if (neighbor_point_idx > pt_idx)
break; // We drop the point
// Otherwise, we go the next closest point
}
}
#ifdef CGAL_TC_PROFILING
std::cerr << "Point set sparsified in " << t.elapsed()
<< " seconds." << std::endl;
#endif
return output;
}
template<typename Point, typename OutputIterator>
bool load_points_from_file(
const std::string &filename, OutputIterator points,
std::size_t only_first_n_points = std::numeric_limits<std::size_t>::max())
{
std::ifstream in(filename);
if (!in.is_open())
{
std::cerr << "Could not open '" << filename << "'" << std::endl;
return false;
}
Point p;
int dim_from_file;
in >> dim_from_file;
std::size_t i = 0;
while(i < only_first_n_points && in >> p)
{
*points++ = p;
++i;
}
return true;
}
template <typename Kernel>
std::vector<typename Kernel::Point_d> generate_points_on_plane(std::size_t num_points)
{
typedef typename Kernel::Point_d Point;
typedef typename Kernel::FT FT;
CGAL::Random rng;
std::vector<Point> points;
points.reserve(num_points);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
Point_sparsifier<Kernel, std::vector<Point> > sparsifier(points);
#endif
for (std::size_t i = 0 ; i < num_points ; )
{
FT x = rng.get_double(0, 5);
FT y = rng.get_double(0, 5);
Point p = Kernel().construct_point_d_object()(x, y, 0);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
if (sparsifier.try_to_insert_point(p))
++i;
#else
points.push_back(p);
++i;
#endif
}
return points;
}
template <typename Kernel>
std::vector<typename Kernel::Point_d> generate_points_on_moment_curve(
std::size_t num_points, int dim,
typename Kernel::FT min_x , typename Kernel::FT max_x)
{
typedef typename Kernel::Point_d Point;
typedef typename Kernel::FT FT;
CGAL::Random rng;
std::vector<Point> points;
points.reserve(num_points);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
Point_sparsifier<Kernel, std::vector<Point> > sparsifier(points);
#endif
for (std::size_t i = 0 ; i < num_points ; )
{
FT x = rng.get_double(min_x, max_x);
std::vector<FT> coords;
coords.reserve(dim);
for (int p = 1 ; p <= dim ; ++p)
coords.push_back(std::pow(CGAL::to_double(x), p));
Point p = Kernel().construct_point_d_object()(
dim, coords.begin(), coords.end());
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
if (sparsifier.try_to_insert_point(p))
++i;
#else
points.push_back(p);
++i;
#endif
}
return points;
}
template <typename Kernel>
std::vector<typename Kernel::Point_d> generate_points_on_circle_2(
std::size_t num_points, double radius)
{
typedef typename Kernel::Point_d Point;
CGAL::Random_points_on_circle_2<Point> generator(radius);
std::vector<Point> points;
points.reserve(num_points);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
Point_sparsifier<Kernel, std::vector<Point> > sparsifier(points);
#endif
for (std::size_t i = 0 ; i < num_points ; )
{
Point p = *generator++;
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
if (sparsifier.try_to_insert_point(p))
++i;
#else
points.push_back(p);
++i;
#endif
}
return points;
}
template <typename Kernel>
std::vector<typename Kernel::Point_d> generate_points_on_sphere_3(
std::size_t num_points, double radius)
{
typedef typename Kernel::Point_d Point;
CGAL::Random_points_on_sphere_3<Point> generator(radius);
std::vector<Point> points;
points.reserve(num_points);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
Point_sparsifier<Kernel, std::vector<Point> > sparsifier(points);
#endif
for (std::size_t i = 0 ; i < num_points ; )
{
Point p = *generator++;
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
if (sparsifier.try_to_insert_point(p))
++i;
#else
points.push_back(p);
++i;
#endif
}
return points;
}
template <typename Kernel>
std::vector<typename Kernel::Point_d> generate_points_on_sphere_d(
std::size_t num_points, int dim, double radius)
{
typedef typename Kernel::Point_d Point;
CGAL::Random_points_on_sphere_d<Point> generator(dim, radius);
std::vector<Point> points;
points.reserve(num_points);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
Point_sparsifier<Kernel, std::vector<Point> > sparsifier(points);
#endif
for (std::size_t i = 0 ; i < num_points ; )
{
Point p = *generator++;
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
if (sparsifier.try_to_insert_point(p))
++i;
#else
points.push_back(p);
++i;
#endif
}
return points;
}
// a = big radius, b = small radius
template <typename Kernel>
std::vector<typename Kernel::Point_d> generate_points_on_klein_bottle_3D(
std::size_t num_points, double a, double b, bool uniform = false)
{
typedef typename Kernel::Point_d Point;
typedef typename Kernel::FT FT;
CGAL::Random rng;
// if uniform
std::size_t num_lines = (std::size_t)sqrt(num_points);
std::size_t num_cols = num_points/num_lines + 1;
std::vector<Point> points;
points.reserve(num_points);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
Point_sparsifier<Kernel, std::vector<Point> > sparsifier(points);
#endif
for (std::size_t i = 0 ; i < num_points ; )
{
FT u, v;
if (uniform)
{
std::size_t k1 = i / num_lines;
std::size_t k2 = i % num_lines;
u = 6.2832 * k1 / num_lines;
v = 6.2832 * k2 / num_lines;
}
else
{
u = rng.get_double(0, 6.2832);
v = rng.get_double(0, 6.2832);
}
double tmp = cos(u/2)*sin(v) - sin(u/2)*sin(2.*v);
Point p = Kernel().construct_point_d_object()(
(a + b*tmp)*cos(u),
(a + b*tmp)*sin(u),
b*(sin(u/2)*sin(v) + cos(u/2)*sin(2.*v)));
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
if (sparsifier.try_to_insert_point(p))
++i;
#else
points.push_back(p);
++i;
#endif
}
return points;
}
// a = big radius, b = small radius
template <typename Kernel>
std::vector<typename Kernel::Point_d> generate_points_on_klein_bottle_4D(
std::size_t num_points, double a, double b, double noise = 0., bool uniform = false)
{
typedef typename Kernel::Point_d Point;
typedef typename Kernel::FT FT;
CGAL::Random rng;
// if uniform
std::size_t num_lines = (std::size_t)sqrt(num_points);
std::size_t num_cols = num_points/num_lines + 1;
std::vector<Point> points;
points.reserve(num_points);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
Point_sparsifier<Kernel, std::vector<Point> > sparsifier(points);
#endif
for (std::size_t i = 0 ; i < num_points ; )
{
FT u, v;
if (uniform)
{
std::size_t k1 = i / num_lines;
std::size_t k2 = i % num_lines;
u = 6.2832 * k1 / num_lines;
v = 6.2832 * k2 / num_lines;
}
else
{
u = rng.get_double(0, 6.2832);
v = rng.get_double(0, 6.2832);
}
Point p = Kernel().construct_point_d_object()(
Kernel().construct_point_d_object()(
(a + b*cos(v))*cos(u) + (noise == 0. ? 0. : rng.get_double(0, noise)),
(a + b*cos(v))*sin(u) + (noise == 0. ? 0. : rng.get_double(0, noise)),
b*sin(v)*cos(u/2) + (noise == 0. ? 0. : rng.get_double(0, noise)),
b*sin(v)*sin(u/2) + (noise == 0. ? 0. : rng.get_double(0, noise))));
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
if (sparsifier.try_to_insert_point(p))
++i;
#else
points.push_back(p);
++i;
#endif
}
return points;
}
// a = big radius, b = small radius
template <typename Kernel>
std::vector<typename Kernel::Point_d>
generate_points_on_klein_bottle_variant_5D(
std::size_t num_points, double a, double b, bool uniform = false)
{
typedef typename Kernel::Point_d Point;
typedef typename Kernel::FT FT;
CGAL::Random rng;
// if uniform
std::size_t num_lines = (std::size_t)sqrt(num_points);
std::size_t num_cols = num_points/num_lines + 1;
std::vector<Point> points;
points.reserve(num_points);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
Point_sparsifier<Kernel, std::vector<Point> > sparsifier(points);
#endif
for (std::size_t i = 0 ; i < num_points ; )
{
FT u, v;
if (uniform)
{
std::size_t k1 = i / num_lines;
std::size_t k2 = i % num_lines;
u = 6.2832 * k1 / num_lines;
v = 6.2832 * k2 / num_lines;
}
else
{
u = rng.get_double(0, 6.2832);
v = rng.get_double(0, 6.2832);
}
FT x1 = (a + b*cos(v))*cos(u);
FT x2 = (a + b*cos(v))*sin(u);
FT x3 = b*sin(v)*cos(u/2);
FT x4 = b*sin(v)*sin(u/2);
FT x5 = x1 + x2 + x3 + x4;
Point p = Kernel().construct_point_d_object()(x1, x2, x3, x4, x5);
#ifdef CGAL_TC_USE_SLOW_BUT_ACCURATE_SPARSIFIER
if (sparsifier.try_to_insert_point(p))
++i;
#else
points.push_back(p);
++i;
#endif
}
return points;
}
#endif // CGAL_MESH_3_TEST_TEST_UTILITIES_H

View File

@ -75,6 +75,8 @@ public: // PUBLIC NESTED TYPES
typedef typename Base::Full_cell_iterator Full_cell_iterator;
typedef typename Base::Full_cell_const_handle Full_cell_const_handle;
typedef typename Base::Full_cell_const_iterator Full_cell_const_iterator;
typedef typename Base::Finite_full_cell_const_iterator
Finite_full_cell_const_iterator;
typedef typename Base::size_type size_type;
typedef typename Base::difference_type difference_type;
@ -118,7 +120,7 @@ public:
using Base::vertices_begin;
using Base::vertices_end;
// using Base::
private:
//*** Side_of_oriented_subsphere_d ***
typedef typename Base::Flat_orientation_d Flat_orientation_d;
@ -155,12 +157,12 @@ public:
}
// With this constructor,
// the user can specify a Flat_orientation_d object to be used for
// orienting simplices of a specific dimension
// the user can specify a Flat_orientation_d object to be used for
// orienting simplices of a specific dimension
// (= preset_flat_orientation_.first)
// It it used by the dark triangulations created by DT::remove
Delaunay_triangulation(
int dim,
int dim,
const std::pair<int, const Flat_orientation_d *> &preset_flat_orientation,
const Geom_traits &k = Geom_traits())
: Base(dim, preset_flat_orientation, k)
@ -175,8 +177,8 @@ public:
Side_of_oriented_subsphere_d side_of_oriented_subsphere_predicate() const
{
return Side_of_oriented_subsphere_d (
flat_orientation_,
geom_traits().construct_flat_orientation_d_object(),
flat_orientation_,
geom_traits().construct_flat_orientation_d_object(),
geom_traits().in_flat_side_of_oriented_sphere_d_object()
);
}
@ -288,7 +290,7 @@ public:
Orientation o = ori_(
boost::make_transform_iterator(s->vertices_begin(), spivi),
boost::make_transform_iterator(s->vertices_begin() + cur_dim_ + 1,
boost::make_transform_iterator(s->vertices_begin() + cur_dim_ + 1,
spivi));
if( POSITIVE == o )
@ -317,9 +319,9 @@ public:
return pred_(dc_.full_cell(f)->neighbor(dc_.index_of_covertex(f)));
}
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VALIDITY
bool is_valid(bool verbose = false, int level = 0) const;
private:
@ -336,7 +338,7 @@ private:
Conflict_traversal_pred_in_fullspace;
};
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// FUNCTIONS THAT ARE MEMBER METHODS:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REMOVALS
@ -527,7 +529,7 @@ Delaunay_triangulation<DCTraits, TDS>
typedef typename Base::template Full_cell_set<Dark_s_handle> Dark_full_cells;
Dark_full_cells conflict_zone;
std::back_insert_iterator<Dark_full_cells> dark_out(conflict_zone);
dark_ft = dark_side.compute_conflict_zone(v->point(), dark_s, dark_out);
// Make the dark simplices in the conflict zone searchable
conflict_zone.make_searchable();
@ -625,7 +627,7 @@ Delaunay_triangulation<DCTraits, TDS>
int li = light_s->index(dark_s->vertex(di)->data());
Rotor light_r(light_s, li, light_i);
typename Dark_triangulation::Rotor dark_r(dark_s, di, dark_i);
while (simps.contains(cpp11::get<0>(light_r)->neighbor(cpp11::get<1>(light_r))))
light_r = rotate_rotor(light_r);
@ -855,27 +857,27 @@ template< typename DCTraits, typename TDS >
bool
Delaunay_triangulation<DCTraits, TDS>
::is_valid(bool verbose, int level) const
{
{
if (!Base::is_valid(verbose, level))
return false;
int dim = current_dimension();
if (dim == maximal_dimension())
{
for (Finite_full_cell_const_iterator cit = finite_full_cells_begin() ;
cit != finite_full_cells_end() ; ++cit )
for (Finite_full_cell_const_iterator cit = this->finite_full_cells_begin() ;
cit != this->finite_full_cells_end() ; ++cit )
{
Full_cell_const_handle ch = cit.base();
for(int i = 0; i < dim+1 ; ++i )
for(int i = 0; i < dim+1 ; ++i )
{
// If the i-th neighbor is not an infinite cell
Vertex_handle opposite_vh =
Vertex_handle opposite_vh =
ch->neighbor(i)->vertex(ch->neighbor(i)->index(ch));
if (!is_infinite(opposite_vh))
{
Side_of_oriented_sphere_d side =
Side_of_oriented_sphere_d side =
geom_traits().side_of_oriented_sphere_d_object();
if (side(Point_const_iterator(ch->vertices_begin()),
if (side(Point_const_iterator(ch->vertices_begin()),
Point_const_iterator(ch->vertices_end()),
opposite_vh->point()) == ON_BOUNDED_SIDE)
{

View File

@ -53,7 +53,7 @@ input_point(std::istream & is, const Traits &traits, P & p)
{
typedef typename Traits::FT FT;
std::vector<FT> coords;
std::string line;
for(;;)
{
@ -84,7 +84,7 @@ operator>>(std::istream &is, typename Wrap::Point_d<K> & p)
typedef typename Wrap::Point_d<K> P;
typedef typename K::FT FT;
std::vector<FT> coords;
std::string line;
for(;;)
{
@ -124,8 +124,8 @@ operator>>(std::istream &is, typename Wrap::Weighted_point_d<K> & wp)
std::vector<FT> coords;
while (line_sstr >> temp)
coords.push_back(temp);
std::vector<FT>::iterator last = coords.end() - 1;
typename std::vector<FT>::iterator last = coords.end() - 1;
P p = P(coords.begin(), last);
wp = WP(p, *last);
@ -134,7 +134,7 @@ operator>>(std::istream &is, typename Wrap::Weighted_point_d<K> & wp)
template < class GT, class TDS >
std::ostream &
export_triangulation_to_off(std::ostream & os,
export_triangulation_to_off(std::ostream & os,
const Triangulation<GT,TDS> & tr,
bool in_3D_export_surface_only = false)
{
@ -147,7 +147,7 @@ export_triangulation_to_off(std::ostream & os,
typedef typename Tr::Full_cell_const_iterator Full_cell_iterator;
typedef typename Tr::Full_cell Full_cell;
typedef typename Full_cell::Vertex_handle_const_iterator Full_cell_vertex_iterator;
if (tr.maximal_dimension() < 2 || tr.maximal_dimension() > 3)
{
std::cerr << "Warning: export_tds_to_off => dimension should be 2 or 3.";
@ -158,11 +158,11 @@ export_triangulation_to_off(std::ostream & os,
size_t n = tr.number_of_vertices();
std::stringstream output;
// write the vertices
std::map<Vertex_handle, int> index_of_vertex;
int i = 0;
for(Finite_vertex_iterator it = tr.finite_vertices_begin();
for(Finite_vertex_iterator it = tr.finite_vertices_begin();
it != tr.finite_vertices_end(); ++it, ++i)
{
Triangulation_IO::output_point(output, tr.geom_traits(), it->point());
@ -172,7 +172,7 @@ export_triangulation_to_off(std::ostream & os,
index_of_vertex[it.base()] = i;
}
CGAL_assertion( i == n );
size_t number_of_triangles = 0;
if (tr.maximal_dimension() == 2)
{
@ -207,7 +207,7 @@ export_triangulation_to_off(std::ostream & os,
output << index_of_vertex[*vit] << " ";
}
output << std::endl;
++number_of_triangles;
++number_of_triangles;
}
}
}
@ -243,7 +243,7 @@ export_triangulation_to_off(std::ostream & os,
}
os << "OFF \n"
<< n << " "
<< n << " "
<< number_of_triangles << " 0\n"
<< output.str();

View File

@ -42,15 +42,15 @@ class Regular_triangulation
{
typedef typename RTTraits::Dimension Maximal_dimension_;
typedef typename Default::Get<
TDS_,
TDS_,
Triangulation_data_structure<
Maximal_dimension_,
Triangulation_vertex<RTTraits>,
Triangulation_full_cell<RTTraits>
Triangulation_full_cell<RTTraits>
> >::type TDS;
typedef Triangulation<RTTraits, TDS> Base;
typedef Regular_triangulation<RTTraits, TDS_> Self;
typedef typename RTTraits::Orientation_d Orientation_d;
typedef typename RTTraits::Construct_weighted_point_d Construct_weighted_point_d;
typedef typename RTTraits::Power_test_d Power_test_d;
@ -68,8 +68,9 @@ public: // PUBLIC NESTED TYPES
typedef typename Base::Full_cell Full_cell;
typedef typename Base::Facet Facet;
typedef typename Base::Face Face;
typedef Maximal_dimension_ Maximal_dimension;
typedef typename Base::Point Point;
typedef typename RTTraits::Bare_point Bare_point;
typedef typename RTTraits::Weighted_point Weighted_point;
@ -153,7 +154,7 @@ private:
}
};
public:
// - - - - - - - - - - - - - - - - - - - - - - - - - - CREATION / CONSTRUCTORS
Regular_triangulation(int dim, const Geom_traits &k = Geom_traits())
@ -162,12 +163,12 @@ public:
}
// With this constructor,
// the user can specify a Flat_orientation_d object to be used for
// orienting simplices of a specific dimension
// the user can specify a Flat_orientation_d object to be used for
// orienting simplices of a specific dimension
// (= preset_flat_orientation_.first)
// It it used by the dark triangulations created by DT::remove
Regular_triangulation(
int dim,
int dim,
const std::pair<int, const Flat_orientation_d *> &preset_flat_orientation,
const Geom_traits &k = Geom_traits())
: Base(dim, preset_flat_orientation, k)
@ -182,8 +183,8 @@ public:
Power_test_in_flat_d power_test_in_flat_predicate() const
{
return Power_test_in_flat_d (
flat_orientation_,
geom_traits().construct_flat_orientation_d_object(),
flat_orientation_,
geom_traits().construct_flat_orientation_d_object(),
geom_traits().in_flat_power_test_d_object()
);
}
@ -248,13 +249,13 @@ public:
return number_of_vertices() - n;
}
Vertex_handle insert(const Weighted_point &,
const Locate_type,
const Face &,
const Facet &,
Vertex_handle insert(const Weighted_point &,
const Locate_type,
const Face &,
const Facet &,
const Full_cell_handle);
Vertex_handle insert(const Weighted_point & p,
Vertex_handle insert(const Weighted_point & p,
const Full_cell_handle start = Full_cell_handle())
{
Locate_type lt;
@ -274,14 +275,14 @@ public:
Vertex_handle insert_in_conflicting_cell(
const Weighted_point &, const Full_cell_handle,
const Vertex_handle only_if_this_vertex_is_in_the_cz = Vertex_handle());
Vertex_handle insert_if_in_star(const Weighted_point &,
const Vertex_handle,
const Locate_type,
const Face &,
const Facet &,
Vertex_handle insert_if_in_star(const Weighted_point &,
const Vertex_handle,
const Locate_type,
const Face &,
const Facet &,
const Full_cell_handle);
Vertex_handle insert_if_in_star(
const Weighted_point & p, const Vertex_handle star_center,
const Full_cell_handle start = Full_cell_handle())
@ -294,7 +295,7 @@ public:
}
Vertex_handle insert_if_in_star(
const Weighted_point & p, const Vertex_handle star_center,
const Weighted_point & p, const Vertex_handle star_center,
const Vertex_handle hint)
{
CGAL_assertion( Vertex_handle() != hint );
@ -350,7 +351,7 @@ public:
Orientation o = ori_(
boost::make_transform_iterator(s->vertices_begin(), spivi),
boost::make_transform_iterator(s->vertices_begin() + cur_dim_ + 1,
boost::make_transform_iterator(s->vertices_begin() + cur_dim_ + 1,
spivi));
if( POSITIVE == o )
@ -379,16 +380,16 @@ public:
return pred_(rt_.full_cell(f)->neighbor(rt_.index_of_covertex(f)));
}
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VALIDITY
bool is_valid(bool verbose = false, int level = 0) const;
private:
template<typename InputIterator>
bool
does_cell_range_contain_vertex(InputIterator cz_begin, InputIterator cz_end,
does_cell_range_contain_vertex(InputIterator cz_begin, InputIterator cz_end,
Vertex_handle vh) const
{
// Check all vertices
@ -407,7 +408,7 @@ private:
template<typename InputIterator, typename OutputIterator>
void
process_conflict_zone(InputIterator cz_begin, InputIterator cz_end,
process_conflict_zone(InputIterator cz_begin, InputIterator cz_end,
OutputIterator vertices_out) const
{
// Get all vertices
@ -427,10 +428,10 @@ private:
}
}
template<typename InputIterator>
void
process_cz_vertices_after_insertion(InputIterator vertices_begin,
process_cz_vertices_after_insertion(InputIterator vertices_begin,
InputIterator vertices_end)
{
// Get all vertices
@ -458,14 +459,14 @@ private:
Conflict_traversal_pred_in_subspace;
typedef Conflict_traversal_predicate<Conflict_pred_in_fullspace>
Conflict_traversal_pred_in_fullspace;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MEMBER VARIABLES
std::vector<Weighted_point> m_hidden_points;
}; // class Regular_triangulation
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// FUNCTIONS THAT ARE MEMBER METHODS:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REMOVALS
@ -540,8 +541,8 @@ Regular_triangulation<RTTraits, TDS>
typedef Triangulation_full_cell<
Geom_traits,
internal::Triangulation::Dark_full_cell_data<Self> > Dark_full_cell_base;
typedef Triangulation_data_structure<Maximal_dimension,
Dark_vertex_base,
typedef Triangulation_data_structure<Maximal_dimension,
Dark_vertex_base,
Dark_full_cell_base
> Dark_tds;
typedef Regular_triangulation<RTTraits, Dark_tds> Dark_triangulation;
@ -660,7 +661,7 @@ Regular_triangulation<RTTraits, TDS>
typedef typename Base::template Full_cell_set<Dark_s_handle> Dark_full_cells;
Dark_full_cells conflict_zone;
std::back_insert_iterator<Dark_full_cells> dark_out(conflict_zone);
dark_ft = dark_side.compute_conflict_zone(v->point(), dark_s, dark_out);
// Make the dark simplices in the conflict zone searchable
conflict_zone.make_searchable();
@ -685,8 +686,8 @@ Regular_triangulation<RTTraits, TDS>
dark_incident_s.clear();
dark_out = std::back_inserter(dark_incident_s);
dark_side.tds().incident_full_cells(dark_v, dark_out);
for(typename Dark_full_cells::iterator it = dark_incident_s.begin();
it != dark_incident_s.end();
for(typename Dark_full_cells::iterator it = dark_incident_s.begin();
it != dark_incident_s.end();
++it)
{
(*it)->data().count_ += 1;
@ -760,7 +761,7 @@ Regular_triangulation<RTTraits, TDS>
int li = light_s->index(dark_s->vertex(di)->data());
Rotor light_r(light_s, li, light_i);
typename Dark_triangulation::Rotor dark_r(dark_s, di, dark_i);
while( simps.contains(cpp11::get<0>(light_r)->neighbor(cpp11::get<1>(light_r))) )
light_r = rotate_rotor(light_r);
@ -870,9 +871,9 @@ Regular_triangulation<RTTraits, TDS>
template< typename RTTraits, typename TDS >
typename Regular_triangulation<RTTraits, TDS>::Vertex_handle
Regular_triangulation<RTTraits, TDS>
::insert_if_in_star(const Weighted_point & p,
::insert_if_in_star(const Weighted_point & p,
const Vertex_handle star_center,
const Locate_type lt, const Face & f, const Facet & ft,
const Locate_type lt, const Face & f, const Facet & ft,
const Full_cell_handle s)
{
switch( lt )
@ -914,7 +915,7 @@ Regular_triangulation<RTTraits, TDS>
template< typename RTTraits, typename TDS >
typename Regular_triangulation<RTTraits, TDS>::Vertex_handle
Regular_triangulation<RTTraits, TDS>
::insert_in_conflicting_cell(const Weighted_point & p,
::insert_in_conflicting_cell(const Weighted_point & p,
const Full_cell_handle s,
const Vertex_handle only_if_this_vertex_is_in_the_cz)
{
@ -950,10 +951,10 @@ Regular_triangulation<RTTraits, TDS>
cs.reserve(64);
std::back_insert_iterator<Full_cell_h_vector> out(cs);
Facet ft = compute_conflict_zone(p, s, out);
// Check if the CZ contains "only_if_this_vertex_is_in_the_cz"
if (only_if_this_vertex_is_in_the_cz != Vertex_handle()
&& !does_cell_range_contain_vertex(cs.begin(), cs.end(),
&& !does_cell_range_contain_vertex(cs.begin(), cs.end(),
only_if_this_vertex_is_in_the_cz))
{
return Vertex_handle();
@ -962,7 +963,7 @@ Regular_triangulation<RTTraits, TDS>
// Otherwise, proceed with the insertion
std::vector<Vertex_handle> cz_vertices;
cz_vertices.reserve(64);
process_conflict_zone(cs.begin(), cs.end(),
process_conflict_zone(cs.begin(), cs.end(),
std::back_inserter(cz_vertices));
Vertex_handle ret = insert_in_hole(p, cs.begin(), cs.end(), ft);
@ -1043,8 +1044,8 @@ Regular_triangulation<RTTraits, TDS>
if( current_dimension() < maximal_dimension() )
{
Conflict_pred_in_subspace c(
*this, p,
coaffine_orientation_predicate(),
*this, p,
coaffine_orientation_predicate(),
power_test_in_flat_predicate());
return c(s);
}
@ -1067,8 +1068,8 @@ Regular_triangulation<RTTraits, TDS>
if( current_dimension() < maximal_dimension() )
{
Conflict_pred_in_subspace c(
*this, p,
coaffine_orientation_predicate(),
*this, p,
coaffine_orientation_predicate(),
power_test_in_flat_predicate());
Conflict_traversal_pred_in_subspace tp(*this, c);
return tds().gather_full_cells(s, tp, out);
@ -1089,7 +1090,7 @@ template< typename RTTraits, typename TDS >
bool
Regular_triangulation<RTTraits, TDS>
::is_valid(bool verbose, int level) const
{
{
if (!Base::is_valid(verbose, level))
return false;
@ -1100,16 +1101,16 @@ Regular_triangulation<RTTraits, TDS>
cit != finite_full_cells_end() ; ++cit )
{
Full_cell_const_handle ch = cit.base();
for(int i = 0; i < dim+1 ; ++i )
for(int i = 0; i < dim+1 ; ++i )
{
// If the i-th neighbor is not an infinite cell
Vertex_handle opposite_vh =
Vertex_handle opposite_vh =
ch->neighbor(i)->vertex(ch->neighbor(i)->index(ch));
if (!is_infinite(opposite_vh))
{
Power_test_d side =
Power_test_d side =
geom_traits().power_test_d_object();
if (side(Point_const_iterator(ch->vertices_begin()),
if (side(Point_const_iterator(ch->vertices_begin()),
Point_const_iterator(ch->vertices_end()),
opposite_vh->point()) == ON_POSITIVE_SIDE)
{

View File

@ -24,7 +24,6 @@
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Weighted_point.h>
#include <CGAL/representation_tags.h>
#include <CGAL/Kernel_traits.h>
#include <boost/iterator/transform_iterator.hpp>

View File

@ -713,7 +713,9 @@ Triangulation_data_structure<Dim, Vb, Fcb>
}
}
}
clear_visited_marks(start);
clear_visited_marks(start); // CJTODO: couldn't we use what is in "out"
// to make ot faster? (would require to
// replace the output iterator by a container)
return ft;
}
@ -999,7 +1001,7 @@ Triangulation_data_structure<Dim, Vb, Fcb>
associate_vertex_with_full_cell(new_s, facet_index, v);
set_neighbors(new_s,
facet_index,
neighbor(old_s, facet_index),
outside_neighbor,
mirror_index(old_s, facet_index));
// add the new full_cell to the list of new full_cells

View File

@ -281,7 +281,7 @@ public:
#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
{
#ifdef CGAL_TRIANGULATION_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
size_type n = number_of_vertices();
@ -622,7 +622,7 @@ public:
size_type n = number_of_vertices();
#ifdef CGAL_TRIANGULATION_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
// Parallel

View File

@ -208,7 +208,7 @@ namespace CGAL {
#endif
#ifdef CGAL_TRIANGULATION_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
size_type n = number_of_vertices();
@ -618,7 +618,7 @@ namespace CGAL {
size_type n = number_of_vertices();
#ifdef CGAL_TRIANGULATION_3_PROFILING
WallClockTimer t;
Wall_clock_timer t;
#endif
// Parallel