make constructors of Weighted_point explicit

and fix compilation errors
This commit is contained in:
Jane Tournois 2017-03-06 13:54:29 +01:00 committed by Mael Rouxel-Labbé
parent f0ec03218d
commit 223e3a20b6
8 changed files with 51 additions and 43 deletions

View File

@ -53,6 +53,7 @@ public:
Weighted_pointC3(const Origin &o)
: base(o,0) {}
explicit
Weighted_pointC3 (const Point_3 &p)
: base(p,0)
{}

View File

@ -53,6 +53,7 @@ public:
Weighted_pointH3(const Origin &o)
: base(o,0) {}
explicit
Weighted_pointH3 (const Point_3 &p)
: base(p,0)
{}

View File

@ -877,7 +877,7 @@ compute_move(const Vertex_handle& v)
if ( c3t3_.in_dimension(v) == 2 )
{
Bare_point new_position = translate(wp2p(v->point()),move);
move = vector(wp2p(v->point()), helper_.project_on_surface(wp2p(new_position),v));
move = vector(wp2p(v->point()), helper_.project_on_surface(new_position, v));
}
FT local_sq_size = min_circumradius_sq_length(v, incident_cells);

View File

@ -148,6 +148,8 @@ public:
typedef Tr Triangulation;
/** Type of point that are inserted into the triangulation. */
typedef typename Triangulation::Point Point;
/** Type of point with no weight */
typedef typename Triangulation::Geom_traits::Bare_point Bare_point;
/** Type of vertex handles that are returns by insertions into the
triangulation. */
typedef typename Triangulation::Vertex_handle Vertex_handle;
@ -308,7 +310,7 @@ public:
}
/** Gives the point that should be inserted to refine the element \c e */
Point refinement_point(const Element& e)
Bare_point refinement_point(const Element& e)
{
return derived().refinement_point_impl(e);
}
@ -562,7 +564,9 @@ public:
Mesher_level_conflict_status
try_to_refine_element(Element e, Mesh_visitor visitor)
{
const Point& p = this->refinement_point(e);
const Tr& tr = derived().triangulation_ref_impl();
const Point& p = tr.geom_traits().construct_weighted_point_3_object()(
this->refinement_point(e));
#ifdef CGAL_MESH_3_VERY_VERBOSE
std::cerr << "Trying to insert point: " << p <<
@ -946,7 +950,9 @@ public:
Mesher_level_conflict_status
try_to_refine_element(Element e, Mesh_visitor visitor)
{
const Point& p = this->refinement_point(e);
const Tr& tr = derived().triangulation_ref_impl();
const Point& p = tr.geom_traits().construct_weighted_point_3_object()(
this->refinement_point(e));
#ifdef CGAL_MESH_3_VERY_VERBOSE
std::cerr << "Trying to insert point: " << p <<

View File

@ -60,6 +60,8 @@ class Odt_move
typedef typename Gt::FT FT;
typedef typename Gt::Vector_3 Vector_3;
typedef typename Gt::Construct_point_3 Construct_point_3;
public:
typedef SizingField Sizing_field;
@ -82,7 +84,9 @@ public:
Vector_3 move = CGAL::NULL_VECTOR;
FT sum_volume(0);
const Weighted_point& p = v->point();
Construct_point_3 cp =
c3t3.triangulation().geom_traits().construct_point_3_object();
const Bare_point p = cp(v->point());
for ( typename Cell_vector::const_iterator cit = incident_cells.begin() ;
cit != incident_cells.end() ;
@ -95,7 +99,7 @@ public:
continue;
// Get points
Weighted_point circumcenter = tr.dual(cell);
Bare_point circumcenter = tr.dual(cell);
// Compute move
Vector_3 p_circum = vector(p,circumcenter);

View File

@ -334,15 +334,17 @@ public:
typedef Container_ Container; // Because we need it in Mesher_level
typedef typename Container::Element Container_element;
typedef typename Tr::Point Point;
typedef typename Tr::Weighted_point Weighted_point;
typedef typename Tr::Cell Cell;
typedef typename Tr::Cell_handle Cell_handle;
typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Criteria::Cell_quality Cell_quality;
typedef typename Triangulation_mesher_level_traits_3<Tr>::Zone Zone;
typedef Complex3InTriangulation3 C3T3;
protected:
typedef typename Tr::Geom_traits::Bare_point Bare_point;
public:
// Constructor
// For sequential
Refine_cells_3(Tr& triangulation,
@ -371,7 +373,7 @@ public:
int number_of_bad_elements_impl();
Point circumcenter_impl(const Cell_handle& cell) const
Bare_point circumcenter_impl(const Cell_handle& cell) const
{
return r_tr_.dual(cell);
}
@ -391,7 +393,7 @@ public:
}
// Gets the point to insert from the element to refine
Point refinement_point_impl(const Cell_handle& cell) const
Bare_point refinement_point_impl(const Cell_handle& cell) const
{
this->set_last_vertex_index(
r_oracle_.index_from_subdomain_index(cell->subdomain_index()) );
@ -402,16 +404,16 @@ public:
}
// Returns the conflicts zone
Zone conflicts_zone_impl(const Point& point
Zone conflicts_zone_impl(const Weighted_point& point
, const Cell_handle& cell
, bool &facet_is_in_its_cz) const;
Zone conflicts_zone_impl(const Point& point
Zone conflicts_zone_impl(const Weighted_point& point
, const Cell_handle& cell
, bool &facet_is_in_its_cz
, bool &could_lock_zone) const;
// Job to do before insertion
void before_insertion_impl(const Cell_handle&, const Point&, Zone& zone)
void before_insertion_impl(const Cell_handle&, const Weighted_point&, Zone& zone)
{
before_insertion_handle_cells_in_conflict_zone(zone);
}
@ -425,7 +427,7 @@ public:
#endif
// Insertion implementation ; returns the inserted vertex
Vertex_handle insert_impl(const Point& p, const Zone& zone);
Vertex_handle insert_impl(const Weighted_point& p, const Zone& zone);
// Updates cells incident to vertex, and add them to queue if needed
void update_star(const Vertex_handle& vertex);
@ -757,7 +759,7 @@ number_of_bad_elements_impl()
template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, class C_>
typename Refine_cells_3<Tr,Cr,MD,C3T3_,P_,Ct,C_>::Zone
Refine_cells_3<Tr,Cr,MD,C3T3_,P_,Ct,C_>::
conflicts_zone_impl(const Point& point
conflicts_zone_impl(const Weighted_point& point
, const Cell_handle& cell
, bool &facet_is_in_its_cz) const
{
@ -781,7 +783,7 @@ conflicts_zone_impl(const Point& point
template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, class C_>
typename Refine_cells_3<Tr,Cr,MD,C3T3_,P_,Ct,C_>::Zone
Refine_cells_3<Tr,Cr,MD,C3T3_,P_,Ct,C_>::
conflicts_zone_impl(const Point& point
conflicts_zone_impl(const Weighted_point& point
, const Cell_handle& cell
, bool &facet_is_in_its_cz
, bool &could_lock_zone
@ -934,7 +936,7 @@ compute_badness(const Cell_handle& cell)
template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, class C_>
typename Refine_cells_3<Tr,Cr,MD,C3T3_,P_,Ct,C_>::Vertex_handle
Refine_cells_3<Tr,Cr,MD,C3T3_,P_,Ct,C_>::
insert_impl(const Point& point,
insert_impl(const Weighted_point& point,
const Zone& zone)
{
// TODO: look at this

View File

@ -276,6 +276,8 @@ class Refine_facets_3_base
typedef typename Gt::Segment_3 Segment_3;
typedef typename Gt::Ray_3 Ray_3;
typedef typename Gt::Line_3 Line_3;
protected:
typedef typename Gt::Bare_point Bare_point;
public:
Refine_facets_3_base(Tr& tr, Complex3InTriangulation3& c3t3,
@ -290,7 +292,7 @@ public:
void scan_triangulation_impl_amendement() const {}
/// Gets the point to insert from the element to refine
Point refinement_point_impl(const Facet& facet) const
Bare_point refinement_point_impl(const Facet& facet) const
{
#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
const Cell_handle c = facet.first;
@ -394,10 +396,9 @@ protected:
typedef typename Get_Is_facet_bad<Criteria>::Type Is_facet_bad;
typedef typename MeshDomain::Surface_patch_index Surface_patch_index;
typedef typename MeshDomain::Index Index;
typedef typename Gt::Bare_point Bare_point;
typedef typename boost::optional<
CGAL::cpp11::tuple<Surface_patch_index, Index, Point> >
CGAL::cpp11::tuple<Surface_patch_index, Index, Bare_point> >
Facet_properties;
@ -422,23 +423,20 @@ protected:
/// Sets facet f and it's mirror one surface center to point p
void set_facet_surface_center(const Facet& f,
const Point& p,
const Bare_point& p,
const Index& index) const
{
typename Gt::Construct_point_3 cp =
r_tr_.geom_traits().construct_point_3_object();
const Facet mirror = mirror_facet(f);
f.first->set_facet_surface_center(f.second, cp(p));
mirror.first->set_facet_surface_center(mirror.second, cp(p));
f.first->set_facet_surface_center(f.second, p);
mirror.first->set_facet_surface_center(mirror.second, p);
f.first->set_facet_surface_center_index(f.second,index);
mirror.first->set_facet_surface_center_index(mirror.second,index);
}
/// Returns facet surface center of \c f
Point get_facet_surface_center(const Facet& f) const
Bare_point get_facet_surface_center(const Facet& f) const
{
return f.first->get_facet_surface_center(f.second);
}
@ -1121,7 +1119,7 @@ number_of_bad_elements_impl()
const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
const Point& surface_center = CGAL::cpp11::get<2>(*properties);
const Bare_point& surface_center = CGAL::cpp11::get<2>(*properties);
// Facet is on surface: set facet properties
//set_facet_surface_center(facet, surface_center, surface_center_index);
@ -1306,7 +1304,7 @@ conflicts_zone_impl(const Point& point
{
const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
const Point& surface_center = CGAL::cpp11::get<2>(*properties);
const Bare_point& surface_center = CGAL::cpp11::get<2>(*properties);
// Facet is on surface: set facet properties
this->set_facet_surface_center(facet, surface_center, surface_center_index);
@ -1368,7 +1366,7 @@ conflicts_zone_impl(const Point& point
{
const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
const Point& surface_center = CGAL::cpp11::get<2>(*properties);
const Bare_point& surface_center = CGAL::cpp11::get<2>(*properties);
// Facet is on surface: set facet properties
this->set_facet_surface_center(facet, surface_center, surface_center_index);
@ -1542,7 +1540,7 @@ treat_new_facet(Facet& facet)
{
const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
const Point& surface_center = CGAL::cpp11::get<2>(*properties);
const Bare_point& surface_center = CGAL::cpp11::get<2>(*properties);
// Facet is on surface: set facet properties
set_facet_surface_center(facet, surface_center, surface_center_index);
@ -1718,9 +1716,6 @@ compute_facet_properties(const Facet& facet,
r_oracle_.do_intersect_surface_object();
#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
typedef typename Gt::Bare_point Bare_point;
Cell_handle c = facet.first;
int i = facet.second;
Cell_handle n = c->neighbor(i);
@ -1762,7 +1757,7 @@ compute_facet_properties(const Facet& facet,
#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
fp = Facet_properties(CGAL::cpp11::make_tuple(*surface,
CGAL::cpp11::get<1>(intersect),
Point(CGAL::cpp11::get<0>(intersect))));
CGAL::cpp11::get<0>(intersect)));
}
}
// If the dual is a ray
@ -1801,7 +1796,7 @@ compute_facet_properties(const Facet& facet,
{
fp = Facet_properties(CGAL::cpp11::make_tuple(*surface,
CGAL::cpp11::get<1>(intersect),
Point(CGAL::cpp11::get<0>(intersect))));
CGAL::cpp11::get<0>(intersect)));
}
}
}
@ -1821,17 +1816,15 @@ is_facet_encroached(const Facet& facet,
typename Gt::Compare_power_distance_3 compare_distance =
r_tr_.geom_traits().compare_power_distance_3_object();
typename Gt::Construct_point_3 cp =
r_tr_.geom_traits().construct_point_3_object();
const Cell_handle& cell = facet.first;
const int& facet_index = facet.second;
const Point& center = get_facet_surface_center(facet);
const Bare_point& center = get_facet_surface_center(facet);
const Point& reference_point = cell->vertex((facet_index+1)&3)->point();
// facet is encroached if the new point is near from center than
// one vertex of the facet
return ( compare_distance(cp(center), reference_point, point) != CGAL::SMALLER );
return ( compare_distance(center, reference_point, point) != CGAL::SMALLER );
}
template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>

View File

@ -185,6 +185,7 @@ _test_cls_delaunay_3(const Triangulation &)
//typedef typename If<typename Cls::Weighted_tag,
// typename Cls::Point, Cls>::type::Point Point;
typedef typename Cls::Point Point;
typedef typename Cls::Geom_traits::Point_3 Bare_point;
typedef typename Cls::Segment Segment;
typedef typename Cls::Triangle Triangle;
@ -914,7 +915,7 @@ _test_cls_delaunay_3(const Triangulation &)
// We only test return types and instantiation, basically.
{
Cell_handle c = T4.finite_cells_begin();
Point p = T4.dual(c);
Bare_point p = T4.dual(c);
(void)p;
Facet f = Facet(c, 2);
CGAL::Object o = T4.dual(f);