Disable Point_3(const Weighted_point_3&)

This commit is contained in:
Andreas Fabri 2017-02-15 14:33:31 +01:00 committed by Mael Rouxel-Labbé
parent 2f895335d0
commit 787d46ffb8
19 changed files with 436 additions and 135 deletions

View File

@ -52,6 +52,7 @@ template <typename GT, typename Concurrency_tag>
class Compact_mesh_cell_base_3_base class Compact_mesh_cell_base_3_base
{ {
typedef typename GT::Point_3 Point; typedef typename GT::Point_3 Point;
typedef typename GT::Weighted_point_3 Weighted_point;
protected: protected:
Compact_mesh_cell_base_3_base() Compact_mesh_cell_base_3_base()
@ -238,6 +239,8 @@ public:
typedef GT Geom_traits; typedef GT Geom_traits;
typedef typename GT::Point_3 Point; typedef typename GT::Point_3 Point;
typedef typename GT::Weighted_point_3 Weighted_point_3;
typedef Point* Point_container; typedef Point* Point_container;
typedef Point* Point_iterator; typedef Point* Point_iterator;
@ -444,6 +447,7 @@ public:
Point_iterator hidden_points_begin() const { return hidden_points_end(); } Point_iterator hidden_points_begin() const { return hidden_points_end(); }
Point_iterator hidden_points_end() const { return NULL; } Point_iterator hidden_points_end() const { return NULL; }
void hide_point (const Point &) const { } void hide_point (const Point &) const { }
void hide_point (const Weighted_point_3 &) const { }
// We must override the functions that modify the vertices. // We must override the functions that modify the vertices.

View File

@ -638,6 +638,8 @@ class C3T3_helpers
typedef typename Gt::FT FT; typedef typename Gt::FT FT;
typedef typename Gt::Tetrahedron_3 Tetrahedron; typedef typename Gt::Tetrahedron_3 Tetrahedron;
typedef typename Gt::Construct_point_3 Construct_point_3;
typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Cell_handle Cell_handle;
typedef typename Tr::Cell Cell; typedef typename Tr::Cell Cell;
@ -711,7 +713,9 @@ public:
: Base(lock_ds) : Base(lock_ds)
, c3t3_(c3t3) , c3t3_(c3t3)
, tr_(c3t3.triangulation()) , tr_(c3t3.triangulation())
, domain_(domain) { } , domain_(domain)
, wp2p_(tr_.geom_traits().construct_point_3_object())
{ }
/** /**
* @brief tries to move \c old_vertex to \c new_position in the mesh * @brief tries to move \c old_vertex to \c new_position in the mesh
@ -2393,6 +2397,7 @@ private:
C3T3& c3t3_; C3T3& c3t3_;
Tr& tr_; Tr& tr_;
const MeshDomain& domain_; const MeshDomain& domain_;
Construct_point_3 wp2p_;
}; // class C3T3_helpers }; // class C3T3_helpers
@ -2449,7 +2454,6 @@ update_mesh_no_topo_change(const Point_3& new_position,
// << new_position << ",\n" // << new_position << ",\n"
// << " " << (void*)(&*old_vertex) << "=" << old_vertex->point() // << " " << (void*)(&*old_vertex) << "=" << old_vertex->point()
// << ")\n"; // << ")\n";
//backup metadata //backup metadata
std::set<Cell_data_backup> cells_backup; std::set<Cell_data_backup> cells_backup;
fill_cells_backup(conflict_cells, cells_backup); fill_cells_backup(conflict_cells, cells_backup);
@ -2457,7 +2461,7 @@ update_mesh_no_topo_change(const Point_3& new_position,
// Get old values // Get old values
criterion.before_move(c3t3_cells(conflict_cells)); criterion.before_move(c3t3_cells(conflict_cells));
// std::cerr << "old_sliver_value=" << old_sliver_value << std::endl; // std::cerr << "old_sliver_value=" << old_sliver_value << std::endl;
Point_3 old_position = old_vertex->point(); Point_3 old_position = wp2p_(old_vertex->point());
// Move point // Move point
reset_circumcenter_cache(conflict_cells); reset_circumcenter_cache(conflict_cells);
@ -2510,6 +2514,8 @@ update_mesh_topo_change(const Point_3& new_position,
// << " " << (void*)(&*old_vertex) << "=" << old_vertex->point() // << " " << (void*)(&*old_vertex) << "=" << old_vertex->point()
// << ")\n"; // << ")\n";
// check_c3t3(c3t3_); // check_c3t3(c3t3_);
Cell_set insertion_conflict_cells; Cell_set insertion_conflict_cells;
Cell_set removal_conflict_cells; Cell_set removal_conflict_cells;
Facet_vector insertion_conflict_boundary; Facet_vector insertion_conflict_boundary;
@ -2539,7 +2545,7 @@ update_mesh_topo_change(const Point_3& new_position,
criterion.before_move(c3t3_cells(conflict_cells)); criterion.before_move(c3t3_cells(conflict_cells));
// std::cerr << "old_sliver_value=" << old_sliver_value << std::endl; // std::cerr << "old_sliver_value=" << old_sliver_value << std::endl;
Point_3 old_position = old_vertex->point(); Point_3 old_position = wp2p_(old_vertex->point());
// Keep old boundary // Keep old boundary
Vertex_set old_incident_surface_vertices; Vertex_set old_incident_surface_vertices;
@ -2740,6 +2746,8 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells,
CGAL_HISTOGRAM_PROFILER("|vertex_to_proj|=", CGAL_HISTOGRAM_PROFILER("|vertex_to_proj|=",
static_cast<unsigned int>(vertex_to_proj.size())); static_cast<unsigned int>(vertex_to_proj.size()));
// Project interior vertices // Project interior vertices
// Note: ~0% of rebuild_restricted_delaunay time // Note: ~0% of rebuild_restricted_delaunay time
// TODO : iterate to be sure no interior vertice become on the surface // TODO : iterate to be sure no interior vertice become on the surface
@ -2748,7 +2756,7 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells,
it != vertex_to_proj.end() ; it != vertex_to_proj.end() ;
++it ) ++it )
{ {
Point_3 new_pos = project_on_surface((*it)->point(),*it); Point_3 new_pos = project_on_surface(wp2p_((*it)->point()),*it);
if ( ! equal(new_pos, Point_3()) ) if ( ! equal(new_pos, Point_3()) )
{ {
@ -3140,7 +3148,7 @@ move_point_topo_change_conflict_zone_known(
//o.w. deleted_cells will point to null pointer or so and crash //o.w. deleted_cells will point to null pointer or so and crash
const const
{ {
Point_3 old_position = old_vertex->point(); Point_3 old_position = wp2p_(old_vertex->point());
// make one set with conflict zone // make one set with conflict zone
Cell_set conflict_zone; Cell_set conflict_zone;
std::set_union(insertion_conflict_cells_begin, insertion_conflict_cells_end, std::set_union(insertion_conflict_cells_begin, insertion_conflict_cells_end,
@ -3353,7 +3361,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
const Cell_handle& cell = fit->first; const Cell_handle& cell = fit->first;
const int& i = fit->second; const int& i = fit->second;
surface_point_vector.push_back(cell->get_facet_surface_center(i)); surface_point_vector.push_back(wp2p_(cell->get_facet_surface_center(i)));
} }
} }
@ -3396,9 +3404,9 @@ project_on_surface(const Point_3& p,
return p; return p;
// Project // Project
if ( ! equal(p, v->point()) ) if ( ! equal(p, wp2p_(v->point())) )
return project_on_surface_aux(p, return project_on_surface_aux(p,
v->point(), wp2p_(v->point()),
plane.orthogonal_vector()); plane.orthogonal_vector());
else else
return project_on_surface_aux(p, return project_on_surface_aux(p,

View File

@ -118,7 +118,7 @@ private:
{ {
Project_on_plane(const Plane_3& plane) : plane_(plane) {} Project_on_plane(const Plane_3& plane) : plane_(plane) {}
Point_3 operator()(const Point_3& p) const Bare_point_3 operator()(const Bare_point_3& p) const
{ return Gt().construct_projected_point_3_object()(plane_,p); } { return Gt().construct_projected_point_3_object()(plane_,p); }
private: private:
@ -133,7 +133,7 @@ private:
To_2d(const Aff_transformation_3& to_2d) : to_2d_(to_2d) {} To_2d(const Aff_transformation_3& to_2d) : to_2d_(to_2d) {}
Point_2 operator()(const Point_3& p) const Point_2 operator()(const Point_3& p) const
{ return Point_2(to_2d_.transform(p).x(), to_2d_.transform(p).y()); } { return Point_2(to_2d_.transform(p.point()).x(), to_2d_.transform(p.point()).y()); }
private: private:
const Aff_transformation_3& to_2d_; const Aff_transformation_3& to_2d_;
@ -147,7 +147,7 @@ private:
To_3d(const Aff_transformation_3& to_3d) : to_3d_(to_3d) {} To_3d(const Aff_transformation_3& to_3d) : to_3d_(to_3d) {}
Point_3 operator()(const Point_2& p) const Point_3 operator()(const Point_2& p) const
{ return to_3d_.transform(Point_3(Bare_point_3(p.x(),p.y(),0))); } { return to_3d_.transform((Bare_point_3(p.x(),p.y(),0))); }
private: private:
const Aff_transformation_3& to_3d_; const Aff_transformation_3& to_3d_;
@ -209,7 +209,7 @@ private:
CGAL_precondition(c3t3.in_dimension(v) == 2); CGAL_precondition(c3t3.in_dimension(v) == 2);
// get all surface delaunay ball point // get all surface delaunay ball point
std::vector<Point_3> points = extract_lloyd_boundary_points(v,c3t3); std::vector<Bare_point_3> points = extract_lloyd_boundary_points(v,c3t3);
switch(points.size()) switch(points.size())
{ {
@ -246,14 +246,14 @@ private:
* Returns a vector containing surface delaunay ball center of surface * Returns a vector containing surface delaunay ball center of surface
* facets incident to vertex \c v * facets incident to vertex \c v
*/ */
std::vector<Point_3> extract_lloyd_boundary_points(const Vertex_handle& v, std::vector<Bare_point_3> extract_lloyd_boundary_points(const Vertex_handle& v,
const C3T3& c3t3) const const C3T3& c3t3) const
{ {
Facet_vector incident_facets; Facet_vector incident_facets;
incident_facets.reserve(64); incident_facets.reserve(64);
c3t3.triangulation().finite_incident_facets(v,std::back_inserter(incident_facets)); c3t3.triangulation().finite_incident_facets(v,std::back_inserter(incident_facets));
std::vector<Point_3> points; std::vector<Bare_point_3> points;
points.reserve(64); points.reserve(64);
// Get c3t3's facets incident to v, and add their surface delaunay ball // Get c3t3's facets incident to v, and add their surface delaunay ball
@ -328,7 +328,7 @@ private:
// Fit plane using point-based PCA: compute least square fitting plane // Fit plane using point-based PCA: compute least square fitting plane
Plane_3 plane; Plane_3 plane;
Point_3 point; Bare_point_3 point;
CGAL::linear_least_squares_fitting_3(first,last,plane, point, Dimension_tag<0>(), Gt(),Default_diagonalize_traits<FT, 3>()); CGAL::linear_least_squares_fitting_3(first,last,plane, point, Dimension_tag<0>(), Gt(),Default_diagonalize_traits<FT, 3>());
// Project all points to the plane // Project all points to the plane

View File

@ -224,7 +224,8 @@ class Mesh_global_optimizer
typedef typename C3T3::Triangulation Tr; typedef typename C3T3::Triangulation Tr;
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Tr::Point Point_3; typedef typename Gt::Point_3 Point_3;
typedef typename Gt::Weighted_point_3 Weighted_point_3;
typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Cell_handle Cell_handle;
typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Edge Edge; typedef typename Tr::Edge Edge;
@ -344,6 +345,7 @@ private:
else else
#endif // CGAL_LINKED_WITH_TBB #endif // CGAL_LINKED_WITH_TBB
{ {
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
// Get move for each moving vertex // Get move for each moving vertex
typename Moving_vertices_set::iterator vit = moving_vertices.begin(); typename Moving_vertices_set::iterator vit = moving_vertices.begin();
for ( ; vit != moving_vertices.end() ; ) for ( ; vit != moving_vertices.end() ; )
@ -354,7 +356,7 @@ private:
if ( CGAL::NULL_VECTOR != move ) if ( CGAL::NULL_VECTOR != move )
{ {
Point_3 new_position = translate(oldv->point(),move); Point_3 new_position = translate(wp2p(oldv->point()),move);
FT size = (Sizing_field::is_vertex_update_needed ? FT size = (Sizing_field::is_vertex_update_needed ?
sizing_field_(new_position, oldv) : 0); sizing_field_(new_position, oldv) : 0);
moves.push_back(cpp11::make_tuple(oldv,new_position,size)); moves.push_back(cpp11::make_tuple(oldv,new_position,size));
@ -477,10 +479,10 @@ private:
void operator()(const Vertex_handle& oldv) const void operator()(const Vertex_handle& oldv) const
{ {
Vector_3 move = m_mgo.compute_move(oldv); Vector_3 move = m_mgo.compute_move(oldv);
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
if ( CGAL::NULL_VECTOR != move ) if ( CGAL::NULL_VECTOR != move )
{ {
Point_3 new_position = m_translate(oldv->point(), move); Point_3 new_position = m_translate(wp2p(oldv->point()), move);
FT size = (MGO::Sizing_field::is_vertex_update_needed ? FT size = (MGO::Sizing_field::is_vertex_update_needed ?
m_sizing_field(new_position, oldv) : 0); m_sizing_field(new_position, oldv) : 0);
// typedef Triangulation_helpers<typename C3T3::Triangulation> Th; // typedef Triangulation_helpers<typename C3T3::Triangulation> Th;
@ -508,6 +510,7 @@ private:
{ {
MGO & m_mgo; MGO & m_mgo;
Local_list_ & m_local_lists; Local_list_ & m_local_lists;
typename Tr_::Geom_traits::Construct_point_3 wp2p;
public: public:
// Constructor // Constructor
@ -529,7 +532,7 @@ private:
Vertex_handle vh Vertex_handle vh
= Tr_::Triangulation_data_structure::Vertex_range::s_iterator_to(v); = Tr_::Triangulation_data_structure::Vertex_range::s_iterator_to(v);
m_local_lists.local().push_back( m_local_lists.local().push_back(
std::make_pair(v.point(), m_mgo.average_circumradius_length(vh))); std::make_pair(wp2p(v.point()), m_mgo.average_circumradius_length(vh)));
} }
}; };
@ -544,8 +547,8 @@ private:
Moving_vertices_set_ & m_moving_vertices; Moving_vertices_set_ & m_moving_vertices;
Outdated_cell_set_ & m_outdated_cells; Outdated_cell_set_ & m_outdated_cells;
typedef typename Tr_::Point Point_3; typedef typename Tr_::Geom_traits::Point_3 Point_3;
typedef typename Tr_::Vertex_handle Vertex_handle; typedef typename Tr_::Vertex_handle Vertex_handle;
public: public:
// Constructor // Constructor
@ -566,10 +569,12 @@ private:
// operator() // operator()
void operator()( const tbb::blocked_range<size_t>& r ) const void operator()( const tbb::blocked_range<size_t>& r ) const
{ {
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
for( size_t i = r.begin() ; i != r.end() ; ++i) for( size_t i = r.begin() ; i != r.end() ; ++i)
{ {
const Vertex_handle& v = cpp11::get<0>(m_moves[i]); const Vertex_handle& v = cpp11::get<0>(m_moves[i]);
const Point_3& new_position = cpp11::get<1>(m_moves[i]); const Point_3& new_position = wp2p(cpp11::get<1>(m_moves[i]));
// Get size at new position // Get size at new position
if ( MGO::Sizing_field::is_vertex_update_needed ) if ( MGO::Sizing_field::is_vertex_update_needed )
{ {
@ -846,6 +851,9 @@ compute_move(const Vertex_handle& v)
typename Gt::Construct_translated_point_3 translate = typename Gt::Construct_translated_point_3 translate =
Gt().construct_translated_point_3_object(); Gt().construct_translated_point_3_object();
typename Gt::Construct_point_3 wp2p =
Gt().construct_point_3_object();
Cell_vector incident_cells; Cell_vector incident_cells;
incident_cells.reserve(64); incident_cells.reserve(64);
#ifdef CGAL_LINKED_WITH_TBB #ifdef CGAL_LINKED_WITH_TBB
@ -866,8 +874,8 @@ compute_move(const Vertex_handle& v)
// Project surface vertex // Project surface vertex
if ( c3t3_.in_dimension(v) == 2 ) if ( c3t3_.in_dimension(v) == 2 )
{ {
Point_3 new_position = translate(v->point(),move); Point_3 new_position = translate(wp2p(v->point()),move);
move = vector(v->point(), helper_.project_on_surface(new_position,v)); move = vector(wp2p(v->point()), helper_.project_on_surface(wp2p(new_position),v));
} }
FT local_sq_size = min_circumradius_sq_length(v, incident_cells); FT local_sq_size = min_circumradius_sq_length(v, incident_cells);
@ -926,8 +934,10 @@ update_mesh(const Moves_vector& moves,
it != moves.end() ; it != moves.end() ;
++it ) ++it )
{ {
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
const Vertex_handle& v = cpp11::get<0>(*it); const Vertex_handle& v = cpp11::get<0>(*it);
const Point_3& new_position = cpp11::get<1>(*it); const Point_3& new_position = wp2p(cpp11::get<1>(*it));
// Get size at new position // Get size at new position
if ( Sizing_field::is_vertex_update_needed ) if ( Sizing_field::is_vertex_update_needed )
{ {
@ -992,7 +1002,7 @@ void
Mesh_global_optimizer<C3T3,Md,Mf,V_>:: Mesh_global_optimizer<C3T3,Md,Mf,V_>::
fill_sizing_field() fill_sizing_field()
{ {
std::map<Point_3,FT> value_map; std::map<Weighted_point_3,FT> value_map;
#ifdef CGAL_LINKED_WITH_TBB #ifdef CGAL_LINKED_WITH_TBB
// Parallel // Parallel

View File

@ -147,6 +147,7 @@ public:
#endif #endif
typedef typename C3T3::Triangulation Triangulation; typedef typename C3T3::Triangulation Triangulation;
typedef typename Triangulation::Point Point; typedef typename Triangulation::Point Point;
typedef typename Triangulation::Bare_point Bare_point;
typedef typename Kernel_traits<Point>::Kernel Kernel; typedef typename Kernel_traits<Point>::Kernel Kernel;
typedef typename Kernel::Vector_3 Vector; typedef typename Kernel::Vector_3 Vector;
typedef typename MeshDomain::Index Index; typedef typename MeshDomain::Index Index;
@ -549,7 +550,7 @@ initialize()
# ifdef CGAL_CONCURRENT_MESH_3_VERBOSE # ifdef CGAL_CONCURRENT_MESH_3_VERBOSE
std::cerr << "Adding points on a far sphere (radius = " << radius <<")..."; std::cerr << "Adding points on a far sphere (radius = " << radius <<")...";
# endif # endif
Random_points_on_sphere_3<Point> random_point(radius); Random_points_on_sphere_3<Bare_point> random_point(radius);
const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>( const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>(
float(tbb::task_scheduler_init::default_num_threads()) float(tbb::task_scheduler_init::default_num_threads())
* Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core); * Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core);

View File

@ -113,8 +113,8 @@ public:
typedef typename C3T3::Triangulation Tr; typedef typename C3T3::Triangulation Tr;
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Gt::FT FT; typedef typename Gt::FT FT;
typedef typename Gt::Point_3 Weighted_point; typedef typename Gt::Weighted_point_3 Weighted_point;
typedef typename Weighted_point::Point Bare_point; typedef typename Gt::Point_3 Bare_point;
typedef typename Weighted_point::Weight Weight; typedef typename Weighted_point::Weight Weight;
typedef typename C3T3::Cell_handle Cell_handle; typedef typename C3T3::Cell_handle Cell_handle;

View File

@ -427,8 +427,8 @@ protected:
{ {
const Facet mirror = mirror_facet(f); const Facet mirror = mirror_facet(f);
f.first->set_facet_surface_center(f.second, p); f.first->set_facet_surface_center(f.second, p.point());
mirror.first->set_facet_surface_center(mirror.second, p); mirror.first->set_facet_surface_center(mirror.second, p.point());
f.first->set_facet_surface_center_index(f.second,index); f.first->set_facet_surface_center_index(f.second,index);
mirror.first->set_facet_surface_center_index(mirror.second,index); mirror.first->set_facet_surface_center_index(mirror.second,index);
@ -1826,7 +1826,7 @@ is_facet_encroached(const Facet& facet,
// facet is encroached if the new point is near from center than // facet is encroached if the new point is near from center than
// one vertex of the facet // one vertex of the facet
return ( compare_distance(center, reference_point, point) != CGAL::SMALLER ); return ( compare_distance(center.point(), reference_point, point) != CGAL::SMALLER );
} }
template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_> template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
@ -1834,7 +1834,7 @@ bool
Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>:: Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
is_encroached_facet_refinable(Facet& facet) const is_encroached_facet_refinable(Facet& facet) const
{ {
typedef typename Gt::Point_3 Point_3; typedef typename Gt::Weighted_point_3 Weighted_point_3;
typedef typename Gt::FT FT; typedef typename Gt::FT FT;
typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius = typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius =
@ -1843,6 +1843,8 @@ is_encroached_facet_refinable(Facet& facet) const
typename Gt::Compare_weighted_squared_radius_3 compare = typename Gt::Compare_weighted_squared_radius_3 compare =
Gt().compare_weighted_squared_radius_3_object(); Gt().compare_weighted_squared_radius_3_object();
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
const Cell_handle& c = facet.first; const Cell_handle& c = facet.first;
const int& k = facet.second; const int& k = facet.second;
@ -1871,9 +1873,9 @@ is_encroached_facet_refinable(Facet& facet) const
++wp_nb; ++wp_nb;
} }
const Point_3& p1 = c->vertex(k1)->point(); const Weighted_point_3& p1 = c->vertex(k1)->point();
const Point_3& p2 = c->vertex(k2)->point(); const Weighted_point_3& p2 = c->vertex(k2)->point();
const Point_3& p3 = c->vertex(k3)->point(); const Weighted_point_3& p3 = c->vertex(k3)->point();
const FT min_ratio (0.16); // (0.2*2)^2 const FT min_ratio (0.16); // (0.2*2)^2

View File

@ -34,7 +34,6 @@
#include <CGAL/Cartesian_converter.h> #include <CGAL/Cartesian_converter.h>
#include <CGAL/Robust_construction.h> #include <CGAL/Robust_construction.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Regular_triangulation_euclidean_traits_3.h>
#include <CGAL/constructions/kernel_ftC3.h> #include <CGAL/constructions/kernel_ftC3.h>
namespace CGAL { namespace CGAL {
@ -49,6 +48,7 @@ public:
typedef Cartesian_converter<EK,K> Back_from_exact; typedef Cartesian_converter<EK,K> Back_from_exact;
typedef typename K::Point_3 Point_3; typedef typename K::Point_3 Point_3;
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::FT FT; typedef typename K::FT FT;
typedef FT result_type; typedef FT result_type;
@ -85,6 +85,14 @@ public:
} }
#endif // CGAL_CFG_MATCHING_BUG_6 #endif // CGAL_CFG_MATCHING_BUG_6
FT operator()( const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s ) const
{
return this->operator()(p.point(), q.point(), r.point(), s.point());
}
FT operator() ( const Point_3 & p, FT operator() ( const Point_3 & p,
const Point_3 & q, const Point_3 & q,
const Point_3 & r, const Point_3 & r,
@ -155,23 +163,25 @@ public:
typedef Cartesian_converter<K_, EK> To_exact; typedef Cartesian_converter<K_, EK> To_exact;
typedef Cartesian_converter<EK,K_> Back_from_exact; typedef Cartesian_converter<EK,K_> Back_from_exact;
typedef CGAL::Regular_triangulation_euclidean_traits_3<K_> Rt; typedef K_ Rt;
typedef CGAL::Regular_triangulation_euclidean_traits_3<EK> Exact_Rt; typedef EK Exact_Rt;
typedef typename Rt::Weighted_point_3 Weighted_point_3; typedef typename Rt::Weighted_point_3 Weighted_point_3;
typedef typename Rt::Bare_point Bare_point; typedef typename Rt::Point_3 Bare_point;
typedef typename Rt::FT FT; typedef typename Rt::FT FT;
typedef typename Rt::Sphere_3 Sphere_3; typedef typename Rt::Sphere_3 Sphere_3;
typedef Bare_point result_type; typedef Bare_point result_type;
typename Rt::Construct_point_3 wp2p = Rt().construct_point_3_object();
Bare_point operator() ( const Weighted_point_3 & p, Bare_point operator() ( const Weighted_point_3 & p,
const Weighted_point_3 & q, const Weighted_point_3 & q,
const Weighted_point_3 & r, const Weighted_point_3 & r,
const Weighted_point_3 & s, const Weighted_point_3 & s,
bool force_exact = false) const bool force_exact = false) const
{ {
CGAL_precondition(Rt().orientation_3_object()(p,q,r,s) == CGAL::POSITIVE); CGAL_precondition(Rt().orientation_3_object()(p.point(),q.point(),r.point(),s.point()) == CGAL::POSITIVE);
// We use power_side_of_power_sphere_3: it is static filtered and // We use power_side_of_power_sphere_3: it is static filtered and
// we know that p,q,r,s are positive oriented // we know that p,q,r,s are positive oriented
@ -225,7 +235,9 @@ public:
const Weighted_point_3 & q, const Weighted_point_3 & q,
const Weighted_point_3 & r ) const const Weighted_point_3 & r ) const
{ {
CGAL_precondition(! Rt().collinear_3_object()(p,q,r) ); CGAL_precondition(! Rt().collinear_3_object()(wp2p(p),
wp2p(q),
wp2p(r)) );
typename Rt::Side_of_bounded_sphere_3 side_of_bounded_sphere = typename Rt::Side_of_bounded_sphere_3 side_of_bounded_sphere =
Rt().side_of_bounded_sphere_3_object(); Rt().side_of_bounded_sphere_3_object();
@ -243,7 +255,7 @@ public:
Bare_point res(p.x() + num_x*inv, p.y() - num_y*inv, p.z() + num_z*inv); Bare_point res(p.x() + num_x*inv, p.y() - num_y*inv, p.z() + num_z*inv);
// Fast output // Fast output
if ( side_of_bounded_sphere(p,q,r,res) == CGAL::ON_BOUNDED_SIDE ) if ( side_of_bounded_sphere(wp2p(p),wp2p(q),wp2p(r),res) == CGAL::ON_BOUNDED_SIDE )
return res; return res;
} }
@ -271,7 +283,7 @@ public:
result_type point = weighted_circumcenter(p,q); result_type point = weighted_circumcenter(p,q);
// Fast output // Fast output
if ( side_of_bounded_sphere(p,q,point) == CGAL::ON_BOUNDED_SIDE ) if ( side_of_bounded_sphere(p.point(),q.point(),point) == CGAL::ON_BOUNDED_SIDE )
return point; return point;
// Switch to exact // Switch to exact
@ -295,8 +307,8 @@ public:
typedef Cartesian_converter<K_, EK> To_exact; typedef Cartesian_converter<K_, EK> To_exact;
typedef Cartesian_converter<EK,K_> Back_from_exact; typedef Cartesian_converter<EK,K_> Back_from_exact;
typedef CGAL::Regular_triangulation_euclidean_traits_3<K_> Rt; typedef K_ Rt;
typedef CGAL::Regular_triangulation_euclidean_traits_3<EK> Exact_Rt; typedef EK Exact_Rt;
typedef typename Rt::Weighted_point_3 Weighted_point_3; typedef typename Rt::Weighted_point_3 Weighted_point_3;
typedef typename Rt::FT FT; typedef typename Rt::FT FT;
@ -402,8 +414,9 @@ public:
*/ */
template<class K_> template<class K_>
struct Robust_weighted_circumcenter_filtered_traits_3 struct Robust_weighted_circumcenter_filtered_traits_3
: public CGAL::Regular_triangulation_euclidean_traits_3<K_> : public K_
{ {
typedef typename K_::Point_3 Bare_point;
typedef CGAL::Robust_filtered_construct_weighted_circumcenter_3<K_> typedef CGAL::Robust_filtered_construct_weighted_circumcenter_3<K_>
Construct_weighted_circumcenter_3; Construct_weighted_circumcenter_3;

View File

@ -482,6 +482,7 @@ class Sliver_perturber
typedef typename Base::Bad_vertices_vector Bad_vertices_vector; typedef typename Base::Bad_vertices_vector Bad_vertices_vector;
typedef typename Gt::FT FT; typedef typename Gt::FT FT;
typedef typename Gt::Construct_point_3 Construct_point_3;
// Helper // Helper
typedef class C3T3_helpers<C3T3,MeshDomain> C3T3_helpers; typedef class C3T3_helpers<C3T3,MeshDomain> C3T3_helpers;
@ -744,6 +745,7 @@ private:
SliverCriterion sliver_criterion_; SliverCriterion sliver_criterion_;
Perturbation_vector perturbation_vector_; Perturbation_vector perturbation_vector_;
C3T3_helpers helper_; C3T3_helpers helper_;
Construct_point_3 wp2p;
// Internal perturbation ordering // Internal perturbation ordering
int next_perturbation_order_; int next_perturbation_order_;
@ -771,6 +773,7 @@ Sliver_perturber(C3T3& c3t3,
, domain_(domain) , domain_(domain)
, sliver_criterion_(criterion) , sliver_criterion_(criterion)
, helper_(c3t3_,domain_,get_lock_data_structure()) , helper_(c3t3_,domain_,get_lock_data_structure())
, wp2p(c3t3_.triangulation().geom_traits().construct_point_3_object())
, next_perturbation_order_(0) , next_perturbation_order_(0)
, time_limit_(-1) , time_limit_(-1)
, running_time_() , running_time_()
@ -1308,8 +1311,8 @@ perturb_vertex( PVertex pv
return; return;
} }
Point_3 p = pv.vertex()->point(); Point_3 p = wp2p(pv.vertex()->point());
if (!helper_.try_lock_point_no_spin(p) || ! Gt().equal_3_object()(p,pv.vertex()->point())) if (!helper_.try_lock_point_no_spin(p) || ! Gt().equal_3_object()(p,wp2p(pv.vertex()->point())))
{ {
#ifdef CGAL_CONCURRENT_MESH_3_PROFILING #ifdef CGAL_CONCURRENT_MESH_3_PROFILING
bcounter.increment_branch_2(); // THIS is an early withdrawal! bcounter.increment_branch_2(); // THIS is an early withdrawal!

View File

@ -1124,7 +1124,7 @@ pump_vertex(const Vertex_handle& pumped_vertex,
// If best_weight < pumped_vertex weight, nothing to do // If best_weight < pumped_vertex weight, nothing to do
if ( best_weight > pumped_vertex->point().weight() ) if ( best_weight > pumped_vertex->point().weight() )
{ {
Weighted_point wp(pumped_vertex->point(), best_weight); Weighted_point wp(pumped_vertex->point().point(), best_weight);
// Insert weighted point into mesh // Insert weighted point into mesh
// note it can fail if the mesh is non-manifold at pumped_vertex // note it can fail if the mesh is non-manifold at pumped_vertex
@ -1272,10 +1272,11 @@ expand_prestar(const Cell_handle& cell_to_add,
// Update ratio (ratio is needed for cells of complex only) // Update ratio (ratio is needed for cells of complex only)
if ( c3t3_.is_in_complex(cell_to_add) ) if ( c3t3_.is_in_complex(cell_to_add) )
{ {
Tetrahedron_3 tet(pumped_vertex->point(), typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
cell_to_add->vertex((i+1)&3)->point(), Tetrahedron_3 tet(wp2p(pumped_vertex->point()),
cell_to_add->vertex((i+2)&3)->point(), wp2p(cell_to_add->vertex((i+1)&3)->point()),
cell_to_add->vertex((i+3)&3)->point()); wp2p(cell_to_add->vertex((i+2)&3)->point()),
wp2p(cell_to_add->vertex((i+3)&3)->point()));
double new_value = sliver_criteria_(tet); double new_value = sliver_criteria_(tet);
criterion_values.insert(std::make_pair(current_facet,new_value)); criterion_values.insert(std::make_pair(current_facet,new_value));
@ -1787,6 +1788,8 @@ check_ratios(const Sliver_values& criterion_values,
Facet_vector internal_facets; Facet_vector internal_facets;
Facet_vector boundary_facets; Facet_vector boundary_facets;
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
tr_.find_conflicts(wp, tr_.find_conflicts(wp,
vh->cell(), vh->cell(),
std::back_inserter(boundary_facets), std::back_inserter(boundary_facets),
@ -1812,10 +1815,10 @@ check_ratios(const Sliver_values& criterion_values,
continue; continue;
int k = it->second; int k = it->second;
Tetrahedron_3 tet(vh->point(), Tetrahedron_3 tet(wp2p(vh->point()),
it->first->vertex((k+1)&3)->point(), wp2p(it->first->vertex((k+1)&3)->point()),
it->first->vertex((k+2)&3)->point(), wp2p(it->first->vertex((k+2)&3)->point()),
it->first->vertex((k+3)&3)->point()); wp2p(it->first->vertex((k+3)&3)->point()));
double ratio = sliver_criteria_(tet); double ratio = sliver_criteria_(tet);
expected_ratios.push_back(ratio); expected_ratios.push_back(ratio);

View File

@ -71,7 +71,7 @@ class Triangulation_helpers
const Point_3& operator()(const Vertex_handle &vh) const const Point_3& operator()(const Vertex_handle &vh) const
{ {
return (vh == m_vh ? m_p : vh->point()); return (vh == m_vh ? m_p : vh->point().point()); // AF: Can this be NOT a weighted point?
} }
private: private:
@ -156,8 +156,9 @@ no_topological_change(const Tr& tr,
const Point_3& p, const Point_3& p,
Cell_vector& cells_tos) const Cell_vector& cells_tos) const
{ {
Tr::Geom_traits::Construct_point_3 wp2p = tr.geom_traits().construct_point_3_object();
bool np = true; bool np = true;
Point_3 fp = v0->point(); Point_3 fp = wp2p(v0->point());
v0->set_point(p); v0->set_point(p);
if(!well_oriented(tr, cells_tos)) if(!well_oriented(tr, cells_tos))
@ -358,6 +359,7 @@ well_oriented(const Tr& tr,
{ {
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typename Gt::Orientation_3 orientation = tr.geom_traits().orientation_3_object(); typename Gt::Orientation_3 orientation = tr.geom_traits().orientation_3_object();
typename Cell_vector::const_iterator it = cells_tos.begin(); typename Cell_vector::const_iterator it = cells_tos.begin();
for( ; it != cells_tos.end() ; ++it) for( ; it != cells_tos.end() ; ++it)
{ {

View File

@ -125,7 +125,6 @@ protected:
const Point_3& p3 = f.first->vertex((f.second+3)&3)->point(); const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
const FT triangle_area = area(triangle(p1,p2,p3)); const FT triangle_area = area(triangle(p1,p2,p3));
const FT d12 = distance(p1,p2); const FT d12 = distance(p1,p2);
const FT d13 = distance(p1,p3); const FT d13 = distance(p1,p3);
const FT d23 = distance(p2,p3); const FT d23 = distance(p2,p3);
@ -285,7 +284,7 @@ protected:
const Index& index = f.first->get_facet_surface_center_index(f.second); const Index& index = f.first->get_facet_surface_center_index(f.second);
const FT sq_bound = CGAL::square(size_(ball_center, 2, index)); const FT sq_bound = CGAL::square(size_(ball_center.point(), 2, index));
CGAL_assertion(sq_bound > FT(0)); CGAL_assertion(sq_bound > FT(0));
if ( sq_dist > sq_bound ) if ( sq_dist > sq_bound )
@ -361,7 +360,7 @@ protected:
const Index& index = f.first->get_facet_surface_center_index(f.second); const Index& index = f.first->get_facet_surface_center_index(f.second);
const FT sq_radius = distance(p1,ball_center); const FT sq_radius = distance(p1,ball_center);
const FT sq_bound = CGAL::square(size_(ball_center, 2, index)); const FT sq_bound = CGAL::square(size_(ball_center.point(), 2, index));
CGAL_assertion(sq_bound > FT(0)); CGAL_assertion(sq_bound > FT(0));
if ( sq_radius > sq_bound ) if ( sq_radius > sq_bound )

View File

@ -96,6 +96,9 @@ minimum_dihedral_angle(
{ {
typedef typename K::FT FT; typedef typename K::FT FT;
typename K::Construct_point_3 wp2p =
k.construct_point_3_object();
typename K::Compute_determinant_3 determinant = typename K::Compute_determinant_3 determinant =
k.compute_determinant_3_object(); k.compute_determinant_3_object();
typename K::Construct_cross_product_vector_3 cp = typename K::Construct_cross_product_vector_3 cp =

View File

@ -123,13 +123,13 @@ namespace Mesh_3 {
edge_sq_length(const typename Tr::Edge& e) edge_sq_length(const typename Tr::Edge& e)
{ {
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Gt::Point_3 Point_3; typedef typename Gt::Weighted_point_3 Weighted_point_3;
typename Gt::Compute_squared_distance_3 sq_distance typename Gt::Compute_squared_distance_3 sq_distance
= Gt().compute_squared_distance_3_object(); = Gt().compute_squared_distance_3_object();
const Point_3& p = e.first->vertex(e.second)->point(); const Weighted_point_3& p = e.first->vertex(e.second)->point();
const Point_3& q = e.first->vertex(e.third)->point(); const Weighted_point_3& q = e.first->vertex(e.third)->point();
return sq_distance(p,q); return sq_distance(p,q);
} }
@ -453,6 +453,9 @@ protected:
typename Gt::Construct_translated_point_3 translate = typename Gt::Construct_translated_point_3 translate =
Gt().construct_translated_point_3_object(); Gt().construct_translated_point_3_object();
typename Gt::Construct_point_3 wp2p =
Gt().construct_point_3_object();
// create a helper // create a helper
typedef C3T3_helpers<C3T3,MeshDomain> C3T3_helpers; typedef C3T3_helpers<C3T3,MeshDomain> C3T3_helpers;
C3T3_helpers helper(c3t3, domain); C3T3_helpers helper(c3t3, domain);
@ -462,7 +465,7 @@ protected:
// norm depends on the local size of the mesh // norm depends on the local size of the mesh
FT sq_norm = this->compute_perturbation_sq_amplitude(v, c3t3, sq_step_size_); FT sq_norm = this->compute_perturbation_sq_amplitude(v, c3t3, sq_step_size_);
FT step_length = CGAL::sqrt(sq_norm/sq_length(gradient_vector)); FT step_length = CGAL::sqrt(sq_norm/sq_length(gradient_vector));
Point_3 new_loc = translate(v->point(), step_length * gradient_vector); Point_3 new_loc = translate(wp2p(v->point()), step_length * gradient_vector);
Point_3 final_loc = new_loc; Point_3 final_loc = new_loc;
if ( c3t3.in_dimension(v) < 3 ) if ( c3t3.in_dimension(v) < 3 )
@ -633,13 +636,15 @@ private:
typedef typename C3T3::Triangulation::Geom_traits Gt; typedef typename C3T3::Triangulation::Geom_traits Gt;
typename Gt::Construct_translated_point_3 translate = typename Gt::Construct_translated_point_3 translate =
Gt().construct_translated_point_3_object(); Gt().construct_translated_point_3_object();
typename Gt::Construct_point_3 wp2p =
Gt().construct_point_3_object();
// translate the tet so that cell->vertex((i+3)&3) is 0_{R^3} // translate the tet so that cell->vertex((i+3)&3) is 0_{R^3}
unsigned int index = cell->index(v); unsigned int index = cell->index(v);
Vector_3 translate_to_origin(CGAL::ORIGIN, cell->vertex((index+3)&3)->point()); //p4 Vector_3 translate_to_origin(CGAL::ORIGIN, wp2p(cell->vertex((index+3)&3)->point())); //p4
const Point_3& p1 = translate(v->point(), - translate_to_origin); const Point_3& p1 = translate(wp2p(v->point()), - translate_to_origin);
const Point_3& p2 = translate(cell->vertex((index+1)&3)->point(), - translate_to_origin); const Point_3& p2 = translate(wp2p(cell->vertex((index+1)&3)->point()), - translate_to_origin);
const Point_3& p3 = translate(cell->vertex((index+2)&3)->point(), - translate_to_origin); const Point_3& p3 = translate(wp2p(cell->vertex((index+2)&3)->point()), - translate_to_origin);
// pre-compute everything // pre-compute everything
FT sq_p1 = p1.x()*p1.x() + p1.y()*p1.y() + p1.z()*p1.z(); FT sq_p1 = p1.x()*p1.x() + p1.y()*p1.y() + p1.z()*p1.z();
@ -794,7 +799,7 @@ private:
const Vertex_handle& v) const const Vertex_handle& v) const
{ {
CGAL_assertion(cell->has_vertex(v)); CGAL_assertion(cell->has_vertex(v));
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
const int i = cell->index(v); const int i = cell->index(v);
// fixed vertices: (the ones with index != i) // fixed vertices: (the ones with index != i)
@ -805,9 +810,9 @@ private:
if ( (i&1) == 0 ) if ( (i&1) == 0 )
std::swap(k1,k3); std::swap(k1,k3);
const Point_3& p1 = cell->vertex(k1)->point(); const Point_3& p1 = wp2p(cell->vertex(k1)->point());
const Point_3& p2 = cell->vertex(k2)->point(); const Point_3& p2 = wp2p(cell->vertex(k2)->point());
const Point_3& p3 = cell->vertex(k3)->point(); const Point_3& p3 = wp2p(cell->vertex(k3)->point());
FT gx = p2.y()*p3.z() + p1.y()*(p2.z()-p3.z()) FT gx = p2.y()*p3.z() + p1.y()*(p2.z()-p3.z())
- p3.y()*p2.z() - p1.z()*(p2.y()-p3.y()); - p3.y()*p2.z() - p1.z()*(p2.y()-p3.y());
@ -937,8 +942,10 @@ private:
{ {
CGAL_assertion(cell->has_vertex(v)); CGAL_assertion(cell->has_vertex(v));
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
const int i = cell->index(v); const int i = cell->index(v);
const Point_3& p0 = v->point(); const Point_3& p0 = wp2p(v->point());
// Other indices // Other indices
int k1 = (i+1)&3; int k1 = (i+1)&3;
@ -957,9 +964,9 @@ private:
std::swap(k2,k3); std::swap(k2,k3);
// Here edge k1k2 minimizes dihedral angle // Here edge k1k2 minimizes dihedral angle
const Point_3& p1 = cell->vertex(k1)->point(); const Point_3& p1 = wp2p(cell->vertex(k1)->point());
const Point_3& p2 = cell->vertex(k2)->point(); const Point_3& p2 = wp2p(cell->vertex(k2)->point());
const Point_3& p3 = cell->vertex(k3)->point(); const Point_3& p3 = wp2p(cell->vertex(k3)->point());
// grad of min dihedral angle (in cell) wrt p0 // grad of min dihedral angle (in cell) wrt p0
const Vector_3 p1p0 (p1,p0); const Vector_3 p1p0 (p1,p0);
@ -992,10 +999,12 @@ private:
{ {
typename Gt::Compute_approximate_dihedral_angle_3 approx_dihedral_angle typename Gt::Compute_approximate_dihedral_angle_3 approx_dihedral_angle
= Gt().compute_approximate_dihedral_angle_3_object(); = Gt().compute_approximate_dihedral_angle_3_object();
return CGAL::abs(approx_dihedral_angle(p, typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
cell->vertex(k1)->point(),
cell->vertex(k2)->point(), return CGAL::abs(approx_dihedral_angle(wp2p(p),
cell->vertex(k3)->point())); wp2p(cell->vertex(k1)->point()),
wp2p(cell->vertex(k2)->point()),
wp2p(cell->vertex(k3)->point())));
} }
/** /**
@ -1012,6 +1021,7 @@ private:
*/ */
Vector_3 normal_estimate(const Cell_handle& ch, const int i) const Vector_3 normal_estimate(const Cell_handle& ch, const int i) const
{ {
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
int k1 = (i+1)&3; int k1 = (i+1)&3;
int k2 = (i+2)&3; int k2 = (i+2)&3;
int k3 = (i+3)&3; int k3 = (i+3)&3;
@ -1020,9 +1030,9 @@ private:
if ( (i&1) == 1 ) if ( (i&1) == 1 )
std::swap(k1,k2); std::swap(k1,k2);
const Point_3& p1 = ch->vertex(k1)->point(); const Point_3& p1 = wp2p(ch->vertex(k1)->point());
const Point_3& p2 = ch->vertex(k2)->point(); const Point_3& p2 = wp2p(ch->vertex(k2)->point());
const Point_3& p3 = ch->vertex(k3)->point(); const Point_3& p3 = wp2p(ch->vertex(k3)->point());
// compute normal and return it // compute normal and return it
Construct_point_3 cp; Construct_point_3 cp;
@ -1252,7 +1262,7 @@ private:
// norm depends on the local size of the mesh // norm depends on the local size of the mesh
FT sq_norm = this->compute_perturbation_sq_amplitude(v, c3t3, this->sphere_sq_radius()); FT sq_norm = this->compute_perturbation_sq_amplitude(v, c3t3, this->sphere_sq_radius());
const Point_3 initial_location = v->point(); const Point_3 initial_location = v->point().point();
// Initialize loop variables // Initialize loop variables
bool criterion_improved = false; bool criterion_improved = false;
@ -1295,7 +1305,7 @@ private:
if ( update.first ) if ( update.first )
{ {
criterion_improved = true; criterion_improved = true;
best_location = moving_vertex->point(); best_location = moving_vertex->point().point();
mod_vertices.insert(tmp_mod_vertices.begin(), tmp_mod_vertices.end()); mod_vertices.insert(tmp_mod_vertices.begin(), tmp_mod_vertices.end());

View File

@ -32,7 +32,7 @@
#include <CGAL/license/Mesh_3.h> #include <CGAL/license/Mesh_3.h>
#include <CGAL/Triangulation_vertex_base_3.h> #include <CGAL/Regular_triangulation_vertex_base_3.h>
#include <CGAL/internal/Mesh_3/get_index.h> #include <CGAL/internal/Mesh_3/get_index.h>
#include <CGAL/Mesh_3/io_signature.h> #include <CGAL/Mesh_3/io_signature.h>
#include <CGAL/Has_timestamp.h> #include <CGAL/Has_timestamp.h>
@ -102,7 +102,7 @@ protected:
// to the 3D input complex. // to the 3D input complex.
template<class GT, template<class GT,
class MD, class MD,
class Vb = Triangulation_vertex_base_3<GT> > class Vb = Regular_triangulation_vertex_base_3<GT> >
class Mesh_vertex_base_3 class Mesh_vertex_base_3
: public Vb, : public Vb,
public Mesh_vertex_base_3_base< public Mesh_vertex_base_3_base<

View File

@ -48,7 +48,7 @@ int main()
ch->set_subdomain_index(sub_index); ch->set_subdomain_index(sub_index);
// Init facet // Init facet
Tr::Point facet_circum = Tr::Bare_point facet_circum =
tr.geom_traits().construct_weighted_circumcenter_3_object()( tr.geom_traits().construct_weighted_circumcenter_3_object()(
ch->vertex(k+1)->point(), ch->vertex(k+2)->point(), ch->vertex(k+3)->point()); ch->vertex(k+1)->point(), ch->vertex(k+2)->point(), ch->vertex(k+3)->point());
@ -71,35 +71,35 @@ int main()
// Test edge criteria // Test edge criteria
// ----------------------------------- // -----------------------------------
Mc ec1(edge_size = 1); Mc ec1(edge_size = 1);
assert( ec1.edge_criteria_object().sizing_field(p1,1,index) == 1 ); assert( ec1.edge_criteria_object().sizing_field(p1.point(),1,index) == 1 );
Mc ec2(edge_sizing_field = Esf(2)); Mc ec2(edge_sizing_field = Esf(2));
assert( ec2.edge_criteria_object().sizing_field(p1,1,index) == 2 ); assert( ec2.edge_criteria_object().sizing_field(p1.point(),1,index) == 2 );
Mc ec3(edge_sizing_field = 3.); Mc ec3(edge_sizing_field = 3.);
assert( ec3.edge_criteria_object().sizing_field(p1,1,index) == 3 ); assert( ec3.edge_criteria_object().sizing_field(p1.point(),1,index) == 3 );
Mc ec4(edge_size = 4.1, Mc ec4(edge_size = 4.1,
edge_sizing_field = Esf(4.2)); edge_sizing_field = Esf(4.2));
assert( ec4.edge_criteria_object().sizing_field(p1,1,index) == 4.1 ); assert( ec4.edge_criteria_object().sizing_field(p1.point(),1,index) == 4.1 );
Mc ec5(sizing_field = 5.); Mc ec5(sizing_field = 5.);
assert( ec5.edge_criteria_object().sizing_field(p1,1,index) == 5 ); assert( ec5.edge_criteria_object().sizing_field(p1.point(),1,index) == 5 );
Mc ec6(sizing_field = 6.1, Mc ec6(sizing_field = 6.1,
edge_sizing_field = 6.2); edge_sizing_field = 6.2);
assert( ec6.edge_criteria_object().sizing_field(p1,1,index) == 6.2 ); assert( ec6.edge_criteria_object().sizing_field(p1.point(),1,index) == 6.2 );
Mc ec7(sizing_field = 7.1, Mc ec7(sizing_field = 7.1,
edge_size = 7.2); edge_size = 7.2);
assert( ec7.edge_criteria_object().sizing_field(p1,1,index) == 7.2 ); assert( ec7.edge_criteria_object().sizing_field(p1.point(),1,index) == 7.2 );
// ----------------------------------- // -----------------------------------
// Test facet criteria // Test facet criteria
// ----------------------------------- // -----------------------------------
typedef Tr::Geom_traits::FT FT; typedef Tr::Geom_traits::FT FT;
Tr::Geom_traits::Compute_squared_radius_3 squared_radius; Tr::Geom_traits::Compute_squared_radius_3 squared_radius = tr.geom_traits().compute_squared_radius_3_object();
FT radius_facet = CGAL::sqrt(squared_radius(ch->vertex(k+1)->point(), FT radius_facet = CGAL::sqrt(squared_radius(ch->vertex(k+1)->point(),
ch->vertex(k+2)->point(), ch->vertex(k+2)->point(),
ch->vertex(k+3)->point())); ch->vertex(k+3)->point()));

View File

@ -27,6 +27,10 @@
#include <CGAL/license/Triangulation_3.h> #include <CGAL/license/Triangulation_3.h>
#include <CGAL/internal/Triangulation/Has_nested_type_Bare_point.h>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
namespace CGAL { namespace CGAL {
template < class RTT, class ConstructPoint, class Functor_> template < class RTT, class ConstructPoint, class Functor_>
@ -39,47 +43,128 @@ class Regular_traits_adaptor
typedef Functor_ Functor; typedef Functor_ Functor;
typedef typename RTraits::FT FT; typedef typename RTraits::FT FT;
typedef typename RTraits::Point_3 Point_3; #if 0
typedef typename boost::mpl::eval_if_c<
internal::Has_nested_type_Bare_point<RTraits>::value,
typename internal::Bare_point_type<RTraits>,
boost::mpl::identity<typename RTraits::Point_3>
>::type Point_3;
#else
typedef typename RTT::Point_3 Point_3;
#endif
typedef typename RTraits::Tetrahedron_3 Tetrahedron_3;
typedef typename RTraits::Plane_3 Plane_3;
typedef typename RTraits::Sphere_3 Sphere_3;
typedef typename RTraits::Weighted_point_3 Weighted_point_3; typedef typename RTraits::Weighted_point_3 Weighted_point_3;
public: template <typename T>
typedef typename Functor::result_type result_type; struct Conv_wp_to_p {
typedef T type;
};
template <>
struct Conv_wp_to_p<Weighted_point_3> {
typedef Point_3 type;
};
template <>
struct Conv_wp_to_p<const Weighted_point_3> {
typedef const Point_3 type;
};
template <>
struct Conv_wp_to_p<const Weighted_point_3&> {
typedef const Point_3& type;
};
template <typename> struct result {};
template <typename F, typename A0> struct result<F(A0)> {
typedef typename Conv_wp_to_p<A0>::type A0p;
typedef typename cpp11::result_of<F(A0p)>::type type;
};
template <typename F, typename A0, typename A1> struct result<F(A0,A1)> {
typedef typename Conv_wp_to_p<A0>::type A0p;
typedef typename Conv_wp_to_p<A1>::type A1p;
typedef typename cpp11::result_of<F(A0p, A1p)>::type type;
};
template <typename F, typename A0, typename A1, typename A2> struct result<F(A0,A1,A2)> {
typedef typename Conv_wp_to_p<A0>::type A0p;
typedef typename Conv_wp_to_p<A1>::type A1p;
typedef typename Conv_wp_to_p<A2>::type A2p;
typedef typename cpp11::result_of<F(A0p, A1p, A2p)>::type type;
};
template <typename F, typename A0, typename A1, typename A2, typename A3>
struct result<F(A0,A1,A2,A3)> {
typedef typename Conv_wp_to_p<A0>::type A0p;
typedef typename Conv_wp_to_p<A1>::type A1p;
typedef typename Conv_wp_to_p<A2>::type A2p;
typedef typename Conv_wp_to_p<A3>::type A3p;
typedef typename cpp11::result_of<F(A0p, A1p, A2p, A3p)>::type type;
};
public: public:
Regular_traits_adaptor (const ConstructPoint& cp, const Functor& f) Regular_traits_adaptor (const ConstructPoint& cp, const Functor& f)
: cp(cp), f(f) : cp(cp), f(f)
{ } { }
public:
typename cpp11::result_of<Functor(Tetrahedron_3)>::type operator() (const Tetrahedron_3& t) const
{
return f(t);
}
public: typename cpp11::result_of< Functor(Point_3,Point_3) >::type operator() (const Point_3& p0, const Point_3& p1) const
// with offset --------------------------------------------------------------- {
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1) const return f(p0, p1);
}
typename cpp11::result_of< Functor(Point_3,Point_3) >::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1) const
{ {
return f(cp(p0), cp(p1)); return f(cp(p0), cp(p1));
} }
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, typename cpp11::result_of<Functor(Plane_3,Point_3)>::type operator() (const Plane_3& p0, const Weighted_point_3& p1) const
{
return f(p0, cp(p1));
}
typename cpp11::result_of<Functor(Point_3,Point_3,Point_3)>::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2) const const Weighted_point_3& p2) const
{ {
return f(cp(p0), cp(p1), cp(p2)); return f(cp(p0), cp(p1), cp(p2));
} }
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, typename cpp11::result_of<Functor(Point_3,Point_3,Point_3,Point_3)>::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Weighted_point_3& p3) const const Weighted_point_3& p2, const Weighted_point_3& p3) const
{ {
return f(cp(p0), cp(p1), cp(p2), cp(p3)); return f(cp(p0), cp(p1), cp(p2), cp(p3));
} }
result_type operator() (const Point_3& p0, const Weighted_point_3& p1, typename cpp11::result_of<Functor(Point_3,Point_3,Point_3)>::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Point_3& p2) const
{
return f(cp(p0), cp(p1), p2);
}
typename cpp11::result_of<Functor(Point_3,Point_3,Point_3,Point_3)>::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Point_3& p3) const
{
return f(cp(p0), cp(p1), cp(p2), p3);
}
typename cpp11::result_of<Functor(Point_3,Point_3,Point_3)>::type operator() (const Point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2) const const Weighted_point_3& p2) const
{ {
return f(p0, cp(p1), cp(p2)); return f(p0, cp(p1), cp(p2));
} }
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, typename cpp11::result_of<Functor(Point_3,Point_3,Point_3,FT)>::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Weighted_point_3& p3, const Weighted_point_3& p2, const Weighted_point_3& p3,
const FT w) const const FT w) const
{ {

View File

@ -30,31 +30,96 @@
#include <CGAL/Regular_traits_adaptor.h> #include <CGAL/Regular_traits_adaptor.h>
#include <set> #include <set>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
namespace CGAL { namespace CGAL {
template < typename K_ > template < typename K_ >
struct Weighted_point_mapper_3 struct Weighted_point_mapper_3
: public K_ : public K_
{ {
Weighted_point_mapper_3()
: K_()
{}
Weighted_point_mapper_3(const K_ k)
: K_(k)
{}
typedef typename K_::Weighted_point_3 Point_3; typedef typename K_::Weighted_point_3 Point_3;
};
namespace internal {
template < typename K_ >
struct RegTraits
: public K_
{
#if 0
typedef typename boost::mpl::eval_if_c<
internal::Has_nested_type_Bare_point<K_>::value,
typename internal::Bare_point_type<K_>,
boost::mpl::identity<typename K_::Point_3>
>::type Point_3;
#endif
typedef typename K_::Construct_point_3 Construct_point_3_base; typedef typename K_::Construct_point_3 Construct_point_3_base;
typedef typename K_::Construct_projected_point_3 Construct_projected_point_3_base;
typedef typename K_::Construct_vector_3 Construct_vector_3_base;
typedef typename K_::Compare_xyz_3 Compare_xyz_3_base; typedef typename K_::Compare_xyz_3 Compare_xyz_3_base;
typedef typename K_::Compute_squared_radius_3 Compute_squared_radius_3_base;
typedef typename K_::Compute_squared_distance_3 Compute_squared_distance_3_base;
typedef typename K_::Compute_area_3 Compute_area_3_base;
typedef typename K_::Compute_volume_3 Compute_volume_3_base;
typedef typename K_::Collinear_3 Collinear_3_base;
typedef typename K_::Less_x_3 Less_x_3_base; typedef typename K_::Less_x_3 Less_x_3_base;
typedef typename K_::Less_y_3 Less_y_3_base; typedef typename K_::Less_y_3 Less_y_3_base;
typedef typename K_::Less_z_3 Less_z_3_base; typedef typename K_::Less_z_3 Less_z_3_base;
typedef typename K_::Orientation_3 Orientation_3_base; typedef typename K_::Orientation_3 Orientation_3_base;
typedef typename K_::Construct_centroid_3 Construct_centroid_3_base;
typedef typename K_::Construct_segment_3 Construct_segment_3_base; typedef typename K_::Construct_segment_3 Construct_segment_3_base;
typedef typename K_::Construct_triangle_3 Construct_triangle_3_base;
typedef typename K_::Construct_tetrahedron_3 Construct_tetrahedron_3_base;
typedef typename K_::Construct_plane_3 Construct_plane_3_base; typedef typename K_::Construct_plane_3 Construct_plane_3_base;
typedef typename K_::Coplanar_orientation_3 Coplanar_orientation_3_base; typedef typename K_::Coplanar_orientation_3 Coplanar_orientation_3_base;
// typedef typename K_::_3 _base; typedef typename K_::Side_of_bounded_sphere_3 Side_of_bounded_sphere_3_base;
typedef typename K_::Equal_3 Equal_3_base;
Construct_point_3_base cp; Construct_point_3_base cp;
Weighted_point_mapper_3() {} RegTraits() {}
Weighted_point_mapper_3(const K_& k) RegTraits(const K_& k)
: K_(k), cp(k.construct_point_3_object()) : K_(k), cp(k.construct_point_3_object())
{} {}
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Equal_3_base > Equal_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Construct_projected_point_3_base > Construct_projected_point_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Compute_area_3_base > Compute_area_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Compute_volume_3_base > Compute_volume_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Compute_squared_radius_3_base > Compute_squared_radius_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Compute_squared_distance_3_base > Compute_squared_distance_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Collinear_3_base > Collinear_3;
typedef Regular_traits_adaptor<K_, typedef Regular_traits_adaptor<K_,
Construct_point_3_base, Construct_point_3_base,
@ -84,10 +149,62 @@ struct Weighted_point_mapper_3
Construct_point_3_base, Construct_point_3_base,
Coplanar_orientation_3_base > Coplanar_orientation_3; Coplanar_orientation_3_base > Coplanar_orientation_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Construct_vector_3_base > Construct_vector_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Construct_centroid_3_base > Construct_centroid_3;
typedef Regular_traits_adaptor<K_, typedef Regular_traits_adaptor<K_,
Construct_point_3_base, Construct_point_3_base,
Construct_segment_3_base > Construct_segment_3; Construct_segment_3_base > Construct_segment_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Construct_triangle_3_base > Construct_triangle_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Construct_tetrahedron_3_base > Construct_tetrahedron_3;
typedef Regular_traits_adaptor<K_,
Construct_point_3_base,
Side_of_bounded_sphere_3_base > Side_of_bounded_sphere_3;
Equal_3 equal_3_object() const
{
return Equal_3(cp, static_cast<const K_&>(*this).equal_3_object());
}
Compute_area_3 compute_area_3_object() const
{
return Compute_area_3(cp, static_cast<const K_&>(*this).compute_area_3_object());
}
Compute_volume_3 compute_volume_3_object() const
{
return Compute_volume_3(cp, static_cast<const K_&>(*this).compute_volume_3_object());
}
Compute_squared_radius_3 compute_squared_radius_3_object() const
{
return Compute_squared_radius_3(cp, static_cast<const K_&>(*this).compute_squared_radius_3_object());
}
Compute_squared_distance_3 compute_squared_distance_3_object() const
{
return Compute_squared_distance_3(cp, static_cast<const K_&>(*this).compute_squared_distance_3_object());
}
Collinear_3 collinear_3_object() const
{
return Collinear_3(cp, static_cast<const K_&>(*this).collinear_3_object());
}
Less_x_3 less_x_3_object() const Less_x_3 less_x_3_object() const
{ {
return Less_x_3(cp, static_cast<const K_&>(*this).less_x_3_object()); return Less_x_3(cp, static_cast<const K_&>(*this).less_x_3_object());
@ -108,18 +225,41 @@ struct Weighted_point_mapper_3
return Compare_xyz_3(cp, static_cast<const K_&>(*this).compare_xyz_3_object()); return Compare_xyz_3(cp, static_cast<const K_&>(*this).compare_xyz_3_object());
} }
Orientation_3 orientation_3_object() const Orientation_3 orientation_3_object() const
{ {
return Orientation_3(cp, static_cast<const K_&>(*this).orientation_3_object()); return Orientation_3(cp, static_cast<const K_&>(*this).orientation_3_object());
} }
Construct_vector_3 construct_vector_3_object() const
{
return Construct_vector_3(cp, static_cast<const K_&>(*this).construct_vector_3_object());
}
Construct_projected_point_3 construct_projected_point_3_object() const
{
return Construct_projected_point_3(cp, static_cast<const K_&>(*this).construct_projected_point_3_object());
}
Construct_centroid_3 construct_centroid_3_object() const
{
return Construct_centroid_3(cp, static_cast<const K_&>(*this).construct_centroid_3_object());
}
Construct_segment_3 construct_segment_3_object() const Construct_segment_3 construct_segment_3_object() const
{ {
return Construct_segment_3(cp, static_cast<const K_&>(*this).construct_segment_3_object()); return Construct_segment_3(cp, static_cast<const K_&>(*this).construct_segment_3_object());
} }
Construct_triangle_3 construct_triangle_3_object() const
{
return Construct_triangle_3(cp, static_cast<const K_&>(*this).construct_triangle_3_object());
}
Construct_tetrahedron_3 construct_tetrahedron_3_object() const
{
return Construct_tetrahedron_3(cp, static_cast<const K_&>(*this).construct_tetrahedron_3_object());
}
Construct_plane_3 construct_plane_3_object() const Construct_plane_3 construct_plane_3_object() const
{ {
return Construct_plane_3(cp, static_cast<const K_&>(*this).construct_plane_3_object()); return Construct_plane_3(cp, static_cast<const K_&>(*this).construct_plane_3_object());
@ -129,8 +269,15 @@ struct Weighted_point_mapper_3
{ {
return Coplanar_orientation_3(cp, static_cast<const K_&>(*this).coplanar_orientation_3_object()); return Coplanar_orientation_3(cp, static_cast<const K_&>(*this).coplanar_orientation_3_object());
} }
Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object() const
{
return Side_of_bounded_sphere_3(cp, static_cast<const K_&>(*this).side_of_bounded_sphere_3_object());
}
}; };
} // namespace internal
} // nmamespace CGAL } // nmamespace CGAL
#ifdef CGAL_LINKED_WITH_TBB #ifdef CGAL_LINKED_WITH_TBB
@ -147,8 +294,6 @@ struct Weighted_point_mapper_3
#include <CGAL/internal/Has_nested_type_Bare_point.h> #include <CGAL/internal/Has_nested_type_Bare_point.h>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO #ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
#include <CGAL/Spatial_sort_traits_adapter_3.h> #include <CGAL/Spatial_sort_traits_adapter_3.h>
@ -181,25 +326,33 @@ namespace CGAL {
template < class Gt, class Tds_ = Default, class Lock_data_structure_ = Default > template < class Gt, class Tds_ = Default, class Lock_data_structure_ = Default >
class Regular_triangulation_3 class Regular_triangulation_3
: public Triangulation_3< : public Triangulation_3<
Weighted_point_mapper_3<Gt>, Weighted_point_mapper_3<internal::RegTraits<Gt> >,
typename Default::Get<Tds_, Triangulation_data_structure_3 < typename Default::Get<Tds_, Triangulation_data_structure_3 <
Regular_triangulation_vertex_base_3<Gt>, Regular_triangulation_vertex_base_3<Gt>,
Regular_triangulation_cell_base_3<Gt> > >::type, Regular_triangulation_cell_base_3<Gt> > >::type,
Lock_data_structure_> Lock_data_structure_>
{ {
public:
typedef internal::RegTraits<Gt> Geom_traits;
private:
typedef Regular_triangulation_3<Gt, Tds_, Lock_data_structure_> Self; typedef Regular_triangulation_3<Gt, Tds_, Lock_data_structure_> Self;
typedef Weighted_point_mapper_3<Gt> Tr_Base_Gt; typedef Weighted_point_mapper_3<Geom_traits> Tr_Base_Gt;
typedef typename Default::Get<Tds_, Triangulation_data_structure_3 < typedef typename Default::Get<Tds_, Triangulation_data_structure_3 <
Regular_triangulation_vertex_base_3<Gt>, Regular_triangulation_vertex_base_3<Gt>,
Regular_triangulation_cell_base_3<Gt> > >::type Tds; Regular_triangulation_cell_base_3<Gt> > >::type Tds;
Geom_traits regular_geom_traits;
public: public:
typedef Triangulation_3<Tr_Base_Gt,Tds,Lock_data_structure_> Tr_Base; typedef Triangulation_3<Tr_Base_Gt,Tds,Lock_data_structure_> Tr_Base;
typedef Tds Triangulation_data_structure; typedef Tds Triangulation_data_structure;
typedef Gt Geom_traits;
typedef Geom_traits Traits; typedef Geom_traits Traits;
typedef typename Tr_Base::Concurrency_tag Concurrency_tag; typedef typename Tr_Base::Concurrency_tag Concurrency_tag;
typedef typename Tr_Base::Lock_data_structure Lock_data_structure; typedef typename Tr_Base::Lock_data_structure Lock_data_structure;
@ -280,15 +433,15 @@ namespace CGAL {
using Tr_Base::is_valid; using Tr_Base::is_valid;
Regular_triangulation_3(const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL) Regular_triangulation_3(const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL)
: Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this) : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this), regular_geom_traits(gt)
{} {}
Regular_triangulation_3(Lock_data_structure *lock_ds, const Gt & gt = Gt()) Regular_triangulation_3(Lock_data_structure *lock_ds, const Gt & gt = Gt())
: Tr_Base(lock_ds, Tr_Base_Gt(gt)), hidden_point_visitor(this) : Tr_Base(lock_ds, Tr_Base_Gt(gt)), hidden_point_visitor(this), regular_geom_traits(gt)
{} {}
Regular_triangulation_3(const Regular_triangulation_3 & rt) Regular_triangulation_3(const Regular_triangulation_3 & rt)
: Tr_Base(rt), hidden_point_visitor(this) : Tr_Base(rt), hidden_point_visitor(this), regular_geom_traits(rt.regular_geom_traits)
{ {
CGAL_triangulation_postcondition( is_valid() ); CGAL_triangulation_postcondition( is_valid() );
} }
@ -297,7 +450,7 @@ namespace CGAL {
template < typename InputIterator > template < typename InputIterator >
Regular_triangulation_3(InputIterator first, InputIterator last, Regular_triangulation_3(InputIterator first, InputIterator last,
const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL) const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL)
: Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this) : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this), regular_geom_traits(gt)
{ {
insert(first, last); insert(first, last);
} }
@ -305,11 +458,16 @@ namespace CGAL {
template < typename InputIterator > template < typename InputIterator >
Regular_triangulation_3(InputIterator first, InputIterator last, Regular_triangulation_3(InputIterator first, InputIterator last,
Lock_data_structure *lock_ds, const Gt & gt = Gt()) Lock_data_structure *lock_ds, const Gt & gt = Gt())
: Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this) : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this), regular_geom_traits(gt)
{ {
insert(first, last); insert(first, last);
} }
const Geom_traits& geom_traits() const
{
return regular_geom_traits;
}
private: private:
#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE #ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
@ -411,7 +569,7 @@ namespace CGAL {
size_type n = number_of_vertices(); size_type n = number_of_vertices();
std::vector<Weighted_point> points(first, last); std::vector<Weighted_point> points(first, last);
spatial_sort (points.begin(), points.end(), geom_traits()); spatial_sort (points.begin(), points.end(), Tr_Base::geom_traits());
// Parallel // Parallel
#ifdef CGAL_LINKED_WITH_TBB #ifdef CGAL_LINKED_WITH_TBB
@ -509,7 +667,7 @@ namespace CGAL {
spatial_sort( indices.begin(), spatial_sort( indices.begin(),
indices.end(), indices.end(),
Search_traits(make_property_map(points),geom_traits()) ); Search_traits(make_property_map(points),Tr_Base::geom_traits()) );
#ifdef CGAL_LINKED_WITH_TBB #ifdef CGAL_LINKED_WITH_TBB
if (this->is_parallel()) if (this->is_parallel())
{ {
@ -1269,7 +1427,7 @@ namespace CGAL {
return v; return v;
} }
void hide_point(Cell_handle c, const Weighted_point &p) { void hide_point(Cell_handle c, const Weighted_point &p) {
c->hide_point(p); // AF c->hide_point(p); // What do we want to hide, a point or a weighted point?
} }
}; };
@ -1649,7 +1807,7 @@ dual(Cell_handle c) const
CGAL_triangulation_precondition(dimension()==3); CGAL_triangulation_precondition(dimension()==3);
CGAL_triangulation_precondition( ! is_infinite(c) ); CGAL_triangulation_precondition( ! is_infinite(c) );
return c->weighted_circumcenter(geom_traits()); return geom_traits().construct_point_3_object()(c->weighted_circumcenter(geom_traits()));
} }
template < class Gt, class Tds, class Lds > template < class Gt, class Tds, class Lds >
@ -1722,7 +1880,7 @@ dual(Cell_handle c) const
// We sort the points lexicographically. // We sort the points lexicographically.
const Weighted_point * points[5] = {&p0, &p1, &p2, &p3, &p}; const Weighted_point * points[5] = {&p0, &p1, &p2, &p3, &p};
std::sort(points, points + 5, std::sort(points, points + 5,
boost::bind(geom_traits().compare_xyz_3_object(), boost::bind<Comparison_result>(geom_traits().compare_xyz_3_object(),
boost::bind(Dereference<Weighted_point>(), _1), boost::bind(Dereference<Weighted_point>(), _1),
boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER); boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);
@ -1832,7 +1990,7 @@ dual(Cell_handle c) const
// We sort the points lexicographically. // We sort the points lexicographically.
const Weighted_point * points[4] = {&p0, &p1, &p2, &p}; const Weighted_point * points[4] = {&p0, &p1, &p2, &p};
std::sort(points, points + 4, std::sort(points, points + 4,
boost::bind(geom_traits().compare_xyz_3_object(), boost::bind<Comparison_result>(geom_traits().compare_xyz_3_object(),
boost::bind(Dereference<Weighted_point>(), _1), boost::bind(Dereference<Weighted_point>(), _1),
boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER); boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);

View File

@ -6616,8 +6616,8 @@ operator==(const Triangulation_3<GT, Tds1, Lds> &t1,
using namespace boost; using namespace boost;
std::vector<Point> V1 (t1.points_begin(), t1.points_end()); std::vector<Point> V1 (t1.points_begin(), t1.points_end());
std::vector<Point> V2 (t2.points_begin(), t2.points_end()); std::vector<Point> V2 (t2.points_begin(), t2.points_end());
std::sort(V1.begin(), V1.end(), boost::bind(cmp1, _1, _2) == NEGATIVE); std::sort(V1.begin(), V1.end(), boost::bind<Comparison_result>(cmp1, _1, _2) == NEGATIVE);
std::sort(V2.begin(), V2.end(), boost::bind(cmp2, _1, _2) == NEGATIVE); std::sort(V2.begin(), V2.end(), boost::bind<Comparison_result>(cmp2, _1, _2) == NEGATIVE);
return V1 == V2; return V1 == V2;
} }