mirror of https://github.com/CGAL/cgal
Merge branch 'Triangulation-add_regular_tri-cjamin_mglisse-old' into Triangulation-add_regular_tri-cjamin_mglisse
This commit is contained in:
commit
6078634d07
|
|
@ -26,6 +26,7 @@
|
|||
#include <CGAL/NewKernel_d/Kernel_d_interface.h>
|
||||
#include <CGAL/internal/Exact_type_selector.h>
|
||||
#include <CGAL/Interval_nt.h>
|
||||
#include <CGAL/NewKernel_d/Types/Weighted_point.h>
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ struct Cartesian_LA_base_d : public Dimension_base<Dim_>
|
|||
::add<Segment_tag>::type
|
||||
::add<Hyperplane_tag>::type
|
||||
::add<Sphere_tag>::type
|
||||
::add<Weighted_point_tag>::type
|
||||
Object_list;
|
||||
|
||||
typedef typeset< Point_cartesian_const_iterator_tag>::type
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ template<class R_> struct Construct_flat_orientation : private Store_kernel<R_>
|
|||
std::vector<int>& rest=o.rest; rest.reserve(dim+1);
|
||||
for(int i=0; i<dim+1; ++i) rest.push_back(i);
|
||||
for( ; f != e ; ++col, ++f ) {
|
||||
//std::cerr << "(*f)[0]=" << (*f)[0] << std::endl;
|
||||
Point const&p=*f;
|
||||
// use a coordinate iterator instead?
|
||||
for(int i=0; i<dim; ++i) coord(col, i) = ccc(p, i);
|
||||
|
|
@ -268,11 +269,61 @@ template<class R_> struct In_flat_side_of_oriented_sphere : private Store_kernel
|
|||
}
|
||||
};
|
||||
|
||||
template<class R_> struct In_flat_power_test_raw : private Store_kernel<R_> {
|
||||
CGAL_FUNCTOR_INIT_STORE(In_flat_power_test_raw)
|
||||
typedef R_ R;
|
||||
typedef typename Get_type<R, FT_tag>::type FT;
|
||||
typedef typename Get_type<R, Point_tag>::type Point;
|
||||
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
||||
typedef typename Increment_dimension<typename R::Default_ambient_dimension,2>::type D1;
|
||||
typedef typename Increment_dimension<typename R::Max_ambient_dimension,2>::type D2;
|
||||
typedef typename R::LA::template Rebind_dimension<D1,D2>::Other LA;
|
||||
typedef typename LA::Square_matrix Matrix;
|
||||
|
||||
template<class Iter, class IterW, class Wt>
|
||||
result_type operator()(Flat_orientation const&o, Iter f, Iter e, IterW fw, Point const&x, Wt const&w) const {
|
||||
// TODO: can't work in the projection, but we should at least remove the row of 1s.
|
||||
typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
|
||||
int d=pd(*f);
|
||||
Matrix m(d+2,d+2);
|
||||
int i=0;
|
||||
for(;f!=e;++f,++fw,++i) {
|
||||
Point const& p=*f;
|
||||
m(i,0)=1;
|
||||
m(i,d+1)=-*fw;
|
||||
for(int j=0;j<d;++j){
|
||||
m(i,j+1)=c(p,j);
|
||||
m(i,d+1)+=CGAL_NTS square(m(i,j+1));
|
||||
}
|
||||
}
|
||||
for(std::vector<int>::const_iterator it = o.rest.begin(); it != o.rest.end() /* i<d+1 */; ++i, ++it) {
|
||||
m(i,0)=1;
|
||||
for(int j=0;j<d;++j){
|
||||
m(i,j+1)=0; // unneeded if the matrix is initialized to 0
|
||||
}
|
||||
if(*it != d) m(i,d+1)=m(i,1+*it)=1;
|
||||
else m(i,d+1)=0;
|
||||
}
|
||||
m(d+1,0)=1;
|
||||
m(d+1,d+1)=-w;
|
||||
for(int j=0;j<d;++j){
|
||||
m(d+1,j+1)=c(x,j);
|
||||
m(d+1,d+1)+=CGAL_NTS square(m(d+1,j+1));
|
||||
}
|
||||
|
||||
result_type ret = -LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
if(o.reverse) ret=-ret;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
CGAL_KD_DEFAULT_TYPE(Flat_orientation_tag,(CGAL::CartesianDKernelFunctors::Flat_orientation),(),());
|
||||
CGAL_KD_DEFAULT_FUNCTOR(In_flat_orientation_tag,(CartesianDKernelFunctors::In_flat_orientation<K>),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(In_flat_side_of_oriented_sphere_tag,(CartesianDKernelFunctors::In_flat_side_of_oriented_sphere<K>),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(In_flat_power_test_raw_tag,(CartesianDKernelFunctors::In_flat_power_test_raw<K>),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Construct_flat_orientation_tag,(CartesianDKernelFunctors::Construct_flat_orientation<K>),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag,In_flat_orientation_tag));
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Contained_in_affine_hull_tag,(CartesianDKernelFunctors::Contained_in_affine_hull<K>),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
typedef typename Get_type<Base, Ray_tag>::type Ray_d;
|
||||
typedef typename Get_type<Base, Iso_box_tag>::type Iso_box_d;
|
||||
typedef typename Get_type<Base, Aff_transformation_tag>::type Aff_transformation_d;
|
||||
typedef typename Get_type<Base, Weighted_point_tag>::type Weighted_point_d;
|
||||
typedef typename Get_functor<Base, Compute_point_cartesian_coordinate_tag>::type Compute_coordinate_d;
|
||||
typedef typename Get_functor<Base, Compare_lexicographically_tag>::type Compare_lexicographically_d;
|
||||
typedef typename Get_functor<Base, Equal_points_tag>::type Equal_d;
|
||||
|
|
@ -64,10 +65,12 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
typedef typename Get_functor<Base, Less_point_cartesian_coordinate_tag>::type Less_coordinate_d;
|
||||
typedef typename Get_functor<Base, Point_dimension_tag>::type Point_dimension_d;
|
||||
typedef typename Get_functor<Base, Side_of_oriented_sphere_tag>::type Side_of_oriented_sphere_d;
|
||||
typedef typename Get_functor<Base, Power_test_tag>::type Power_test_d;
|
||||
typedef typename Get_functor<Base, Contained_in_affine_hull_tag>::type Contained_in_affine_hull_d;
|
||||
typedef typename Get_functor<Base, Construct_flat_orientation_tag>::type Construct_flat_orientation_d;
|
||||
typedef typename Get_functor<Base, In_flat_orientation_tag>::type In_flat_orientation_d;
|
||||
typedef typename Get_functor<Base, In_flat_side_of_oriented_sphere_tag>::type In_flat_side_of_oriented_sphere_d;
|
||||
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, Scaled_vector_tag>::type Scaled_vector_d;
|
||||
|
|
@ -83,6 +86,7 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
typedef typename Get_functor<Base, Construct_ttag<Ray_tag> >::type Construct_ray_d;
|
||||
typedef typename Get_functor<Base, Construct_ttag<Iso_box_tag> >::type Construct_iso_box_d;
|
||||
typedef typename Get_functor<Base, Construct_ttag<Aff_transformation_tag> >::type Construct_aff_transformation_d;
|
||||
typedef typename Get_functor<Base, Construct_ttag<Weighted_point_tag> >::type Construct_weighted_point_d;
|
||||
typedef typename Get_functor<Base, Midpoint_tag>::type Midpoint_d;
|
||||
struct Component_accessor_d : private Store_kernel<Kernel> {
|
||||
typedef Kernel R_; // for the macro
|
||||
|
|
@ -150,6 +154,9 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
typedef typename Get_functor<Base, Orthogonal_vector_tag>::type Orthogonal_vector_d;
|
||||
typedef typename Get_functor<Base, Linear_base_tag>::type Linear_base_d;
|
||||
|
||||
typedef typename Get_functor<Base, Point_weight_tag>::type Point_weight_d;
|
||||
typedef typename Get_functor<Base, Point_drop_weight_tag>::type Point_drop_weight_d;
|
||||
|
||||
//TODO:
|
||||
//typedef ??? Intersect_d;
|
||||
|
||||
|
|
@ -166,6 +173,7 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
Point_dimension_d point_dimension_d_object()const{ return Point_dimension_d(*this); }
|
||||
Point_of_sphere_d point_of_sphere_d_object()const{ return Point_of_sphere_d(*this); }
|
||||
Side_of_oriented_sphere_d side_of_oriented_sphere_d_object()const{ return Side_of_oriented_sphere_d(*this); }
|
||||
Power_test_d power_test_d_object()const{ return Power_test_d(*this); }
|
||||
Side_of_bounded_sphere_d side_of_bounded_sphere_d_object()const{ return Side_of_bounded_sphere_d(*this); }
|
||||
Contained_in_affine_hull_d contained_in_affine_hull_d_object()const{ return Contained_in_affine_hull_d(*this); }
|
||||
Contained_in_linear_hull_d contained_in_linear_hull_d_object()const{ return Contained_in_linear_hull_d(*this); }
|
||||
|
|
@ -173,6 +181,7 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
Construct_flat_orientation_d construct_flat_orientation_d_object()const{ return Construct_flat_orientation_d(*this); }
|
||||
In_flat_orientation_d in_flat_orientation_d_object()const{ return In_flat_orientation_d(*this); }
|
||||
In_flat_side_of_oriented_sphere_d in_flat_side_of_oriented_sphere_d_object()const{ return In_flat_side_of_oriented_sphere_d(*this); }
|
||||
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); }
|
||||
Scaled_vector_d scaled_vector_d_object()const{ return Scaled_vector_d(*this); }
|
||||
|
|
@ -203,6 +212,10 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
|
|||
Construct_ray_d construct_ray_d_object()const{ return Construct_ray_d(*this); }
|
||||
Construct_iso_box_d construct_iso_box_d_object()const{ return Construct_iso_box_d(*this); }
|
||||
Construct_aff_transformation_d construct_aff_transformation_d_object()const{ return Construct_aff_transformation_d(*this); }
|
||||
Construct_weighted_point_d construct_weighted_point_d_object()const{ return Construct_weighted_point_d(*this); }
|
||||
|
||||
Point_weight_d point_weight_d_object()const{ return Point_weight_d(*this); }
|
||||
Point_drop_weight_d point_drop_weight_d_object()const{ return Point_drop_weight_d(*this); }
|
||||
|
||||
// Dummies for those required functors missing a concept.
|
||||
typedef Null_functor Position_on_line_d;
|
||||
|
|
|
|||
|
|
@ -117,5 +117,17 @@ template <class K1, class K2> struct KO_converter<Sphere_tag,K1,K2>{
|
|||
}
|
||||
};
|
||||
|
||||
template <class K1, class K2> struct KO_converter<Weighted_point_tag,K1,K2>{
|
||||
typedef typename Get_type<K1, Weighted_point_tag>::type argument_type;
|
||||
typedef typename Get_type<K2, Weighted_point_tag>::type result_type;
|
||||
template <class C>
|
||||
result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& s) const {
|
||||
typename Get_functor<K1, Point_drop_weight_tag>::type pdw(k1);
|
||||
typename Get_functor<K1, Point_weight_tag>::type pw(k1);
|
||||
typename Get_functor<K2, Construct_ttag<Weighted_point_tag> >::type cwp(k2);
|
||||
return cwp(conv(pdw(s)),conv(pw(s)));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,125 @@
|
|||
// 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_KD_TYPE_WP_H
|
||||
#define CGAL_KD_TYPE_WP_H
|
||||
#include <CGAL/NewKernel_d/store_kernel.h>
|
||||
#include <boost/iterator/counting_iterator.hpp>
|
||||
namespace CGAL {
|
||||
namespace KerD {
|
||||
template <class R_> class Weighted_point {
|
||||
typedef typename Get_type<R_, FT_tag>::type FT_;
|
||||
typedef typename Get_type<R_, Point_tag>::type Point_;
|
||||
Point_ c_;
|
||||
FT_ w_;
|
||||
|
||||
public:
|
||||
Weighted_point(Point_ const&p, FT_ const&w): c_(p), w_(w) {}
|
||||
// TODO: Add a piecewise constructor?
|
||||
|
||||
Point_ const& point()const{return c_;}
|
||||
FT_ const& weight()const{return w_;}
|
||||
};
|
||||
}
|
||||
|
||||
namespace CartesianDKernelFunctors {
|
||||
template <class R_> struct Construct_weighted_point : Store_kernel<R_> {
|
||||
CGAL_FUNCTOR_INIT_STORE(Construct_weighted_point)
|
||||
typedef typename Get_type<R_, Weighted_point_tag>::type result_type;
|
||||
typedef typename Get_type<R_, Point_tag>::type Point;
|
||||
typedef typename Get_type<R_, FT_tag>::type FT;
|
||||
result_type operator()(Point const&a, FT const&b)const{
|
||||
return result_type(a,b);
|
||||
}
|
||||
// Not really needed
|
||||
result_type operator()()const{
|
||||
typename Get_functor<R_, Construct_ttag<Point_tag> >::type cp(this->kernel());
|
||||
return result_type(cp(),0);
|
||||
}
|
||||
};
|
||||
|
||||
template <class R_> struct Point_drop_weight {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Point_drop_weight)
|
||||
typedef typename Get_type<R_, Weighted_point_tag>::type argument_type;
|
||||
typedef typename Get_type<R_, Point_tag>::type const& result_type;
|
||||
// Returning a reference is fragile
|
||||
|
||||
result_type operator()(argument_type const&s)const{
|
||||
return s.point();
|
||||
}
|
||||
};
|
||||
|
||||
template <class R_> struct Point_weight {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Point_weight)
|
||||
typedef typename Get_type<R_, Weighted_point_tag>::type argument_type;
|
||||
typedef typename Get_type<R_, FT_tag>::type result_type;
|
||||
|
||||
result_type operator()(argument_type const&s)const{
|
||||
return s.weight();
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Power_test : private Store_kernel<R_> {
|
||||
CGAL_FUNCTOR_INIT_STORE(Power_test)
|
||||
typedef R_ R;
|
||||
typedef typename Get_type<R, Oriented_side_tag>::type result_type;
|
||||
|
||||
template<class Iter, class Pt>
|
||||
result_type operator()(Iter const& f, Iter const& e, Pt const& p0) const {
|
||||
typename Get_functor<R, Power_test_raw_tag>::type ptr(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());
|
||||
return ptr (
|
||||
make_transforming_iterator (f, pdw),
|
||||
make_transforming_iterator (e, pdw),
|
||||
make_transforming_iterator (f, pw),
|
||||
pdw (p0),
|
||||
pw (p0));
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct In_flat_power_test : private Store_kernel<R_> {
|
||||
CGAL_FUNCTOR_INIT_STORE(In_flat_power_test)
|
||||
typedef R_ R;
|
||||
typedef typename Get_type<R, Oriented_side_tag>::type result_type;
|
||||
|
||||
template<class Fo, class Iter, class Pt>
|
||||
result_type operator()(Fo const& fo, Iter const& f, Iter const& e, Pt const& p0) const {
|
||||
typename Get_functor<R, In_flat_power_test_raw_tag>::type ptr(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());
|
||||
return ptr (
|
||||
fo,
|
||||
make_transforming_iterator (f, pdw),
|
||||
make_transforming_iterator (e, pdw),
|
||||
make_transforming_iterator (f, pw),
|
||||
pdw (p0),
|
||||
pw (p0));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
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),());
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Point_drop_weight_tag,(CartesianDKernelFunctors::Point_drop_weight<K>),(Weighted_point_tag,Point_tag),());
|
||||
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));
|
||||
} // namespace CGAL
|
||||
#endif
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
#include <CGAL/NewKernel_d/Wrapper/Segment_d.h>
|
||||
#include <CGAL/NewKernel_d/Wrapper/Sphere_d.h>
|
||||
#include <CGAL/NewKernel_d/Wrapper/Hyperplane_d.h>
|
||||
#include <CGAL/NewKernel_d/Wrapper/Weighted_point_d.h>
|
||||
|
||||
#include <CGAL/NewKernel_d/Wrapper/Ref_count_obj.h>
|
||||
|
||||
|
|
@ -106,6 +107,7 @@ CGAL_REGISTER_OBJECT_WRAPPER(Vector);
|
|||
CGAL_REGISTER_OBJECT_WRAPPER(Segment);
|
||||
CGAL_REGISTER_OBJECT_WRAPPER(Sphere);
|
||||
CGAL_REGISTER_OBJECT_WRAPPER(Hyperplane);
|
||||
CGAL_REGISTER_OBJECT_WRAPPER(Weighted_point);
|
||||
#undef CGAL_REGISTER_OBJECT_WRAPPER
|
||||
|
||||
// Note: this tends to be an all or nothing thing currently, wrapping
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
// 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_WRAPPER_WEIGHTED_POINT_D_H
|
||||
#define CGAL_WRAPPER_WEIGHTED_POINT_D_H
|
||||
|
||||
#include <CGAL/representation_tags.h>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#ifndef CGAL_CXX11
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Wrap {
|
||||
|
||||
template <class R_>
|
||||
class Weighted_point_d : public Get_type<typename R_::Kernel_base, Weighted_point_tag>::type
|
||||
{
|
||||
typedef typename Get_type<R_, FT_tag>::type FT_;
|
||||
typedef typename R_::Kernel_base Kbase;
|
||||
typedef typename Get_type<R_, Point_tag>::type Point_;
|
||||
typedef typename Get_functor<Kbase, Construct_ttag<Weighted_point_tag> >::type CWPBase;
|
||||
typedef typename Get_functor<Kbase, Point_drop_weight_tag>::type PDWBase;
|
||||
typedef typename Get_functor<Kbase, Point_weight_tag>::type PWBase;
|
||||
|
||||
typedef Weighted_point_d Self;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Self, typename Get_type<R_, Weighted_point_tag>::type>::value));
|
||||
|
||||
public:
|
||||
|
||||
typedef Tag_true Is_wrapper;
|
||||
typedef typename R_::Default_ambient_dimension Ambient_dimension;
|
||||
typedef Dimension_tag<0> Feature_dimension;
|
||||
|
||||
typedef typename Get_type<Kbase, Weighted_point_tag>::type Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rep& rep()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
typedef R_ R;
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
template<class...U,class=typename std::enable_if<!std::is_same<std::tuple<typename std::decay<U>::type...>,std::tuple<Weighted_point_d> >::value>::type> explicit Weighted_point_d(U&&...u)
|
||||
: Rep(CWPBase()(std::forward<U>(u)...)){}
|
||||
|
||||
// // called from Construct_point_d
|
||||
// template<class...U> explicit Point_d(Eval_functor&&,U&&...u)
|
||||
// : Rep(Eval_functor(), std::forward<U>(u)...){}
|
||||
template<class F,class...U> explicit Weighted_point_d(Eval_functor&&,F&&f,U&&...u)
|
||||
: Rep(std::forward<F>(f)(std::forward<U>(u)...)){}
|
||||
|
||||
#if 0
|
||||
// the new standard may make this necessary
|
||||
Point_d(Point_d const&)=default;
|
||||
Point_d(Point_d &);//=default;
|
||||
Point_d(Point_d &&)=default;
|
||||
#endif
|
||||
|
||||
// try not to use these
|
||||
Weighted_point_d(Rep const& v) : Rep(v) {}
|
||||
Weighted_point_d(Rep& v) : Rep(static_cast<Rep const&>(v)) {}
|
||||
Weighted_point_d(Rep&& v) : Rep(std::move(v)) {}
|
||||
|
||||
#else
|
||||
|
||||
Weighted_point_d() : Rep(CWPBase()()) {}
|
||||
|
||||
Weighted_point_d(Rep const& v) : Rep(v) {} // try not to use it
|
||||
|
||||
#define CGAL_CODE(Z,N,_) template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
explicit Weighted_point_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(CWPBase()( \
|
||||
BOOST_PP_ENUM_PARAMS(N,t))) {} \
|
||||
\
|
||||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Weighted_point_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {}
|
||||
/*
|
||||
template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
*/
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_)
|
||||
#undef CGAL_CODE
|
||||
|
||||
#endif
|
||||
|
||||
//TODO: use references?
|
||||
Point_ point()const{
|
||||
return Point_(Eval_functor(),PDWBase(),rep());
|
||||
}
|
||||
FT_ weight()const{
|
||||
return PWBase()(rep());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} //namespace Wrap
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_WRAPPER_SPHERE_D_H
|
||||
|
|
@ -549,6 +549,60 @@ template<class R_> struct Orientation<R_,false> : private Store_kernel<R_> {
|
|||
}
|
||||
#endif
|
||||
|
||||
namespace CartesianDKernelFunctors {
|
||||
template<class R_> struct Power_test_raw : private Store_kernel<R_> {
|
||||
CGAL_FUNCTOR_INIT_STORE(Power_test_raw)
|
||||
typedef R_ R;
|
||||
typedef typename Get_type<R, RT_tag>::type RT;
|
||||
typedef typename Get_type<R, FT_tag>::type FT;
|
||||
typedef typename Get_type<R, Point_tag>::type Point;
|
||||
typedef typename Get_type<R, Oriented_side_tag>::type result_type;
|
||||
typedef typename Increment_dimension<typename R::Default_ambient_dimension>::type D1;
|
||||
typedef typename Increment_dimension<typename R::Max_ambient_dimension>::type D2;
|
||||
typedef typename R::LA::template Rebind_dimension<D1,D2>::Other LA;
|
||||
typedef typename LA::Square_matrix Matrix;
|
||||
|
||||
template<class IterP, class IterW, class Pt, class Wt>
|
||||
result_type operator()(IterP f, IterP const& e, IterW fw, Pt const& p0, Wt const& w0) const {
|
||||
typedef typename Get_functor<R, Squared_distance_to_origin_tag>::type Sqdo;
|
||||
typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
|
||||
typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
|
||||
|
||||
int d=pd(p0);
|
||||
Matrix m(d+1,d+1);
|
||||
if(CGAL::Is_stored<Sqdo>::value) {
|
||||
Sqdo sqdo(this->kernel());
|
||||
FT const& h0 = sqdo(p0) - w0;
|
||||
for(int i=0;f!=e;++f,++fw,++i) {
|
||||
Point const& p=*f;
|
||||
for(int j=0;j<d;++j){
|
||||
RT const& x=c(p,j);
|
||||
m(i,j)=x-c(p0,j);
|
||||
}
|
||||
m(i,d) = sqdo(p) - *fw - h0;
|
||||
}
|
||||
} else {
|
||||
for(int i=0;f!=e;++f,++fw,++i) {
|
||||
Point const& p=*f;
|
||||
m(i,d) = w0 - *fw;
|
||||
for(int j=0;j<d;++j){
|
||||
RT const& x=c(p,j);
|
||||
m(i,j)=x-c(p0,j);
|
||||
m(i,d)+=CGAL::square(m(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(d%2)
|
||||
return -LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
else
|
||||
return LA::sign_of_determinant(CGAL_MOVE(m));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CGAL_KD_DEFAULT_FUNCTOR(Power_test_raw_tag,(CartesianDKernelFunctors::Power_test_raw<K>),(Point_tag),(Point_dimension_tag,Squared_distance_to_origin_tag,Compute_point_cartesian_coordinate_tag));
|
||||
|
||||
// TODO: make Side_of_oriented_sphere call Power_test_raw
|
||||
namespace CartesianDKernelFunctors {
|
||||
template<class R_> struct Side_of_oriented_sphere : private Store_kernel<R_> {
|
||||
CGAL_FUNCTOR_INIT_STORE(Side_of_oriented_sphere)
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ namespace CGAL {
|
|||
CGAL_DECL_OBJ(Iso_box, Object);
|
||||
CGAL_DECL_OBJ(Bbox, Object);
|
||||
CGAL_DECL_OBJ(Aff_transformation, Object);
|
||||
CGAL_DECL_OBJ(Weighted_point, Object);
|
||||
#undef CGAL_DECL_OBJ_
|
||||
#undef CGAL_DECL_OBJ
|
||||
|
||||
|
|
@ -216,6 +217,7 @@ namespace CGAL {
|
|||
CGAL_DECL_COMPUTE(Scalar_product);
|
||||
CGAL_DECL_COMPUTE(Hyperplane_translation);
|
||||
CGAL_DECL_COMPUTE(Value_at);
|
||||
CGAL_DECL_COMPUTE(Point_weight);
|
||||
#undef CGAL_DECL_COMPUTE
|
||||
|
||||
#define CGAL_DECL_ITER_OBJ(X,Y,Z,C) struct X##_tag {}; \
|
||||
|
|
@ -265,6 +267,7 @@ namespace CGAL {
|
|||
CGAL_DECL_CONSTRUCT(Translated_point,Point);
|
||||
CGAL_DECL_CONSTRUCT(Point_to_vector,Vector);
|
||||
CGAL_DECL_CONSTRUCT(Vector_to_point,Point);
|
||||
CGAL_DECL_CONSTRUCT(Point_drop_weight,Point);
|
||||
#undef CGAL_DECL_CONSTRUCT
|
||||
#if 0
|
||||
#define CGAL_DECL_ITER_CONSTRUCT(X,Y) struct X##_tag {}; \
|
||||
|
|
@ -304,6 +307,10 @@ namespace CGAL {
|
|||
CGAL_DECL_PREDICATE(Affinely_independent);
|
||||
CGAL_DECL_PREDICATE(Contained_in_linear_hull);
|
||||
CGAL_DECL_PREDICATE(Contained_in_simplex);
|
||||
CGAL_DECL_PREDICATE(Power_test_raw);
|
||||
CGAL_DECL_PREDICATE(Power_test);
|
||||
CGAL_DECL_PREDICATE(In_flat_power_test_raw);
|
||||
CGAL_DECL_PREDICATE(In_flat_power_test);
|
||||
#undef CGAL_DECL_PREDICATE
|
||||
|
||||
#define CGAL_DECL_MISC(X) struct X##_tag {}; \
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#include <boost/type_traits/is_empty.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <CGAL/Default.h>
|
||||
#include <utility>
|
||||
|
||||
|
|
@ -54,23 +58,31 @@ template<class T> struct Functor_as_base<T,true> : public T {
|
|||
template <typename Derived, typename F, typename Iter, typename Ref, typename Val>
|
||||
class transforming_iterator_helper
|
||||
{
|
||||
typedef std::iterator_traits<Iter> Iter_traits;
|
||||
typedef typename Iter_traits::reference Iter_ref;
|
||||
typedef typename Default::Get<Ref,
|
||||
#ifdef CGAL_CXX11
|
||||
decltype(std::declval<F>()(std::declval<typename std::iterator_traits<Iter>::reference>()))
|
||||
decltype(std::declval<F>()(std::declval<Iter_ref>()))
|
||||
#else
|
||||
typename boost::result_of<F(typename std::iterator_traits<Iter>::value_type)>::type
|
||||
typename boost::result_of<F(typename Iter_traits::value_type)>::type
|
||||
// should be reference instead of value_type
|
||||
#endif
|
||||
>::type reference;
|
||||
>::type reference_;
|
||||
|
||||
typedef typename Default::Get<Val,typename boost::remove_cv<typename boost::remove_reference<reference>::type>::type>::type value_type;
|
||||
typedef typename Default::Get<Val,typename boost::remove_cv<typename boost::remove_reference<reference_>::type>::type>::type value_type;
|
||||
|
||||
// Crappy heuristic. If we have *it that returns a Weighted_point and F that returns a reference to the Point contained in the Weighted_point it takes as argument, we do NOT want the transformed iterator to return a reference to the temporary *it. On the other hand, if *it returns an int n, and F returns a reference to array[n] it is not so good to lose the reference. This probably should be done elsewhere and should at least be made optional...
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::mpl::or_<boost::is_reference<Iter_ref>,
|
||||
boost::is_integral<Iter_ref> >,
|
||||
reference_, value_type>::type reference;
|
||||
|
||||
public:
|
||||
typedef boost::iterator_adaptor<
|
||||
Derived,
|
||||
Iter,
|
||||
value_type,
|
||||
typename std::iterator_traits<Iter>::iterator_category,
|
||||
typename Iter_traits::iterator_category,
|
||||
reference
|
||||
> type;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <CGAL/Interval_nt.h>
|
||||
#include <CGAL/use.h>
|
||||
#include <iostream>
|
||||
#include <CGAL/NewKernel_d/Types/Weighted_point.h>
|
||||
|
||||
//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;
|
||||
|
|
@ -493,6 +494,7 @@ void test3(){
|
|||
P x4=cp(0,0,1);
|
||||
P x5=cp(0,0,0);
|
||||
P x6=cp(0,0,-1);
|
||||
assert(!ed(x1,x2));
|
||||
P tab2[]={x1,x2,x3,x4,x5};
|
||||
assert(cis(tab2+0,tab2+4,x5));
|
||||
assert(po(tab2+0,tab2+4)==CGAL::POSITIVE);
|
||||
|
|
@ -540,6 +542,26 @@ void test3(){
|
|||
assert(ifsos(fozn, tz+0, tz+3, tz[4]) == CGAL::ON_NEGATIVE_SIDE);
|
||||
assert(ifsos(fozp, tz+0, tz+3, tz[5]) == CGAL::ON_NEGATIVE_SIDE);
|
||||
assert(ifsos(fozn, tz+0, tz+3, tz[5]) == CGAL::ON_POSITIVE_SIDE);
|
||||
|
||||
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;
|
||||
typedef typename K1::Power_test_d PT;
|
||||
typedef typename K1::In_flat_power_test_d IFPT;
|
||||
CWP cwp Kinit(construct_weighted_point_d_object);
|
||||
PDW pdw Kinit(point_drop_weight_d_object);
|
||||
PW pw Kinit(point_weight_d_object);
|
||||
PT pt Kinit(power_test_d_object);
|
||||
IFPT ifpt Kinit(in_flat_power_test_d_object);
|
||||
WP wp;
|
||||
wp = cwp (x1, 2);
|
||||
WP xw6 = cwp (x6, 0);
|
||||
assert (pw(wp) == 2);
|
||||
assert (ed(pdw(wp), x1));
|
||||
WP tabw[]={cwp(x1,0),cwp(x2,0),cwp(x3,0),cwp(x4,0),cwp(x5,0)};
|
||||
assert(pt(tabw+0,tabw+4,tabw[4])==CGAL::ON_POSITIVE_SIDE);
|
||||
assert(ifpt(fo4,tabw+0,tabw+3,xw6)==CGAL::ON_POSITIVE_SIDE);
|
||||
}
|
||||
template struct CGAL::Epick_d<CGAL::Dimension_tag<2> >;
|
||||
template struct CGAL::Epick_d<CGAL::Dimension_tag<3> >;
|
||||
|
|
|
|||
|
|
@ -155,6 +155,17 @@ namespace Eigen {
|
|||
MulCost = 100
|
||||
};
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
template<>
|
||||
struct significant_decimals_impl<CGAL::Gmpq>
|
||||
{
|
||||
static inline int run()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//since types are included by Gmp_coercion_traits.h:
|
||||
|
|
|
|||
|
|
@ -1283,6 +1283,13 @@ namespace Eigen {
|
|||
MulCost = 10
|
||||
};
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
template<class> struct significant_decimals_impl;
|
||||
template<bool b>
|
||||
struct significant_decimals_impl<CGAL::Interval_nt<b> >
|
||||
: significant_decimals_impl<typename CGAL::Interval_nt<b>::value_type> { };
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CGAL_INTERVAL_NT_H
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
2
|
||||
0.0071 1.6899 0
|
||||
0.3272 1.3694 0.05
|
||||
1.3697 1.8296 0.1
|
||||
0.6722 0.3012 0.15
|
||||
1.1726 0.1899 0.2
|
||||
0.4374 2.8541 100.25
|
||||
2.5923 0.1904 0.3
|
||||
1.3083 2.5462 200.35
|
||||
1.4981 1.3929 0.4
|
||||
2.1304 2.055 0.45
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
2
|
||||
0 0 6.28953
|
||||
-2.85086 -0.471442 6.12896
|
||||
1.90972 0.101219 0.988689
|
||||
0.637771 2.59367 5.80372
|
||||
2.22209 0.903198 2.19478
|
||||
-0.487202 -2.71506 4.90996
|
||||
1.1193 -1.91787 2.99626
|
||||
1.54714 0.109831 0
|
||||
0.44556 -2.73047 4.48142
|
||||
0.427936 1.28495 6.23624
|
||||
-2.67212 0.766674 5.29623
|
||||
1.5763 -1.59828 2.58905
|
||||
-0.476603 2.2546 6.04797
|
||||
1.57172 -0.514711 6.11405
|
||||
1.84528 2.10139 5.53936
|
||||
-2.99827 -0.101677 5.92246
|
||||
-0.482122 -2.39584 4.44264
|
||||
-2.25558 -1.492 6.23448
|
||||
0.128475 -1.75125 3.18916
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
3
|
||||
0.0071 1.6899 2.521 0
|
||||
0.3272 1.3694 3.15 0.05
|
||||
1.3697 1.8296 2.654 0.1
|
||||
-10.6722 0.3012 0.1548 1000.15
|
||||
1.1726 0.1899 0.3658 0.2
|
||||
0.4374 20.8541 1.45894 2000.25
|
||||
2.5923 0.1904 0.6971 0.3
|
||||
10.3083 2.5462 1.3658 1000.35
|
||||
1.4981 1.3929 2.949 0.4
|
||||
2.1304 2.055 0.6597455 1.45
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
3
|
||||
0.0071 1.6899 2.521 0
|
||||
0.3272 1.3694 3.15 0
|
||||
1.3697 1.8296 2.654 0
|
||||
-10.6722 0.3012 0.1548 0
|
||||
1.1726 0.1899 0.3658 0
|
||||
0.4374 20.8541 1.45894 0
|
||||
2.5923 0.1904 0.6971 0
|
||||
10.3083 2.5462 1.3658 0
|
||||
1.4981 1.3929 2.949 0
|
||||
2.1304 2.055 0.6597455 0
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
3
|
||||
0.0071 1.6899 2.521 0
|
||||
0.3272 1.3694 3.15 0.05
|
||||
1.3697 1.8296 2.654 0.1
|
||||
-10.6722 0.3012 0.1548 1000.15
|
||||
1.1726 0.1899 0.3658 0.2
|
||||
0.4374 20.8541 1.45894 2000.25
|
||||
2.5923 0.1904 0.6971 0.3
|
||||
10.3083 2.5462 1.3658 1000.35
|
||||
1.4981 1.3929 2.949 0.4
|
||||
2.1304 2.055 0.6597455 1.45
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#include <CGAL/Epick_d.h>
|
||||
#include <CGAL/Regular_triangulation_euclidean_traits.h>
|
||||
#include <CGAL/Regular_triangulation.h>
|
||||
#include <CGAL/IO/Triangulation_off_ostream.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Epick_d<CGAL::Dynamic_dimension_tag> K;
|
||||
typedef CGAL::Regular_triangulation_euclidean_traits<K> Traits;
|
||||
typedef CGAL::Regular_triangulation<Traits> RT;
|
||||
|
||||
void test(int dim)
|
||||
{
|
||||
std::stringstream input_filename;
|
||||
input_filename << "data/points_" << dim << ".cin";
|
||||
std::ifstream in(input_filename.str());
|
||||
|
||||
RT::Weighted_point wp;
|
||||
std::vector<RT::Weighted_point> wpoints;
|
||||
|
||||
int dim_from_file;
|
||||
in >> dim_from_file;
|
||||
while(in >> wp)
|
||||
wpoints.push_back(wp);
|
||||
|
||||
// Build the Regular Triangulation
|
||||
RT rt(dim_from_file);
|
||||
rt.insert(wpoints.begin(), wpoints.end());
|
||||
CGAL_assertion(rt.is_valid(true));
|
||||
|
||||
// Export
|
||||
std::stringstream output_filename;
|
||||
output_filename << "data/rt_dim" << dim << ".off";
|
||||
std::ofstream off_stream(output_filename.str());
|
||||
CGAL::export_triangulation_to_off(off_stream, rt);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test(2);
|
||||
test(3);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -65,6 +65,5 @@ int main(int argc, char **argv)
|
|||
go<7>(N);
|
||||
go<8>(N);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
TODO
|
||||
include/CGAL/Convex_hull.h
|
||||
include/CGAL/Regular_triangulation.h
|
||||
|
|
|
|||
|
|
@ -81,11 +81,15 @@ public: // PUBLIC NESTED TYPES
|
|||
|
||||
typedef typename Base::Locate_type Locate_type;
|
||||
|
||||
//Tag to distinguish triangulations with weighted_points
|
||||
typedef Tag_false Weighted_tag;
|
||||
|
||||
protected: // DATA MEMBERS
|
||||
|
||||
|
||||
public:
|
||||
|
||||
using typename Base::Rotor;
|
||||
using Base::maximal_dimension;
|
||||
using Base::are_incident_full_cells_valid;
|
||||
using Base::coaffine_orientation_predicate;
|
||||
|
|
@ -95,11 +99,12 @@ public:
|
|||
//using Base::incident_full_cells;
|
||||
using Base::geom_traits;
|
||||
using Base::index_of_covertex;
|
||||
using Base::index_of_second_covertex;
|
||||
using Base::rotate_rotor;
|
||||
using Base::infinite_vertex;
|
||||
using Base::insert_in_hole;
|
||||
using Base::insert_outside_convex_hull_1;
|
||||
using Base::is_infinite;
|
||||
using Base::is_valid;
|
||||
using Base::locate;
|
||||
using Base::points_begin;
|
||||
using Base::set_neighbors;
|
||||
|
|
@ -143,35 +148,9 @@ private:
|
|||
};
|
||||
public:
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UTILITIES
|
||||
|
||||
// A co-dimension 2 sub-simplex. called a Rotor because we can rotate
|
||||
// the two "covertices" around the sub-simplex. Useful for traversing the
|
||||
// boundary of a hole. NOT DOCUMENTED
|
||||
typedef cpp11::tuple<Full_cell_handle, int, int> Rotor;
|
||||
Full_cell_handle full_cell(const Rotor & r) const // NOT DOCUMENTED
|
||||
{
|
||||
return cpp11::get<0>(r);
|
||||
}
|
||||
int index_of_covertex(const Rotor & r) const // NOT DOCUMENTED
|
||||
{
|
||||
return cpp11::get<1>(r);
|
||||
}
|
||||
int index_of_second_covertex(const Rotor & r) const // NOT DOCUMENTED
|
||||
{
|
||||
return cpp11::get<2>(r);
|
||||
}
|
||||
Rotor rotate_rotor(Rotor & r) // NOT DOCUMENTED...
|
||||
{
|
||||
int opposite = full_cell(r)->mirror_index(index_of_covertex(r));
|
||||
Full_cell_handle s = full_cell(r)->neighbor(index_of_covertex(r));
|
||||
int new_second = s->index(full_cell(r)->vertex(index_of_second_covertex(r)));
|
||||
return Rotor(s, new_second, opposite);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - CREATION / CONSTRUCTORS
|
||||
|
||||
Delaunay_triangulation(int dim, const Geom_traits k = Geom_traits())
|
||||
Delaunay_triangulation(int dim, const Geom_traits &k = Geom_traits())
|
||||
: Base(dim, k)
|
||||
{
|
||||
}
|
||||
|
|
@ -184,7 +163,7 @@ public:
|
|||
Delaunay_triangulation(
|
||||
int dim,
|
||||
const std::pair<int, const Flat_orientation_d *> &preset_flat_orientation,
|
||||
const Geom_traits k = Geom_traits())
|
||||
const Geom_traits &k = Geom_traits())
|
||||
: Base(dim, preset_flat_orientation, k)
|
||||
{
|
||||
}
|
||||
|
|
@ -340,6 +319,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VALIDITY
|
||||
|
||||
bool is_valid(bool verbose = false, int level = 0) const;
|
||||
|
||||
private:
|
||||
// Some internal types to shorten notation
|
||||
typedef typename Base::Coaffine_orientation_d Coaffine_orientation_d;
|
||||
|
|
@ -352,27 +335,6 @@ private:
|
|||
Conflict_traversal_pred_in_subspace;
|
||||
typedef Conflict_traversal_predicate<Conflict_pred_in_fullspace>
|
||||
Conflict_traversal_pred_in_fullspace;
|
||||
|
||||
// This is used in the |remove(v)| member function to manage sets of Full_cell_handles
|
||||
template< typename FCH >
|
||||
struct Full_cell_set : public std::vector<FCH>
|
||||
{
|
||||
typedef std::vector<FCH> Base_set;
|
||||
using Base_set::begin;
|
||||
using Base_set::end;
|
||||
void make_searchable()
|
||||
{ // sort the full cell handles
|
||||
std::sort(begin(), end());
|
||||
}
|
||||
bool contains(const FCH & fch) const
|
||||
{
|
||||
return std::binary_search(begin(), end(), fch);
|
||||
}
|
||||
bool contains_1st_and_not_2nd(const FCH & fst, const FCH & snd) const
|
||||
{
|
||||
return ( ! contains(snd) ) && ( contains(fst) );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
|
|
@ -427,7 +389,7 @@ Delaunay_triangulation<DCTraits, TDS>
|
|||
|
||||
// THE CASE cur_dim >= 2
|
||||
// Gather the finite vertices sharing an edge with |v|
|
||||
typedef Full_cell_set<Full_cell_handle> Simplices;
|
||||
typedef typename Base::template Full_cell_set<Full_cell_handle> Simplices;
|
||||
Simplices simps;
|
||||
std::back_insert_iterator<Simplices> out(simps);
|
||||
tds().incident_full_cells(v, out);
|
||||
|
|
@ -563,7 +525,7 @@ Delaunay_triangulation<DCTraits, TDS>
|
|||
Dark_s_handle dark_ret_s = dark_s;
|
||||
Full_cell_handle ret_s;
|
||||
|
||||
typedef Full_cell_set<Dark_s_handle> Dark_full_cells;
|
||||
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);
|
||||
|
||||
|
|
@ -777,10 +739,8 @@ Delaunay_triangulation<DCTraits, TDS>
|
|||
::insert_in_conflicting_cell(const Point & p, const Full_cell_handle s)
|
||||
{
|
||||
typedef std::vector<Full_cell_handle> Full_cell_h_vector;
|
||||
typedef typename Full_cell_h_vector::iterator SHV_iterator;
|
||||
static Full_cell_h_vector cs; // for storing conflicting full_cells.
|
||||
cs.clear();
|
||||
// cs.reserve(64);
|
||||
Full_cell_h_vector cs; // for storing conflicting full_cells.
|
||||
cs.reserve(64);
|
||||
std::back_insert_iterator<Full_cell_h_vector> out(cs);
|
||||
Facet ft = compute_conflict_zone(p, s, out);
|
||||
return insert_in_hole(p, cs.begin(), cs.end(), ft);
|
||||
|
|
@ -888,6 +848,48 @@ Delaunay_triangulation<DCTraits, TDS>
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VALIDITY
|
||||
|
||||
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 )
|
||||
{
|
||||
Full_cell_const_handle ch = cit.base();
|
||||
for(int i = 0; i < dim+1 ; ++i )
|
||||
{
|
||||
// If the i-th neighbor is not an infinite cell
|
||||
Vertex_handle opposite_vh =
|
||||
ch->neighbor(i)->vertex(ch->neighbor(i)->index(ch));
|
||||
if (!is_infinite(opposite_vh))
|
||||
{
|
||||
Side_of_oriented_sphere_d side =
|
||||
geom_traits().side_of_oriented_sphere_d_object();
|
||||
if (side(Point_const_iterator(ch->vertices_begin()),
|
||||
Point_const_iterator(ch->vertices_end()),
|
||||
opposite_vh->point()) == ON_BOUNDED_SIDE)
|
||||
{
|
||||
if (verbose)
|
||||
CGAL_warning_msg(false, "Non-empty sphere");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_DELAUNAY_COMPLEX_H
|
||||
|
|
|
|||
|
|
@ -0,0 +1,255 @@
|
|||
// 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 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) : Clement Jamin
|
||||
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_IO_H
|
||||
#define CGAL_TRIANGULATION_IO_H
|
||||
|
||||
#include <CGAL/Epick_d.h>
|
||||
#include <CGAL/Triangulation.h>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Triangulation_IO
|
||||
{
|
||||
// TODO: test if the stream is binary or text?
|
||||
template<typename Traits, typename P>
|
||||
void
|
||||
output_point(std::ostream & os, const Traits &traits, const P & p)
|
||||
{
|
||||
typedef typename Traits::Compute_coordinate_d Ccd;
|
||||
const Ccd ccd = traits.compute_coordinate_d_object();
|
||||
const int dim = traits.point_dimension_d_object()(p);
|
||||
if (dim > 0)
|
||||
{
|
||||
os << ccd(p, 0);
|
||||
for (int i = 1 ; i < dim ; ++i)
|
||||
os << " " << CGAL::to_double(ccd(p, i));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: test if the stream is binary or text?
|
||||
/*template<typename Traits, typename P>
|
||||
void
|
||||
input_point(std::istream & is, const Traits &traits, P & p)
|
||||
{
|
||||
typedef typename Traits::FT FT;
|
||||
std::vector<FT> coords;
|
||||
|
||||
std::string line;
|
||||
for(;;)
|
||||
{
|
||||
if (!std::getline(is, line))
|
||||
return is;
|
||||
if (line != "")
|
||||
break;
|
||||
}
|
||||
std::stringstream line_sstr(line);
|
||||
FT temp;
|
||||
while (line_sstr >> temp)
|
||||
coords.push_back(temp);
|
||||
|
||||
p = traits.construct_point_d_object()(coords.begin(), coords.end());
|
||||
}*/
|
||||
|
||||
} // namespace Triangulation_IO
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// TODO: replace these operator>> by an "input_point" function
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO: test if the stream is binary or text?
|
||||
template<typename K>
|
||||
std::istream &
|
||||
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(;;)
|
||||
{
|
||||
if (!std::getline(is, line))
|
||||
return is;
|
||||
if (line != "")
|
||||
break;
|
||||
}
|
||||
std::stringstream line_sstr(line);
|
||||
FT temp;
|
||||
while (line_sstr >> temp)
|
||||
coords.push_back(temp);
|
||||
|
||||
p = P(coords.begin(), coords.end());
|
||||
return is;
|
||||
}
|
||||
|
||||
// TODO: test if the stream is binary or text?
|
||||
template<typename K>
|
||||
std::istream &
|
||||
operator>>(std::istream &is, typename Wrap::Weighted_point_d<K> & wp)
|
||||
{
|
||||
typedef typename Wrap::Point_d<K> P;
|
||||
typedef typename Wrap::Weighted_point_d<K> WP;
|
||||
typedef typename K::FT FT;
|
||||
|
||||
std::string line;
|
||||
for(;;)
|
||||
{
|
||||
if (!std::getline(is, line))
|
||||
return is;
|
||||
if (line != "")
|
||||
break;
|
||||
}
|
||||
std::stringstream line_sstr(line);
|
||||
FT temp;
|
||||
std::vector<FT> coords;
|
||||
while (line_sstr >> temp)
|
||||
coords.push_back(temp);
|
||||
|
||||
std::vector<FT>::iterator last = coords.end() - 1;
|
||||
P p = P(coords.begin(), last);
|
||||
wp = WP(p, *last);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
template < class GT, class TDS >
|
||||
std::ostream &
|
||||
export_triangulation_to_off(std::ostream & os,
|
||||
const Triangulation<GT,TDS> & tr,
|
||||
bool in_3D_export_surface_only = false)
|
||||
{
|
||||
typedef Triangulation<GT,TDS> Tr;
|
||||
typedef typename Tr::Vertex_const_handle Vertex_handle;
|
||||
typedef typename Tr::Vertex_const_iterator Vertex_iterator;
|
||||
typedef typename Tr::Finite_vertex_const_iterator Finite_vertex_iterator;
|
||||
typedef typename Tr::Full_cell_const_handle Full_cell_handle;
|
||||
typedef typename Tr::Finite_full_cell_const_iterator Finite_full_cell_iterator;
|
||||
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.";
|
||||
os << "Warning: export_tds_to_off => dimension should be 2 or 3.";
|
||||
return 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();
|
||||
it != tr.finite_vertices_end(); ++it, ++i)
|
||||
{
|
||||
Triangulation_IO::output_point(output, tr.geom_traits(), it->point());
|
||||
if (tr.maximal_dimension() == 2)
|
||||
output << " 0";
|
||||
output << std::endl;
|
||||
index_of_vertex[it.base()] = i;
|
||||
}
|
||||
CGAL_assertion( i == n );
|
||||
|
||||
size_t number_of_triangles = 0;
|
||||
if (tr.maximal_dimension() == 2)
|
||||
{
|
||||
for (Finite_full_cell_iterator fch = tr.finite_full_cells_begin() ;
|
||||
fch != tr.finite_full_cells_end() ; ++fch)
|
||||
{
|
||||
output << "3 ";
|
||||
for (Full_cell_vertex_iterator vit = fch->vertices_begin() ;
|
||||
vit != fch->vertices_end() ; ++vit)
|
||||
{
|
||||
output << index_of_vertex[*vit] << " ";
|
||||
}
|
||||
output << std::endl;
|
||||
++number_of_triangles;
|
||||
}
|
||||
}
|
||||
else if (tr.maximal_dimension() == 3)
|
||||
{
|
||||
if (in_3D_export_surface_only)
|
||||
{
|
||||
// Parse boundary facets
|
||||
for (Full_cell_iterator fch = tr.full_cells_begin() ;
|
||||
fch != tr.full_cells_end() ; ++fch)
|
||||
{
|
||||
if (tr.is_infinite(fch))
|
||||
{
|
||||
output << "3 ";
|
||||
for (Full_cell_vertex_iterator vit = fch->vertices_begin() ;
|
||||
vit != fch->vertices_end() ; ++vit)
|
||||
{
|
||||
if (!tr.is_infinite(*vit))
|
||||
output << index_of_vertex[*vit] << " ";
|
||||
}
|
||||
output << std::endl;
|
||||
++number_of_triangles;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse finite cells
|
||||
for (Finite_full_cell_iterator fch = tr.finite_full_cells_begin() ;
|
||||
fch != tr.finite_full_cells_end() ; ++fch)
|
||||
{
|
||||
output << "3 "
|
||||
<< index_of_vertex[fch->vertex(0)] << " "
|
||||
<< index_of_vertex[fch->vertex(1)] << " "
|
||||
<< index_of_vertex[fch->vertex(2)]
|
||||
<< std::endl;
|
||||
output << "3 "
|
||||
<< index_of_vertex[fch->vertex(0)] << " "
|
||||
<< index_of_vertex[fch->vertex(2)] << " "
|
||||
<< index_of_vertex[fch->vertex(3)]
|
||||
<< std::endl;
|
||||
output << "3 "
|
||||
<< index_of_vertex[fch->vertex(1)] << " "
|
||||
<< index_of_vertex[fch->vertex(2)] << " "
|
||||
<< index_of_vertex[fch->vertex(3)]
|
||||
<< std::endl;
|
||||
output << "3 "
|
||||
<< index_of_vertex[fch->vertex(0)] << " "
|
||||
<< index_of_vertex[fch->vertex(1)] << " "
|
||||
<< index_of_vertex[fch->vertex(3)]
|
||||
<< std::endl;
|
||||
number_of_triangles += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
os << "OFF \n"
|
||||
<< n << " "
|
||||
<< number_of_triangles << " 0\n"
|
||||
<< output.str();
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_TRIANGULATION_IO_H
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,254 @@
|
|||
// 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_REGULAR_TRIANGULATION_EUCLIDEAN_TRAITS_H
|
||||
#define CGAL_REGULAR_TRIANGULATION_EUCLIDEAN_TRAITS_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#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>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class K, class Weight = typename K::RT >
|
||||
class Regular_triangulation_euclidean_traits
|
||||
: public K
|
||||
{
|
||||
public:
|
||||
typedef K Base;
|
||||
typedef Regular_triangulation_euclidean_traits<K, Weight> Self;
|
||||
|
||||
// Types from K
|
||||
|
||||
typedef K Kernel;
|
||||
typedef typename K::Dimension Dimension;
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Point_d Bare_point;
|
||||
typedef typename K::Weighted_point_d Weighted_point;
|
||||
typedef Weighted_point Weighted_point_d;
|
||||
typedef Weighted_point Point_d;
|
||||
|
||||
typedef typename K::Construct_weighted_point_d Construct_weighted_point_d;
|
||||
typedef typename K::Power_test_d Power_test_d;
|
||||
typedef typename K::In_flat_power_test_d In_flat_power_test_d;
|
||||
typedef typename K::Flat_orientation_d Flat_orientation_d;
|
||||
typedef typename K::Point_drop_weight_d Point_drop_weight_d;
|
||||
|
||||
//=============================================================================
|
||||
// Custom types
|
||||
//=============================================================================
|
||||
|
||||
class Orientation_d
|
||||
{
|
||||
const K &m_kernel;
|
||||
|
||||
public:
|
||||
typedef Orientation result_type;
|
||||
|
||||
Orientation_d(const K &kernel)
|
||||
: m_kernel(kernel) {}
|
||||
|
||||
template <typename ForwardIterator>
|
||||
result_type operator()(ForwardIterator start, ForwardIterator end) const
|
||||
{
|
||||
Point_drop_weight_d pdw = m_kernel.point_drop_weight_d_object();
|
||||
return m_kernel.orientation_d_object() (
|
||||
boost::make_transform_iterator(start, pdw),
|
||||
boost::make_transform_iterator(end, pdw)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class Construct_flat_orientation_d
|
||||
{
|
||||
const K &m_kernel;
|
||||
|
||||
public:
|
||||
typedef Flat_orientation_d result_type;
|
||||
|
||||
Construct_flat_orientation_d(const K &kernel)
|
||||
: m_kernel(kernel) {}
|
||||
|
||||
template <typename ForwardIterator>
|
||||
result_type operator()(ForwardIterator start, ForwardIterator end) const
|
||||
{
|
||||
Point_drop_weight_d pdw = m_kernel.point_drop_weight_d_object();
|
||||
return m_kernel.construct_flat_orientation_d_object() (
|
||||
boost::make_transform_iterator(start, pdw),
|
||||
boost::make_transform_iterator(end, pdw)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class In_flat_orientation_d
|
||||
{
|
||||
const K &m_kernel;
|
||||
|
||||
public:
|
||||
typedef Orientation result_type;
|
||||
|
||||
In_flat_orientation_d(const K &kernel)
|
||||
: m_kernel(kernel) {}
|
||||
|
||||
template <typename ForwardIterator>
|
||||
result_type operator()(Flat_orientation_d orient,
|
||||
ForwardIterator start, ForwardIterator end) const
|
||||
{
|
||||
Point_drop_weight_d pdw = m_kernel.point_drop_weight_d_object();
|
||||
return m_kernel.in_flat_orientation_d_object() (
|
||||
orient,
|
||||
boost::make_transform_iterator(start, pdw),
|
||||
boost::make_transform_iterator(end, pdw)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class Contained_in_affine_hull_d
|
||||
{
|
||||
const K &m_kernel;
|
||||
|
||||
public:
|
||||
typedef bool result_type;
|
||||
|
||||
Contained_in_affine_hull_d(const K &kernel)
|
||||
: m_kernel(kernel) {}
|
||||
|
||||
template <typename ForwardIterator>
|
||||
result_type operator()(ForwardIterator start, ForwardIterator end,
|
||||
const Weighted_point_d & p) const
|
||||
{
|
||||
Point_drop_weight_d pdw = m_kernel.point_drop_weight_d_object();
|
||||
return m_kernel.contained_in_affine_hull_d_object() (
|
||||
boost::make_transform_iterator(start, pdw),
|
||||
boost::make_transform_iterator(end, pdw),
|
||||
pdw(p)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class Compare_lexicographically_d
|
||||
{
|
||||
const K &m_kernel;
|
||||
|
||||
public:
|
||||
typedef Comparison_result result_type;
|
||||
|
||||
Compare_lexicographically_d(const K &kernel)
|
||||
: m_kernel(kernel) {}
|
||||
|
||||
result_type operator()(
|
||||
const Weighted_point_d & p, const Weighted_point_d & q) const
|
||||
{
|
||||
Point_drop_weight_d pdw = m_kernel.point_drop_weight_d_object();
|
||||
return m_kernel.compare_lexicographically_d_object()(pdw(p), pdw(q));
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class Compute_coordinate_d
|
||||
{
|
||||
const K &m_kernel;
|
||||
|
||||
public:
|
||||
typedef FT result_type;
|
||||
|
||||
Compute_coordinate_d(const K &kernel)
|
||||
: m_kernel(kernel) {}
|
||||
|
||||
result_type operator()(
|
||||
const Weighted_point_d & p, const int i) const
|
||||
{
|
||||
Point_drop_weight_d pdw = m_kernel.point_drop_weight_d_object();
|
||||
m_kernel.compute_coordinate_d_object()(pdw(p), i);
|
||||
return m_kernel.compute_coordinate_d_object()(pdw(p), i);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class Point_dimension_d
|
||||
{
|
||||
const K &m_kernel;
|
||||
|
||||
public:
|
||||
typedef int result_type;
|
||||
|
||||
Point_dimension_d(const K &kernel)
|
||||
: m_kernel(kernel) {}
|
||||
|
||||
result_type operator()(
|
||||
const Weighted_point_d & p) const
|
||||
{
|
||||
Point_drop_weight_d pdw = m_kernel.point_drop_weight_d_object();
|
||||
return m_kernel.point_dimension_d_object()(pdw(p));
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Object creation
|
||||
//=============================================================================
|
||||
|
||||
Contained_in_affine_hull_d contained_in_affine_hull_d_object() const
|
||||
{
|
||||
return Contained_in_affine_hull_d(*this);
|
||||
}
|
||||
Orientation_d orientation_d_object() const
|
||||
{
|
||||
return Orientation_d(*this);
|
||||
}
|
||||
Construct_flat_orientation_d construct_flat_orientation_d_object() const
|
||||
{
|
||||
return Construct_flat_orientation_d(*this);
|
||||
}
|
||||
In_flat_orientation_d in_flat_orientation_d_object() const
|
||||
{
|
||||
return In_flat_orientation_d(*this);
|
||||
}
|
||||
Compare_lexicographically_d compare_lexicographically_d_object() const
|
||||
{
|
||||
return Compare_lexicographically_d(*this);
|
||||
}
|
||||
Compute_coordinate_d compute_coordinate_d_object() const
|
||||
{
|
||||
return Compute_coordinate_d(*this);
|
||||
}
|
||||
Point_dimension_d point_dimension_d_object() const
|
||||
{
|
||||
return Point_dimension_d(*this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_REGULAR_TRIANGULATION_EUCLIDEAN_TRAITS_H
|
||||
|
|
@ -227,9 +227,35 @@ public:
|
|||
return tds().index_of_covertex(f);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UTILITIES
|
||||
|
||||
// A co-dimension 2 sub-simplex. called a Rotor because we can rotate
|
||||
// the two "covertices" around the sub-simplex. Useful for traversing the
|
||||
// boundary of a hole. NOT DOCUMENTED
|
||||
typedef cpp11::tuple<Full_cell_handle, int, int> Rotor;
|
||||
Full_cell_handle full_cell(const Rotor & r) const // NOT DOCUMENTED
|
||||
{
|
||||
return cpp11::get<0>(r);
|
||||
}
|
||||
int index_of_covertex(const Rotor & r) const // NOT DOCUMENTED
|
||||
{
|
||||
return cpp11::get<1>(r);
|
||||
}
|
||||
int index_of_second_covertex(const Rotor & r) const // NOT DOCUMENTED
|
||||
{
|
||||
return cpp11::get<2>(r);
|
||||
}
|
||||
Rotor rotate_rotor(Rotor & r) // NOT DOCUMENTED...
|
||||
{
|
||||
int opposite = full_cell(r)->mirror_index(index_of_covertex(r));
|
||||
Full_cell_handle s = full_cell(r)->neighbor(index_of_covertex(r));
|
||||
int new_second = s->index(full_cell(r)->vertex(index_of_second_covertex(r)));
|
||||
return Rotor(s, new_second, opposite);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - CREATION / CONSTRUCTORS
|
||||
|
||||
Triangulation(int dim, const Geom_traits k = Geom_traits())
|
||||
Triangulation(int dim, const Geom_traits &k = Geom_traits())
|
||||
: tds_(dim)
|
||||
, kernel_(k)
|
||||
, infinity_()
|
||||
|
|
@ -250,7 +276,7 @@ public:
|
|||
Triangulation(
|
||||
int dim,
|
||||
const std::pair<int, const Flat_orientation_d *> &preset_flat_orientation,
|
||||
const Geom_traits k = Geom_traits())
|
||||
const Geom_traits &k = Geom_traits())
|
||||
: tds_(dim)
|
||||
, kernel_(k)
|
||||
, infinity_()
|
||||
|
|
@ -267,7 +293,7 @@ public:
|
|||
: tds_(t2.tds_)
|
||||
, kernel_(t2.kernel_)
|
||||
, infinity_()
|
||||
, preset_flat_orientation_((std::numeric_limits<int>::max)(), NULL)
|
||||
, preset_flat_orientation_((std::numeric_limits<int>::max()), NULL)
|
||||
, rng_(t2.rng_)
|
||||
#ifdef CGAL_TRIANGULATION_STATISTICS
|
||||
,walk_size_(t2.walk_size_)
|
||||
|
|
@ -704,6 +730,28 @@ public:
|
|||
// make sure all full_cells have positive orientation
|
||||
void reorient_full_cells();
|
||||
|
||||
protected:
|
||||
// This is used in the |remove(v)| member function to manage sets of Full_cell_handles
|
||||
template< typename FCH >
|
||||
struct Full_cell_set : public std::vector<FCH>
|
||||
{
|
||||
typedef std::vector<FCH> Base_set;
|
||||
using Base_set::begin;
|
||||
using Base_set::end;
|
||||
void make_searchable()
|
||||
{ // sort the full cell handles
|
||||
std::sort(begin(), end());
|
||||
}
|
||||
bool contains(const FCH & fch) const
|
||||
{
|
||||
return std::binary_search(begin(), end(), fch);
|
||||
}
|
||||
bool contains_1st_and_not_2nd(const FCH & fst, const FCH & snd) const
|
||||
{
|
||||
return ( ! contains(snd) ) && ( contains(fst) );
|
||||
}
|
||||
};
|
||||
|
||||
}; // Triangulation<...>
|
||||
|
||||
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
|
|
@ -1228,9 +1276,6 @@ operator>>(std::istream & is, Triangulation<TT, TDS> & tr)
|
|||
{
|
||||
typedef Triangulation<TT, TDS> T;
|
||||
typedef typename T::Vertex_handle Vertex_handle;
|
||||
typedef typename T::Vertex_iterator Vertex_iterator;
|
||||
typedef typename T::Full_cell_handle Full_cell_handle;
|
||||
typedef typename T::Full_cell_iterator Full_cell_iterator;
|
||||
|
||||
// read current dimension and number of vertices
|
||||
size_t n;
|
||||
|
|
@ -1284,8 +1329,6 @@ operator<<(std::ostream & os, const Triangulation<TT, TDS> & tr)
|
|||
typedef Triangulation<TT, TDS> T;
|
||||
typedef typename T::Vertex_const_handle Vertex_handle;
|
||||
typedef typename T::Vertex_const_iterator Vertex_iterator;
|
||||
typedef typename T::Full_cell_const_handle Full_cell_handle;
|
||||
typedef typename T::Full_cell_const_iterator Full_cell_iterator;
|
||||
|
||||
// outputs dimensions and number of vertices
|
||||
size_t n = tr.number_of_vertices();
|
||||
|
|
|
|||
|
|
@ -389,6 +389,30 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
// Used by insert_in_tagged_hole
|
||||
struct IITH_task
|
||||
{
|
||||
IITH_task(
|
||||
Facet boundary_facet_,
|
||||
int index_of_inside_cell_in_outside_cell_,
|
||||
Full_cell_handle future_neighbor_ = Full_cell_handle(),
|
||||
int new_cell_index_in_future_neighbor_ = -1,
|
||||
int index_of_future_neighbor_in_new_cell_ = -1)
|
||||
: boundary_facet(boundary_facet_),
|
||||
index_of_inside_cell_in_outside_cell(index_of_inside_cell_in_outside_cell_),
|
||||
future_neighbor(future_neighbor_),
|
||||
new_cell_index_in_future_neighbor(new_cell_index_in_future_neighbor_),
|
||||
index_of_future_neighbor_in_new_cell(index_of_future_neighbor_in_new_cell_)
|
||||
{}
|
||||
|
||||
// "new_cell" is the cell about to be created
|
||||
Facet boundary_facet;
|
||||
int index_of_inside_cell_in_outside_cell;
|
||||
Full_cell_handle future_neighbor;
|
||||
int new_cell_index_in_future_neighbor;
|
||||
int index_of_future_neighbor_in_new_cell;
|
||||
};
|
||||
|
||||
// NOT DOCUMENTED
|
||||
void clear_visited_marks(Full_cell_handle) const;
|
||||
|
||||
|
|
@ -943,10 +967,28 @@ Triangulation_data_structure<Dim, Vb, Fcb>
|
|||
CGAL_assertion_msg(is_boundary_facet(f), "starting facet should be on the hole boundary");
|
||||
|
||||
const int cur_dim = current_dimension();
|
||||
Full_cell_handle new_s;
|
||||
|
||||
Full_cell_handle old_s = full_cell(f);
|
||||
Full_cell_handle new_s = new_full_cell();
|
||||
const int facet_index = index_of_covertex(f);
|
||||
std::queue<IITH_task> task_queue;
|
||||
task_queue.push(
|
||||
IITH_task(f, mirror_index(full_cell(f), index_of_covertex(f))) );
|
||||
|
||||
while (!task_queue.empty())
|
||||
{
|
||||
IITH_task task = task_queue.front();
|
||||
task_queue.pop();
|
||||
|
||||
Full_cell_handle old_s = full_cell(task.boundary_facet);
|
||||
const int facet_index = index_of_covertex(task.boundary_facet);
|
||||
|
||||
Full_cell_handle outside_neighbor = neighbor(old_s, facet_index);
|
||||
// Here, "new_s" might actually be a new cell, but it might also be "old_s"
|
||||
// if it has not been treated already in the meantime
|
||||
new_s = neighbor(outside_neighbor, task.index_of_inside_cell_in_outside_cell);
|
||||
// If the cell has not been treated yet
|
||||
if (old_s == new_s)
|
||||
{
|
||||
new_s = new_full_cell();
|
||||
|
||||
int i(0);
|
||||
for( ; i < facet_index; ++i )
|
||||
|
|
@ -978,21 +1020,42 @@ Triangulation_data_structure<Dim, Vb, Fcb>
|
|||
|
||||
// we did find the |i|-th neighbor of Facet(old_s, facet_index)...
|
||||
// has it already been extruded to center point |v| ?
|
||||
Full_cell_handle outside = neighbor(full_cell(rot), index_of_covertex(rot));
|
||||
Full_cell_handle inside = full_cell(rot);
|
||||
Full_cell_handle outside = neighbor(inside, index_of_covertex(rot));
|
||||
// "m" is the vertex of outside which is not on the boundary
|
||||
Vertex_handle m = inside->mirror_vertex(index_of_covertex(rot), current_dimension());
|
||||
// "index" is the index of m in "outside"
|
||||
int index = outside->index(m);
|
||||
// new_neighbor is the inside cell which is registered as the neighbor
|
||||
// of the outside cell => it's either a newly created inside cell or an
|
||||
// old inside cell which we are about to delete
|
||||
Full_cell_handle new_neighbor = outside->neighbor(index);
|
||||
|
||||
// Is new_neighbor still the old neighbor?
|
||||
if( new_neighbor == inside )
|
||||
{ // not already extruded... we do it recursively
|
||||
new_neighbor = insert_in_tagged_hole( v,
|
||||
Facet(full_cell(rot), index_of_covertex(rot)),
|
||||
new_full_cells);
|
||||
{
|
||||
task_queue.push(IITH_task(
|
||||
Facet(inside, index_of_covertex(rot)), // boundary facet
|
||||
index, // index_of_inside_cell_in_outside_cell
|
||||
new_s, // future_neighbor
|
||||
i, // new_cell_index_in_future_neighbor
|
||||
index_of_second_covertex(rot) // index_of_future_neighbor_in_new_cell
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there is some neighbor stories to fix
|
||||
if (task.future_neighbor != Full_cell_handle())
|
||||
{
|
||||
// now the new neighboring full_cell exists, we link both
|
||||
set_neighbors(new_s, i, new_neighbor, index_of_second_covertex(rot));
|
||||
set_neighbors(new_s,
|
||||
task.index_of_future_neighbor_in_new_cell,
|
||||
task.future_neighbor,
|
||||
task.new_cell_index_in_future_neighbor);
|
||||
}
|
||||
}
|
||||
|
||||
return new_s;
|
||||
}
|
||||
|
||||
|
|
@ -1459,6 +1522,8 @@ operator>>(std::istream & is, Triangulation_data_structure<Dimen, Vb, Fcb> & tr)
|
|||
// - the neighbors of each full_cell by their index in the preceding list
|
||||
{
|
||||
typedef Triangulation_data_structure<Dimen, Vb, Fcb> TDS;
|
||||
typedef typename TDS::Full_cell_handle Full_cell_handle;
|
||||
typedef typename TDS::Full_cell_iterator Full_cell_iterator;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
|
||||
// read current dimension and number of vertices
|
||||
|
|
@ -1509,6 +1574,8 @@ operator<<(std::ostream & os, const Triangulation_data_structure<Dimen, Vb, Fcb>
|
|||
// - the neighbors of each full_cell by their index in the preceding list
|
||||
{
|
||||
typedef Triangulation_data_structure<Dimen, Vb, Fcb> TDS;
|
||||
typedef typename TDS::Full_cell_const_handle Full_cell_handle;
|
||||
typedef typename TDS::Full_cell_const_iterator Full_cell_iterator;
|
||||
typedef typename TDS::Vertex_const_handle Vertex_handle;
|
||||
typedef typename TDS::Vertex_const_iterator Vertex_iterator;
|
||||
|
||||
|
|
@ -1530,7 +1597,7 @@ operator<<(std::ostream & os, const Triangulation_data_structure<Dimen, Vb, Fcb>
|
|||
std::size_t i = 0;
|
||||
for( Vertex_iterator it = tr.vertices_begin(); it != tr.vertices_end(); ++it, ++i )
|
||||
{
|
||||
os << *it; // write the vertex
|
||||
os << *it << std::endl; // write the vertex
|
||||
index_of_vertex[it] = i;
|
||||
}
|
||||
CGAL_assertion( i == n );
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ public:
|
|||
/// Set 's' as an incident full_cell
|
||||
void set_full_cell(Full_cell_handle s) /* Concept */
|
||||
{
|
||||
CGAL_precondition( Full_cell_handle() != s );
|
||||
full_cell_ = s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public:
|
|||
template< class T >
|
||||
struct Compare_points_for_perturbation
|
||||
{
|
||||
typedef typename T::Point_d Point;
|
||||
typedef typename T::Geom_traits::Point_d Point;
|
||||
|
||||
const T & t_;
|
||||
|
||||
|
|
@ -119,8 +119,8 @@ public:
|
|||
template< class T >
|
||||
struct Point_from_pointer
|
||||
{
|
||||
typedef const typename T::Point_d * argument_type;
|
||||
typedef const typename T::Point_d result_type;
|
||||
typedef const typename T::Geom_traits::Point_d * argument_type;
|
||||
typedef const typename T::Geom_traits::Point_d result_type;
|
||||
result_type & operator()(argument_type & x) const
|
||||
{
|
||||
return (*x);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
project( Triangulation_test )
|
||||
|
||||
cmake_minimum_required(VERSION 2.6.2)
|
||||
|
|
@ -27,18 +26,18 @@ if ( CGAL_FOUND )
|
|||
include_directories (BEFORE "../../include")
|
||||
include_directories (BEFORE "include")
|
||||
|
||||
create_single_source_cgal_program( "test_delaunay.cpp" )
|
||||
create_single_source_cgal_program( "test_tds.cpp" )
|
||||
#create_single_source_cgal_program( "test_torture.cpp" )
|
||||
create_single_source_cgal_program( "test_triangulation.cpp" )
|
||||
create_single_source_cgal_program( "test_delaunay.cpp" )
|
||||
create_single_source_cgal_program( "test_regular.cpp" )
|
||||
create_single_source_cgal_program( "test_tds.cpp" )
|
||||
create_single_source_cgal_program( "test_insert_if_in_star.cpp" )
|
||||
create_single_source_cgal_program( "test_torture.cpp" )
|
||||
|
||||
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()
|
||||
|
||||
|
|
|
|||
|
|
@ -16,92 +16,88 @@ void test(const int d, const string & type, const int N)
|
|||
// we must write 'typename' below, because we are in a template-function,
|
||||
// so the parser has no way to know that DC contains sub-types, before
|
||||
// instanciating the function.
|
||||
typedef typename DC::Vertex Vertex;
|
||||
typedef typename DC::Vertex_handle Vertex_handle;
|
||||
typedef typename DC::Full_cell Full_cell;
|
||||
typedef typename DC::Full_cell_handle Full_cell_handle;
|
||||
typedef typename DC::Facet Facet;
|
||||
typedef typename DC::Face Face;
|
||||
typedef typename DC::Point Point;
|
||||
typedef typename DC::Geom_traits::RT RT;
|
||||
typedef typename DC::Finite_full_cell_const_iterator Finite_full_cell_const_iterator;
|
||||
typedef typename DC::Finite_vertex_iterator Finite_vertex_iterator;
|
||||
|
||||
typedef CGAL::Random_points_in_cube_d<Point> Random_points_iterator;
|
||||
|
||||
DC pc(d);
|
||||
DC dt(d);
|
||||
cerr << "\nBuilding Delaunay triangulation of (" << type << d << ") dimension with " << N << " points";
|
||||
assert(pc.empty());
|
||||
assert(dt.empty());
|
||||
|
||||
vector<Point> points;
|
||||
CGAL::Random rng;
|
||||
Random_points_iterator rand_it(d, 2.0, rng);
|
||||
//CGAL::Random rng;
|
||||
//Random_points_iterator rand_it(d, 2.0, rng);
|
||||
//CGAL::cpp11::copy_n(rand_it, N, back_inserter(points));
|
||||
|
||||
vector<int> coords(d);
|
||||
srand(10);
|
||||
for( int i = 0; i < N; ++i )
|
||||
{
|
||||
vector<double> coords(d);
|
||||
for( int j = 0; j < d; ++j )
|
||||
coords[j] = rand() % 100000;
|
||||
coords[j] = static_cast<double>(rand() % 100000)/10000;
|
||||
points.push_back(Point(d, coords.begin(), coords.end()));
|
||||
}
|
||||
pc.insert(points.begin(), points.end());
|
||||
dt.insert(points.begin(), points.end());
|
||||
cerr << "\nChecking topology and geometry...";
|
||||
assert( pc.is_valid() );
|
||||
assert( dt.is_valid() );
|
||||
|
||||
cerr << "\nTraversing finite full_cells... ";
|
||||
size_t nbfs(0), nbis(0);
|
||||
Finite_full_cell_const_iterator fsit = pc.finite_full_cells_begin();
|
||||
while( fsit != pc.finite_full_cells_end() )
|
||||
Finite_full_cell_const_iterator fsit = dt.finite_full_cells_begin();
|
||||
while( fsit != dt.finite_full_cells_end() )
|
||||
++fsit, ++nbfs;
|
||||
cerr << nbfs << " + ";
|
||||
vector<Full_cell_handle> infinite_full_cells;
|
||||
pc.tds().incident_full_cells(pc.infinite_vertex(), back_inserter(infinite_full_cells));
|
||||
dt.tds().incident_full_cells(dt.infinite_vertex(), back_inserter(infinite_full_cells));
|
||||
nbis = infinite_full_cells.size();
|
||||
cerr << nbis << " = " << (nbis+nbfs)
|
||||
<< " = " << pc.number_of_full_cells();
|
||||
cerr << "\nThe triangulation has current dimension " << pc.current_dimension();
|
||||
CGAL_assertion( pc.number_of_full_cells() == nbis+nbfs);
|
||||
<< " = " << dt.number_of_full_cells();
|
||||
cerr << "\nThe triangulation has current dimension " << dt.current_dimension();
|
||||
CGAL_assertion( dt.number_of_full_cells() == nbis+nbfs);
|
||||
|
||||
cerr << "\nTraversing finite vertices... ";
|
||||
size_t nbfv(0);
|
||||
Finite_vertex_iterator fvit = pc.finite_vertices_begin();
|
||||
while( fvit != pc.finite_vertices_end() )
|
||||
Finite_vertex_iterator fvit = dt.finite_vertices_begin();
|
||||
while( fvit != dt.finite_vertices_end() )
|
||||
++fvit, ++nbfv;
|
||||
cerr << nbfv <<endl;
|
||||
|
||||
// Count convex hull vertices:
|
||||
if( pc.maximal_dimension() > 1 )
|
||||
if( dt.maximal_dimension() > 1 )
|
||||
{
|
||||
typedef vector<Face> Faces;
|
||||
Faces edges;
|
||||
back_insert_iterator<Faces> out(edges);
|
||||
pc.tds().incident_faces(pc.infinite_vertex(), 1, out);
|
||||
dt.tds().incident_faces(dt.infinite_vertex(), 1, out);
|
||||
cout << "\nThere are " << edges.size() << " vertices on the convex hull.";
|
||||
edges.clear();
|
||||
}
|
||||
else // pc.maximal_dimension() == 1
|
||||
else // dt.maximal_dimension() == 1
|
||||
{
|
||||
typedef vector<Full_cell_handle> Cells;
|
||||
Cells cells;
|
||||
back_insert_iterator<Cells> out(cells);
|
||||
pc.tds().incident_full_cells(pc.infinite_vertex(), out);
|
||||
dt.tds().incident_full_cells(dt.infinite_vertex(), out);
|
||||
cout << "\nThere are " << cells.size() << " vertices on the convex hull.";
|
||||
cells.clear();
|
||||
}
|
||||
|
||||
// Remove all !
|
||||
cerr << "\nBefore removal: " << pc.number_of_vertices() << " vertices. After: ";
|
||||
cerr << "\nBefore removal: " << dt.number_of_vertices() << " vertices. After: ";
|
||||
random_shuffle(points.begin(), points.end());
|
||||
pc.remove(points.begin(), points.end());
|
||||
assert( pc.is_valid() );
|
||||
cerr << pc.number_of_vertices() << " vertices.";
|
||||
// assert( pc.empty() ); NOT YET !
|
||||
dt.remove(points.begin(), points.end());
|
||||
assert( dt.is_valid() );
|
||||
cerr << dt.number_of_vertices() << " vertices.";
|
||||
// assert( dt.empty() ); NOT YET !
|
||||
// CLEAR
|
||||
pc.clear();
|
||||
assert( -1 == pc.current_dimension() );
|
||||
assert( pc.empty() );
|
||||
assert( pc.is_valid() );
|
||||
dt.clear();
|
||||
assert( -1 == dt.current_dimension() );
|
||||
assert( dt.empty() );
|
||||
assert( dt.is_valid() );
|
||||
}
|
||||
|
||||
template< int D >
|
||||
|
|
@ -117,14 +113,14 @@ void go(const int N)
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
srand(static_cast<unsigned int>(time(NULL)));
|
||||
int N = 100;
|
||||
int N = 10;
|
||||
if( argc > 1 )
|
||||
N = atoi(argv[1]);
|
||||
go<5>(N);
|
||||
go<4>(N);
|
||||
go<3>(N);
|
||||
//go<5>(N);
|
||||
//go<4>(N);
|
||||
//go<3>(N);
|
||||
go<2>(N);
|
||||
go<1>(N);
|
||||
//go<1>(N);
|
||||
|
||||
cerr << endl;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
#include <CGAL/Epick_d.h>
|
||||
#include <CGAL/point_generators_d.h>
|
||||
#include <CGAL/Regular_triangulation.h>
|
||||
#include <CGAL/Regular_triangulation_euclidean_traits.h>
|
||||
#include <CGAL/IO/Triangulation_off_ostream.h>
|
||||
#include <CGAL/algorithm.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
template<typename RTri>
|
||||
void test(const int d, const string & type, const int N)
|
||||
{
|
||||
typedef typename RTri::Vertex_handle Vertex_handle;
|
||||
typedef typename RTri::Point Point;
|
||||
typedef typename RTri::Bare_point Bare_point;
|
||||
|
||||
typedef CGAL::Random_points_in_cube_d<Bare_point> Random_points_iterator;
|
||||
|
||||
RTri rt(d);
|
||||
RTri rt_star_only(d);
|
||||
cerr << "\nBuilding Regular triangulation of (" << type << d
|
||||
<< ") dimension with " << N << " points\n";
|
||||
assert(rt.empty());
|
||||
assert(rt_star_only.empty());
|
||||
|
||||
srand(static_cast<unsigned int>(time(NULL)));
|
||||
|
||||
// Insert first point (0, 0...)
|
||||
vector<double> coords(d);
|
||||
for( int j = 0; j < d; ++j )
|
||||
coords[j] = 0;
|
||||
|
||||
Point p = Point(
|
||||
Bare_point(d, coords.begin(), coords.end()),
|
||||
static_cast<double>(rand() % 10000)/100000);
|
||||
|
||||
rt.insert(p);
|
||||
Vertex_handle first_vertex = rt_star_only.insert(p);
|
||||
|
||||
// Insert the other points
|
||||
for( int i = 1 ; i < N ; ++i )
|
||||
{
|
||||
for( int j = 0; j < d; ++j )
|
||||
coords[j] = 10.*(rand() % RAND_MAX)/RAND_MAX - 5.;
|
||||
|
||||
p = Point(
|
||||
Bare_point(d, coords.begin(), coords.end()),
|
||||
static_cast<double>(rand() % 10000)/1000000);
|
||||
|
||||
rt.insert(p);
|
||||
rt_star_only.insert_if_in_star(p, first_vertex);
|
||||
}
|
||||
|
||||
cerr << "\nChecking topology and geometry..."
|
||||
<< (rt.is_valid(true) ? "OK.\n" : "Error.\n");
|
||||
|
||||
cerr << "\nThe triangulation using 'insert' has current dimension " << rt.current_dimension()
|
||||
<< " and " << rt.number_of_full_cells() << " full cells\n";
|
||||
|
||||
cerr << "\nThe triangulation using 'insert_if_in_star' has current dimension " << rt.current_dimension()
|
||||
<< " and " << rt_star_only.number_of_full_cells() << " full cells\n";
|
||||
|
||||
// Export
|
||||
if (d <= 3)
|
||||
{
|
||||
std::ofstream off_stream_all("data/test_insert_all.off");
|
||||
CGAL::export_triangulation_to_off(off_stream_all, rt);
|
||||
std::ofstream off_stream_star_only("data/test_insert_if_in_star.off");
|
||||
CGAL::export_triangulation_to_off(off_stream_star_only, rt_star_only);
|
||||
}
|
||||
}
|
||||
|
||||
template< int D >
|
||||
void go(const int N)
|
||||
{
|
||||
//typedef CGAL::Epick_d<CGAL::Dynamic_dimension_tag> FK;
|
||||
typedef CGAL::Epick_d<CGAL::Dimension_tag<D> > FK;
|
||||
typedef CGAL::Regular_triangulation_euclidean_traits<FK> Traits;
|
||||
typedef CGAL::Regular_triangulation<Traits> Triangulation;
|
||||
//test<Triangulation>(D, "dynamic", N);
|
||||
test<Triangulation>(D, "static", N);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
go<2>(100);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
#include <CGAL/Epick_d.h>
|
||||
#include <CGAL/point_generators_d.h>
|
||||
#include <CGAL/Regular_triangulation.h>
|
||||
#include <CGAL/Regular_triangulation_euclidean_traits.h>
|
||||
#include <CGAL/algorithm.h>
|
||||
|
||||
#include <tilted_grid.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
template<typename RTri>
|
||||
void test(const int d, const string & type, const int N)
|
||||
{
|
||||
typedef typename RTri::Full_cell_handle Full_cell_handle;
|
||||
typedef typename RTri::Face Face;
|
||||
typedef typename RTri::Point Point;
|
||||
typedef typename RTri::Bare_point Bare_point;
|
||||
typedef typename RTri::Finite_full_cell_const_iterator Finite_full_cell_const_iterator;
|
||||
typedef typename RTri::Finite_vertex_iterator Finite_vertex_iterator;
|
||||
|
||||
typedef CGAL::Random_points_in_cube_d<Bare_point> Random_points_iterator;
|
||||
|
||||
RTri rt(d);
|
||||
cerr << "\nBuilding Regular triangulation of (" << type << d << ") dimension with " << N << " points";
|
||||
assert(rt.empty());
|
||||
|
||||
vector<Point> points;
|
||||
//CGAL::Random rng;
|
||||
//Random_points_iterator rand_it(d, 2.0, rng); // CJTODO: unused
|
||||
|
||||
srand(10);
|
||||
for( int i = 0; i < N; ++i )
|
||||
{
|
||||
vector<double> coords(d);
|
||||
for( int j = 0; j < d; ++j )
|
||||
coords[j] = static_cast<double>(rand() % 100000)/10000;
|
||||
points.push_back(Point(
|
||||
Bare_point(d, coords.begin(), coords.end()),
|
||||
/*static_cast<double>(rand() % 100000)/100000*/static_cast<double>(i)/20
|
||||
));
|
||||
}
|
||||
rt.insert(points.begin(), points.end());
|
||||
cerr << "\nChecking topology and geometry...";
|
||||
assert( rt.is_valid(true) );
|
||||
|
||||
cerr << "\nTraversing finite full_cells... ";
|
||||
size_t nbfs(0), nbis(0);
|
||||
Finite_full_cell_const_iterator fsit = rt.finite_full_cells_begin();
|
||||
while( fsit != rt.finite_full_cells_end() )
|
||||
++fsit, ++nbfs;
|
||||
cerr << nbfs << " + ";
|
||||
vector<Full_cell_handle> infinite_full_cells;
|
||||
rt.tds().incident_full_cells(rt.infinite_vertex(), back_inserter(infinite_full_cells));
|
||||
nbis = infinite_full_cells.size();
|
||||
cerr << nbis << " = " << (nbis+nbfs)
|
||||
<< " = " << rt.number_of_full_cells();
|
||||
cerr << "\nThe triangulation has current dimension " << rt.current_dimension();
|
||||
CGAL_assertion( rt.number_of_full_cells() == nbis+nbfs);
|
||||
|
||||
cerr << "\nTraversing finite vertices... ";
|
||||
size_t nbfv(0);
|
||||
Finite_vertex_iterator fvit = rt.finite_vertices_begin();
|
||||
while( fvit != rt.finite_vertices_end() )
|
||||
++fvit, ++nbfv;
|
||||
cerr << nbfv <<endl;
|
||||
|
||||
// Count convex hull vertices:
|
||||
if( rt.maximal_dimension() > 1 )
|
||||
{
|
||||
typedef vector<Face> Faces;
|
||||
Faces edges;
|
||||
back_insert_iterator<Faces> out(edges);
|
||||
rt.tds().incident_faces(rt.infinite_vertex(), 1, out);
|
||||
cout << "\nThere are " << edges.size() << " vertices on the convex hull.";
|
||||
edges.clear();
|
||||
}
|
||||
else // rt.maximal_dimension() == 1
|
||||
{
|
||||
typedef vector<Full_cell_handle> Cells;
|
||||
Cells cells;
|
||||
back_insert_iterator<Cells> out(cells);
|
||||
rt.tds().incident_full_cells(rt.infinite_vertex(), out);
|
||||
cout << "\nThere are " << cells.size() << " vertices on the convex hull.";
|
||||
cells.clear();
|
||||
}
|
||||
|
||||
// Remove all !
|
||||
cerr << "\nBefore removal: " << rt.number_of_vertices() << " vertices. After: ";
|
||||
random_shuffle(points.begin(), points.end());
|
||||
rt.remove(points.begin(), points.end());
|
||||
assert( rt.is_valid() );
|
||||
//std::cerr << ((rt.is_valid(true)) ? "VALID!" : "NOT VALID :(") << std::endl;
|
||||
cerr << rt.number_of_vertices() << " vertices.";
|
||||
// assert( rt.empty() ); NOT YET !
|
||||
// CLEAR
|
||||
rt.clear();
|
||||
assert( -1 == rt.current_dimension() );
|
||||
assert( rt.empty() );
|
||||
assert( rt.is_valid() );
|
||||
//std::cerr << ((rt.is_valid(true)) ? "VALID!" : "NOT VALID :(") << std::endl;
|
||||
}
|
||||
|
||||
template< int D >
|
||||
void go(const int N)
|
||||
{
|
||||
//typedef CGAL::Epick_d<CGAL::Dynamic_dimension_tag> FK;
|
||||
typedef CGAL::Epick_d<CGAL::Dimension_tag<D> > FK;
|
||||
typedef CGAL::Regular_triangulation_euclidean_traits<FK> Traits;
|
||||
typedef CGAL::Regular_triangulation<Traits> Triangulation;
|
||||
//test<Triangulation>(D, "dynamic", N);
|
||||
test<Triangulation>(D, "static", N);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
srand(static_cast<unsigned int>(time(NULL)));
|
||||
int N = 10;
|
||||
if( argc > 1 )
|
||||
N = atoi(argv[1]);
|
||||
//go<5>(N);
|
||||
//go<4>(N);
|
||||
go<3>(N);
|
||||
go<2>(N);
|
||||
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -118,10 +118,10 @@ int main(int argc, char **argv)
|
|||
int N = 1000;
|
||||
if( argc > 1 )
|
||||
N = atoi(argv[1]);
|
||||
go<5>(N);
|
||||
go<3>(N);
|
||||
//go<5>(N);
|
||||
//go<3>(N);
|
||||
go<2>(N);
|
||||
go<1>(N);
|
||||
//go<1>(N);
|
||||
|
||||
cerr << std::endl;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
0 0 6.28953
|
||||
-2.85086 -0.471442 6.12896
|
||||
1.90972 0.101219 0.988689
|
||||
0.637771 2.59367 5.80372
|
||||
2.22209 0.903198 2.19478
|
||||
-0.487202 -2.71506 4.90996
|
||||
1.1193 -1.91787 2.99626
|
||||
1.54714 0.109831 0
|
||||
0.44556 -2.73047 4.48142
|
||||
0.427936 1.28495 6.23624
|
||||
-2.67212 0.766674 5.29623
|
||||
1.5763 -1.59828 2.58905
|
||||
-0.476603 2.2546 6.04797
|
||||
1.57172 -0.514711 6.11405
|
||||
1.84528 2.10139 5.53936
|
||||
-2.99827 -0.101677 5.92246
|
||||
-0.482122 -2.39584 4.44264
|
||||
-2.25558 -1.492 6.23448
|
||||
0.128475 -1.75125 3.18916
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Regular_triangulation_euclidean_traits_2.h>
|
||||
#include <CGAL/Regular_triangulation_filtered_traits_2.h>
|
||||
#include <CGAL/Regular_triangulation_2.h>
|
||||
#include <CGAL/IO/Triangulation_off_ostream_2.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Regular_triangulation_filtered_traits_2<K> Traits;
|
||||
typedef CGAL::Regular_triangulation_2<Traits> Regular_triangulation;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ifstream in("data/points.cin");
|
||||
|
||||
Regular_triangulation::Weighted_point wp;
|
||||
std::vector<Regular_triangulation::Weighted_point> wpoints;
|
||||
|
||||
while(in >> wp)
|
||||
wpoints.push_back(wp);
|
||||
|
||||
Regular_triangulation rt(wpoints.begin(), wpoints.end());
|
||||
CGAL_assertion(rt.is_valid(true));
|
||||
std::ofstream off_stream("data/rt2.off");
|
||||
CGAL::export_triangulation_2_to_off(off_stream, rt);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
// 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 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) : Clement Jamin
|
||||
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_OFF_OSTREAM_2_H
|
||||
#define CGAL_TRIANGULATION_OFF_OSTREAM_2_H
|
||||
|
||||
#include <CGAL/Triangulation_2.h>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class GT, class TDS >
|
||||
std::ostream &
|
||||
export_triangulation_2_to_off(std::ostream & os,
|
||||
const Triangulation_2<GT,TDS> & tr)
|
||||
{
|
||||
typedef Triangulation_2<GT,TDS> Tr;
|
||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||
typedef typename Tr::Vertex_iterator Vertex_iterator;
|
||||
typedef typename Tr::Finite_vertices_iterator Finite_vertex_iterator;
|
||||
typedef typename Tr::Finite_faces_iterator Finite_faces_iterator;
|
||||
|
||||
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();
|
||||
it != tr.finite_vertices_end(); ++it, ++i)
|
||||
{
|
||||
output << it->point().x() << " " << it->point().y() << " 0" << std::endl;
|
||||
index_of_vertex[it.base()] = i;
|
||||
}
|
||||
CGAL_assertion( i == n );
|
||||
|
||||
size_t number_of_triangles = 0;
|
||||
|
||||
for (Finite_faces_iterator fit = tr.finite_faces_begin() ;
|
||||
fit != tr.finite_faces_end() ; ++fit)
|
||||
{
|
||||
output << "3 "
|
||||
<< index_of_vertex[fit->vertex(0)] << " "
|
||||
<< index_of_vertex[fit->vertex(1)] << " "
|
||||
<< index_of_vertex[fit->vertex(2)]
|
||||
<< std::endl;
|
||||
++number_of_triangles;
|
||||
}
|
||||
|
||||
os << "OFF \n"
|
||||
<< n << " "
|
||||
<< number_of_triangles << " 0\n"
|
||||
<< output.str();
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_TRIANGULATION_OFF_OSTREAM_2_H
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
0.0071 1.6899 2.521 0
|
||||
0.3272 1.3694 3.15 0.05
|
||||
1.3697 1.8296 2.654 0.1
|
||||
-10.6722 0.3012 0.1548 1000.15
|
||||
1.1726 0.1899 0.3658 0.2
|
||||
0.4374 20.8541 1.45894 2000.25
|
||||
2.5923 0.1904 0.6971 0.3
|
||||
10.3083 2.5462 1.3658 1000.35
|
||||
1.4981 1.3929 2.949 0.4
|
||||
2.1304 2.055 0.6597455 1.45
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
0.0071 1.6899 2.521 0
|
||||
0.3272 1.3694 3.15 0
|
||||
1.3697 1.8296 2.654 0
|
||||
-10.6722 0.3012 0.1548 0
|
||||
1.1726 0.1899 0.3658 0
|
||||
0.4374 20.8541 1.45894 0
|
||||
2.5923 0.1904 0.6971 0
|
||||
10.3083 2.5462 1.3658 0
|
||||
1.4981 1.3929 2.949 0
|
||||
2.1304 2.055 0.6597455 0
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
0.0071 1.6899 2.521 0
|
||||
0.3272 1.3694 3.15 0
|
||||
1.3697 1.8296 2.654 0
|
||||
-10.6722 0.3012 0.1548 0
|
||||
1.1726 0.1899 0.3658 0
|
||||
0.4374 20.8541 1.45894 0
|
||||
2.5923 0.1904 0.6971 0
|
||||
10.3083 2.5462 1.3658 0
|
||||
1.4981 1.3929 2.949 0
|
||||
2.1304 2.055 0.6597455 0
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Regular_triangulation_3.h>
|
||||
#include <CGAL/Regular_triangulation_euclidean_traits_3.h>
|
||||
#include <CGAL/IO/Triangulation_off_ostream_3.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Regular_triangulation_euclidean_traits_3<K> Traits;
|
||||
typedef CGAL::Regular_triangulation_3<Traits> Regular_triangulation;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ifstream in("data/points.cin");
|
||||
|
||||
Regular_triangulation::Weighted_point wp;
|
||||
std::vector<Regular_triangulation::Weighted_point> wpoints;
|
||||
|
||||
while(in >> wp)
|
||||
wpoints.push_back(wp);
|
||||
|
||||
Regular_triangulation rt(wpoints.begin(), wpoints.end());
|
||||
std::ofstream off_stream("data/rt3.off");
|
||||
CGAL::export_triangulation_3_to_off(off_stream, rt);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
// 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 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) : Clement Jamin
|
||||
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_OFF_OSTREAM_3_H
|
||||
#define CGAL_TRIANGULATION_OFF_OSTREAM_3_H
|
||||
|
||||
#include <CGAL/Triangulation_3.h>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class GT, class TDS >
|
||||
std::ostream &
|
||||
export_triangulation_3_to_off(std::ostream & os,
|
||||
const Triangulation_3<GT,TDS> & tr,
|
||||
bool export_surface_only = false)
|
||||
{
|
||||
typedef Triangulation_3<GT,TDS> Tr;
|
||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||
typedef typename Tr::Vertex_iterator Vertex_iterator;
|
||||
typedef typename Tr::Finite_vertices_iterator Finite_vertex_iterator;
|
||||
typedef typename Tr::All_cells_iterator Cells_iterator;
|
||||
typedef typename Tr::Finite_cells_iterator Finite_cells_iterator;
|
||||
|
||||
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();
|
||||
it != tr.finite_vertices_end(); ++it, ++i)
|
||||
{
|
||||
output << it->point().x() << " "
|
||||
<< it->point().y() << " "
|
||||
<< it->point().z() << std::endl;
|
||||
index_of_vertex[it.base()] = i;
|
||||
}
|
||||
CGAL_assertion( i == n );
|
||||
|
||||
size_t number_of_triangles = 0;
|
||||
|
||||
if (export_surface_only)
|
||||
{
|
||||
for (Cells_iterator cit = tr.cells_begin() ;
|
||||
cit != tr.cells_end() ; ++cit)
|
||||
{
|
||||
if (tr.is_infinite(cit))
|
||||
{
|
||||
output << "3 ";
|
||||
for (int i = 0 ; i < 4 ; ++i)
|
||||
{
|
||||
if (!tr.is_infinite(cit->vertex(i)))
|
||||
output << index_of_vertex[cit->vertex(i)] << " ";
|
||||
}
|
||||
output << std::endl;
|
||||
++number_of_triangles;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Finite_cells_iterator cit = tr.finite_cells_begin() ;
|
||||
cit != tr.finite_cells_end() ; ++cit)
|
||||
{
|
||||
output << "3 "
|
||||
<< index_of_vertex[cit->vertex(0)] << " "
|
||||
<< index_of_vertex[cit->vertex(1)] << " "
|
||||
<< index_of_vertex[cit->vertex(2)]
|
||||
<< std::endl;
|
||||
output << "3 "
|
||||
<< index_of_vertex[cit->vertex(0)] << " "
|
||||
<< index_of_vertex[cit->vertex(2)] << " "
|
||||
<< index_of_vertex[cit->vertex(3)]
|
||||
<< std::endl;
|
||||
output << "3 "
|
||||
<< index_of_vertex[cit->vertex(1)] << " "
|
||||
<< index_of_vertex[cit->vertex(2)] << " "
|
||||
<< index_of_vertex[cit->vertex(3)]
|
||||
<< std::endl;
|
||||
output << "3 "
|
||||
<< index_of_vertex[cit->vertex(0)] << " "
|
||||
<< index_of_vertex[cit->vertex(1)] << " "
|
||||
<< index_of_vertex[cit->vertex(3)]
|
||||
<< std::endl;
|
||||
number_of_triangles += 4;
|
||||
}
|
||||
}
|
||||
|
||||
os << "OFF \n"
|
||||
<< n << " "
|
||||
<< number_of_triangles << " 0\n"
|
||||
<< output.str();
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_TRIANGULATION_OFF_OSTREAM_3_H
|
||||
Loading…
Reference in New Issue