mirror of https://github.com/CGAL/cgal
merged next prior to reintegration
This commit is contained in:
commit
c51a88d593
|
|
@ -4291,7 +4291,6 @@ Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp -t
|
|||
Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp -text
|
||||
Triangulation_2/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp -text
|
||||
Triangulation_2/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp -text
|
||||
Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp -text
|
||||
Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_proj.cpp -text
|
||||
Triangulation_3/demo/Triangulation_3/CMakeLists.txt -text
|
||||
Triangulation_3/demo/Triangulation_3/MainWindow.cpp -text
|
||||
|
|
|
|||
|
|
@ -52,15 +52,14 @@ public:
|
|||
|
||||
#ifndef CGAL_CFG_MATCHING_BUG_6
|
||||
using Base::operator();
|
||||
#else
|
||||
|
||||
#else // CGAL_CFG_MATCHING_BUG_6
|
||||
template <typename T1, typename T2>
|
||||
result_type
|
||||
operator()(const T1& t1, const T2& t2) const
|
||||
{
|
||||
return Base()(t1,t2);
|
||||
}
|
||||
#endif
|
||||
#endif // CGAL_CFG_MATCHING_BUG_6
|
||||
|
||||
|
||||
Sign sign_with_error(const double x, const double error) const {
|
||||
|
|
@ -155,13 +154,12 @@ public:
|
|||
return err;
|
||||
}
|
||||
|
||||
}; // class Angle_3
|
||||
}; // end class Angle_3
|
||||
|
||||
} // namespace Static_filters_predicates
|
||||
} // end namespace Static_filters_predicates
|
||||
|
||||
} // namespace internal
|
||||
} // end namespace internal
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif // CGAL_INTERNAL_STATIC_FILTERS_ANGLE_3_H
|
||||
|
|
|
|||
|
|
@ -40,13 +40,14 @@ namespace internal {
|
|||
namespace Static_filters_predicates {
|
||||
|
||||
|
||||
template < typename K_base >
|
||||
template < typename K_base, typename SFK >
|
||||
class Do_intersect_3
|
||||
: public K_base::Do_intersect_3
|
||||
{
|
||||
typedef typename K_base::Point_3 Point_3;
|
||||
typedef typename K_base::Ray_3 Ray_3;
|
||||
typedef typename K_base::Segment_3 Segment_3;
|
||||
typedef typename K_base::Triangle_3 Triangle_3;
|
||||
typedef typename K_base::Do_intersect_3 Base;
|
||||
|
||||
public:
|
||||
|
|
@ -56,15 +57,14 @@ public:
|
|||
|
||||
#ifndef CGAL_CFG_MATCHING_BUG_6
|
||||
using Base::operator();
|
||||
#else
|
||||
|
||||
#else // CGAL_CFG_MATCHING_BUG_6
|
||||
template <typename T1, typename T2>
|
||||
result_type
|
||||
operator()(const T1& t1, const T2& t2) const
|
||||
{
|
||||
return Base()(t1,t2);
|
||||
}
|
||||
#endif
|
||||
#endif // CGAL_CFG_MATCHING_BUG_6
|
||||
|
||||
|
||||
Sign sign_with_error(const double x, const double error) const {
|
||||
|
|
@ -73,6 +73,26 @@ public:
|
|||
else return ZERO;
|
||||
}
|
||||
|
||||
|
||||
// The internal::do_intersect(..) function
|
||||
// only performs orientation tests on the vertices
|
||||
// of the triangle and the segment
|
||||
// By calling the do_intersect function with
|
||||
// the statically filtered kernel we avoid
|
||||
// that doubles are put into Inteval_nt
|
||||
// to get taken out again with fit_in_double
|
||||
result_type
|
||||
operator()(const Segment_3 &s, const Triangle_3& t) const
|
||||
{
|
||||
return internal::do_intersect(t,s, SFK());
|
||||
}
|
||||
|
||||
result_type
|
||||
operator()(const Triangle_3& t, const Segment_3 &s) const
|
||||
{
|
||||
return internal::do_intersect(t,s, SFK());
|
||||
}
|
||||
|
||||
result_type
|
||||
operator()(const Bbox_3& b, const Segment_3 &s) const
|
||||
{
|
||||
|
|
@ -493,11 +513,11 @@ public:
|
|||
|
||||
}; // class Do_intersect_3
|
||||
|
||||
} // namespace Static_filters_predicates
|
||||
} // end namespace Static_filters_predicates
|
||||
|
||||
} // namespace internal
|
||||
} // end namespace internal
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif // CGAL_INTERNAL_STATIC_FILTERS_DO_INTERSECT_3_H
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
// Copyright (c) 2011 GeometryFactory Sarl (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; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// 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) : Andreas Fabri
|
||||
|
||||
|
||||
#ifndef CGAL_INTERNAL_STATIC_FILTERS_EQUAL_3_H
|
||||
#define CGAL_INTERNAL_STATIC_FILTERS_EQUAL_3_H
|
||||
|
||||
#include <CGAL/Bbox_3.h>
|
||||
#include <CGAL/Profile_counter.h>
|
||||
#include <CGAL/internal/Static_filters/tools.h>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace internal {
|
||||
|
||||
namespace Static_filters_predicates {
|
||||
|
||||
|
||||
template < typename K_base >
|
||||
class Equal_3
|
||||
: public K_base::Equal_3
|
||||
{
|
||||
typedef typename K_base::Point_3 Point_3;
|
||||
typedef typename K_base::Equal_3 Base;
|
||||
|
||||
public:
|
||||
|
||||
typedef typename Base::result_type result_type;
|
||||
|
||||
|
||||
#ifndef CGAL_CFG_MATCHING_BUG_6
|
||||
using Base::operator();
|
||||
#else // CGAL_CFG_MATCHING_BUG_6
|
||||
template <typename T>
|
||||
result_type
|
||||
operator()(const T& t1, const T& t2) const
|
||||
{
|
||||
return Base()(t1,t2);
|
||||
}
|
||||
#endif // CGAL_CFG_MATCHING_BUG_6
|
||||
|
||||
|
||||
result_type operator()(const Point_3 &p, const Point_3& q) const
|
||||
{
|
||||
CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
|
||||
Get_approx<Point_3> get_approx; // Identity functor for all points
|
||||
// but lazy points
|
||||
double px, py, pz, qx, qy, qz;
|
||||
|
||||
if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
|
||||
fit_in_double(get_approx(p).z(), pz) &&
|
||||
fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
|
||||
fit_in_double(get_approx(q).z(), qz) )
|
||||
{
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
return px == qx && py == qy && pz == qz;
|
||||
}
|
||||
return Base::operator()(p, q);
|
||||
}
|
||||
|
||||
|
||||
}; // end class Equal_3
|
||||
|
||||
} // end namespace Static_filters_predicates
|
||||
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif // CGAL_INTERNAL_STATIC_FILTERS_EQUAL_3_H
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
// Copyright (c) 2011 GeometryFactory (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// 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) : Andreas Fabri, Laurent Rineau
|
||||
|
||||
|
||||
#ifndef CGAL_INTERNAL_STATIC_FILTERS_IS_DEGENERATE_3_H
|
||||
#define CGAL_INTERNAL_STATIC_FILTERS_IS_DEGENERATE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace internal {
|
||||
|
||||
namespace Static_filters_predicates {
|
||||
|
||||
|
||||
template < typename K_base, typename SFK >
|
||||
class Is_degenerate_3
|
||||
: public K_base::Is_degenerate_3
|
||||
{
|
||||
typedef typename K_base::Ray_3 Ray_3;
|
||||
typedef typename K_base::Segment_3 Segment_3;
|
||||
typedef typename K_base::Is_degenerate_3 Base;
|
||||
typedef typename K_base::Construct_source_3 Construct_source_3;
|
||||
typedef typename K_base::Construct_target_3 Construct_target_3;
|
||||
typedef typename K_base::Construct_second_point_3 Construct_second_point_3;
|
||||
typedef typename SFK::Equal_3 Equal_3;
|
||||
|
||||
public:
|
||||
|
||||
typedef typename Base::result_type result_type;
|
||||
|
||||
|
||||
#ifndef CGAL_CFG_MATCHING_BUG_6
|
||||
using Base::operator();
|
||||
#else // CGAL_CFG_MATCHING_BUG_6
|
||||
template <typename T>
|
||||
result_type
|
||||
operator()(const T& t) const
|
||||
{
|
||||
return Base()(t);
|
||||
}
|
||||
#endif // end CGAL_CFG_MATCHING_BUG_6
|
||||
|
||||
|
||||
result_type
|
||||
operator()(const Segment_3& s) const
|
||||
{
|
||||
return Equal_3()(Construct_source_3()(s), Construct_target_3()(s));
|
||||
}
|
||||
|
||||
|
||||
result_type
|
||||
operator()(const Ray_3& r) const
|
||||
{
|
||||
return Equal_3()(Construct_source_3()(r), Construct_second_point_3()(r));
|
||||
}
|
||||
|
||||
}; // end class Is_degenerate_3
|
||||
|
||||
} // end namespace Static_filters_predicates
|
||||
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif // CGAL_INTERNAL_STATIC_FILTERS_IS_DEGENERATE_3_H
|
||||
|
|
@ -37,12 +37,32 @@
|
|||
#include <CGAL/internal/Static_filters/tools.h>
|
||||
#include <CGAL/internal/Static_filters/Orientation_2.h>
|
||||
#include <CGAL/internal/Static_filters/Orientation_3.h>
|
||||
|
||||
// for static filters added nov./dec. 2011
|
||||
#ifdef CGAL_DISABLE_STATIC_FILTERS_ADDED_2011
|
||||
# define CGAL_NO_EQUAL_3_STATIC_FILTERS 1
|
||||
# define CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS 1
|
||||
# define CGAL_NO_ANGLE_3_STATIC_FILTERS 1
|
||||
# define CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS 1
|
||||
#endif // CGAL_DISABLE_STATIC_FILTERS_ADDED_2011
|
||||
|
||||
|
||||
#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
|
||||
# include <CGAL/internal/Static_filters/Equal_3.h>
|
||||
#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
|
||||
|
||||
#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
|
||||
# include <CGAL/internal/Static_filters/Is_degenerate_3.h>
|
||||
#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
|
||||
|
||||
#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
|
||||
# include <CGAL/internal/Static_filters/Angle_3.h>
|
||||
#endif // CGAL_NO_ANGLE_3_STATIC_FILTERS
|
||||
#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
|
||||
|
||||
#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
|
||||
# include <CGAL/internal/Static_filters/Do_intersect_3.h>
|
||||
#endif // NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
|
||||
#endif // NOT NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
|
||||
|
||||
#include <CGAL/internal/Static_filters/Compare_y_at_x_2.h>
|
||||
#include <CGAL/internal/Static_filters/Side_of_oriented_circle_2.h>
|
||||
#include <CGAL/internal/Static_filters/Side_of_oriented_sphere_3.h>
|
||||
|
|
@ -88,14 +108,20 @@ class Static_filters : public K_base {
|
|||
has_cheap_access_to_cartesian_coordinates> Self;
|
||||
|
||||
public:
|
||||
#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
|
||||
typedef Static_filters_predicates::Equal_3<K_base> Equal_3;
|
||||
#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
|
||||
|
||||
#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
|
||||
typedef Static_filters_predicates::Is_degenerate_3<K_base, Self> Is_degenerate_3;
|
||||
#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
|
||||
typedef Static_filters_predicates::Orientation_2<K_base> Orientation_2;
|
||||
typedef Static_filters_predicates::Orientation_3<K_base> Orientation_3;
|
||||
#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
|
||||
typedef Static_filters_predicates::Angle_3<K_base> Angle_3;
|
||||
#endif // CGAL_NO_ANGLE_3_STATIC_FILTERS
|
||||
#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
|
||||
#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
|
||||
typedef Static_filters_predicates::Do_intersect_3<K_base> Do_intersect_3;
|
||||
typedef Static_filters_predicates::Do_intersect_3<K_base,Self> Do_intersect_3;
|
||||
#endif // NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
|
||||
typedef Static_filters_predicates::Side_of_oriented_circle_2<K_base> Side_of_oriented_circle_2;
|
||||
typedef Static_filters_predicates::Side_of_oriented_sphere_3<K_base> Side_of_oriented_sphere_3;
|
||||
|
|
@ -109,6 +135,18 @@ public:
|
|||
orientation_3_object() const
|
||||
{ return Orientation_3(); }
|
||||
|
||||
#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
|
||||
Equal_3
|
||||
equal_3_object() const
|
||||
{ return Equal_3(); }
|
||||
#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
|
||||
|
||||
#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
|
||||
Is_degenerate_3
|
||||
is_degenerate_3_object() const
|
||||
{ return Is_degenerate_3(); }
|
||||
#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
|
||||
|
||||
#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
|
||||
Angle_3
|
||||
angle_3_object() const
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ if(NOT USE_CGAL_FILE_INCLUDED)
|
|||
#message (STATUS "LIB: ${CGAL_LIBRARY}")
|
||||
#message (STATUS "LIBS: ${CGAL_LIBRARIES}")
|
||||
|
||||
include_directories ( BEFORE ${CGAL_INCLUDE_DIRS} ${CGAL_3RD_PARTY_INCLUDE_DIRS} )
|
||||
include_directories ( ${CGAL_INCLUDE_DIRS} ${CGAL_3RD_PARTY_INCLUDE_DIRS} )
|
||||
add_definitions ( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_DEFINITIONS} )
|
||||
|
||||
link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ shaihi = Shai Hirsch <shaihi@post.tau.ac.il>
|
|||
shornus = Samuel Hornus <Samuel.Hornus@sophia.inria.fr>
|
||||
singler = Johannes Singler <singler@ira.uka.de>
|
||||
slimbach = Sebastian Limbach <slimbach@mpi-inf.mpg.de>
|
||||
sloriot = Sébastien Loriot <Sebastien.Loriot@sophia.inria.fr>
|
||||
sloriot = Sébastien Loriot <sloriot.ml@gmail.com>
|
||||
soudot = Steve Oudot <Steve.Oudot@sophia.inria.fr>
|
||||
spion = Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
spostoll = Stéphane Postollec <Stephane.Postollec@sophia.inria.fr>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ It has to be a model of the \ccc{MeshDomain_3} concept.
|
|||
\ccc{MeshDomainWithFeatures_3}
|
||||
|
||||
\ccInheritsFrom
|
||||
\ccc{MeshDomain_3}
|
||||
\ccHtmlNoLinksFrom{\ccc{MeshDomain_3}}
|
||||
|
||||
\ccTypes
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ for the length of the edges which are used to discretize the curve segments.
|
|||
Note that if one parameter is set to 0, then its corresponding criteria is ignored.}
|
||||
|
||||
\ccConstructor{
|
||||
template <class SizingField, class DistanceField>
|
||||
template <class SizingField>
|
||||
Mesh_edge_criteria_3(
|
||||
SizingField length_bound);}
|
||||
% DistanceField distance_bound);}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ int main()
|
|||
|
||||
// Mesh criteria
|
||||
Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=4,
|
||||
cell_radius_edge=3, cell_size=8);
|
||||
cell_radius_edge_ratio=3, cell_size=8);
|
||||
|
||||
// Meshing
|
||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ int main()
|
|||
|
||||
// Mesh criteria
|
||||
Mesh_criteria criteria(facet_angle=30, facet_size=0.1, facet_distance=0.025,
|
||||
cell_radius_edge=2, cell_size=0.1);
|
||||
cell_radius_edge_ratio=2, cell_size=0.1);
|
||||
|
||||
// Mesh generation
|
||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ int main()
|
|||
|
||||
// Mesh criteria
|
||||
Mesh_criteria criteria(facet_angle=30, facet_size=5, facet_distance=1.5,
|
||||
cell_radius_edge=2, cell_size=7);
|
||||
cell_radius_edge_ratio=2, cell_size=7);
|
||||
|
||||
// Mesh generation and optimization in one call (sliver_bound is the
|
||||
// targeted dihedral angle in degree)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ int main()
|
|||
|
||||
// Mesh criteria
|
||||
Mesh_criteria criteria(facet_angle=30, facet_distance=1.2,
|
||||
cell_radius_edge=2);
|
||||
cell_radius_edge_ratio=2);
|
||||
|
||||
// Mesh generation and optimization in one call
|
||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ int main()
|
|||
|
||||
// Mesh criteria (no cell_size set)
|
||||
Mesh_criteria criteria(facet_angle=25, facet_size=0.15, facet_distance=0.008,
|
||||
cell_radius_edge=3);
|
||||
cell_radius_edge_ratio=3);
|
||||
|
||||
// Mesh generation
|
||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());
|
||||
|
|
@ -48,8 +48,8 @@ int main()
|
|||
c3t3.output_to_medit(medit_file);
|
||||
medit_file.close();
|
||||
|
||||
// Set tetrahedron size (keep cell_radius_edge), ignore facets
|
||||
Mesh_criteria new_criteria(cell_radius_edge=3, cell_size=0.03);
|
||||
// Set tetrahedron size (keep cell_radius_edge_ratio), ignore facets
|
||||
Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.03);
|
||||
|
||||
// Mesh refinement
|
||||
CGAL::refine_mesh_3(c3t3, domain, new_criteria);
|
||||
|
|
|
|||
|
|
@ -562,8 +562,8 @@ before_insertion_impl(const Facet& facet,
|
|||
" Refinement point: %5%\n")
|
||||
% (&*facet.first)
|
||||
% facet.second
|
||||
% facet.first->circumcenter()
|
||||
% source_other_side.first->circumcenter()
|
||||
% triangulation_ref_impl().dual(facet.first)
|
||||
% triangulation_ref_impl().dual(source_other_side.first)
|
||||
% point
|
||||
% facet.first->vertex((facet.second + 1)&3)->point()
|
||||
% facet.first->vertex((facet.second + 2)&3)->point()
|
||||
|
|
|
|||
|
|
@ -1,127 +0,0 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Triangulation_face_base_with_info_2.h>
|
||||
#include <CGAL/Polygon_2.h>
|
||||
#include <iostream>
|
||||
|
||||
struct FaceInfo2
|
||||
{
|
||||
FaceInfo2(){}
|
||||
int nesting_level;
|
||||
|
||||
bool in_domain(){
|
||||
return nesting_level%2 == 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
|
||||
typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo2,K> Fbb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<K,Fbb> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
|
||||
typedef CDT::Point Point;
|
||||
typedef CGAL::Polygon_2<K> Polygon;
|
||||
|
||||
void
|
||||
mark_domains(CDT& ct,
|
||||
CDT::Face_handle start,
|
||||
int index,
|
||||
std::list<CDT::Edge>& border )
|
||||
{
|
||||
if(start->info().nesting_level != -1){
|
||||
return;
|
||||
}
|
||||
std::list<CDT::Face_handle> queue;
|
||||
queue.push_back(start);
|
||||
|
||||
while(! queue.empty()){
|
||||
CDT::Face_handle fh = queue.front();
|
||||
queue.pop_front();
|
||||
if(fh->info().nesting_level == -1){
|
||||
fh->info().nesting_level = index;
|
||||
for(int i = 0; i < 3; i++){
|
||||
CDT::Edge e(fh,i);
|
||||
CDT::Face_handle n = fh->neighbor(i);
|
||||
if(n->info().nesting_level == -1){
|
||||
if(ct.is_constrained(e)) border.push_back(e);
|
||||
else queue.push_back(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//explore set of facets connected with non constrained edges,
|
||||
//and attribute to each such set a nesting level.
|
||||
//We start from facets incident to the infinite vertex, with a nesting
|
||||
//level of 0. Then we recursively consider the non-explored facets incident
|
||||
//to constrained edges bounding the former set and increase the nesting level by 1.
|
||||
//Facets in the domain are those with an odd nesting level.
|
||||
void
|
||||
mark_domains(CDT& cdt)
|
||||
{
|
||||
for(CDT::All_faces_iterator it = cdt.all_faces_begin(); it != cdt.all_faces_end(); ++it){
|
||||
it->info().nesting_level = -1;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
std::list<CDT::Edge> border;
|
||||
mark_domains(cdt, cdt.infinite_face(), index++, border);
|
||||
while(! border.empty()){
|
||||
CDT::Edge e = border.front();
|
||||
border.pop_front();
|
||||
CDT::Face_handle n = e.first->neighbor(e.second);
|
||||
if(n->info().nesting_level == -1){
|
||||
mark_domains(cdt, n, e.first->info().nesting_level+1, border);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void insert_polygon(CDT& cdt,const Polygon& polygon){
|
||||
if ( polygon.is_empty() ) return;
|
||||
CDT::Vertex_handle v_prev=cdt.insert(*CGAL::cpp0x::prev(polygon.vertices_end()));
|
||||
for (Polygon::Vertex_iterator vit=polygon.vertices_begin();
|
||||
vit!=polygon.vertices_end();++vit)
|
||||
{
|
||||
CDT::Vertex_handle vh=cdt.insert(*vit);
|
||||
cdt.insert_constraint(vh,v_prev);
|
||||
v_prev=vh;
|
||||
}
|
||||
}
|
||||
|
||||
int main( )
|
||||
{
|
||||
//construct two non-intersecting nested polygons
|
||||
Polygon polygon1;
|
||||
polygon1.push_back(Point(0,0));
|
||||
polygon1.push_back(Point(2,0));
|
||||
polygon1.push_back(Point(2,2));
|
||||
polygon1.push_back(Point(0,2));
|
||||
Polygon polygon2;
|
||||
polygon2.push_back(Point(0.5,0.5));
|
||||
polygon2.push_back(Point(1.5,0.5));
|
||||
polygon2.push_back(Point(1.5,1.5));
|
||||
polygon2.push_back(Point(0.5,1.5));
|
||||
|
||||
//Insert the polyons into a constrained triangulation
|
||||
CDT cdt;
|
||||
insert_polygon(cdt,polygon1);
|
||||
insert_polygon(cdt,polygon2);
|
||||
|
||||
//Mark facets that are inside the domain bounded by the polygon
|
||||
mark_domains(cdt);
|
||||
|
||||
int count=0;
|
||||
for (CDT::Finite_faces_iterator fit=cdt.finite_faces_begin();
|
||||
fit!=cdt.finite_faces_end();++fit)
|
||||
{
|
||||
if ( fit->info().in_domain() ) ++count;
|
||||
}
|
||||
|
||||
std::cout << "There are " << count << " facets in the domain." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -48,6 +48,8 @@ point $p\in\R^3$ or the weighted point ${p}^{(w)}=(p,w_p)$.
|
|||
|
||||
\ccTwo{RegularTriangulationTraits_3::Weighted_point_3xx}{}
|
||||
\ccNestedType{Weighted_point_3}{The weighted point type.}
|
||||
\ccGlue
|
||||
\ccNestedType{Bare_point}{The (un-weighted) point type.}
|
||||
|
||||
\ccTwo{Regular}{}
|
||||
\ccNestedType{Power_test_3}
|
||||
|
|
|
|||
Loading…
Reference in New Issue