WIP: test_meshing_polyhedron_with_features compiles and crashes in odt

This commit is contained in:
Andreas Fabri 2017-03-02 15:51:41 +01:00 committed by Mael Rouxel-Labbé
parent bb213d5ad1
commit 780e01dc90
14 changed files with 233 additions and 144 deletions

View File

@ -242,9 +242,9 @@ public:
typedef typename GT::Weighted_point_3 Weighted_point_3; typedef typename GT::Weighted_point_3 Weighted_point_3;
typedef Point* Point_container; typedef Weighted_point_3* Point_container;
typedef Point* Point_iterator; typedef Weighted_point_3* Point_iterator;
typedef const Point* Point_const_iterator; typedef const Weighted_point_3* Point_const_iterator;
public: public:
void invalidate_circumcenter() const void invalidate_circumcenter() const

View File

@ -387,6 +387,7 @@ class C3T3_helpers_base
protected: protected:
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point;
typedef typename Gt::FT FT; typedef typename Gt::FT FT;
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;
@ -402,7 +403,7 @@ protected:
public: public:
// Dummy locks/unlocks // Dummy locks/unlocks
bool try_lock_point(const Bare_point &, int = 0) const bool try_lock_point(const Weighted_point &, int = 0) const
{ {
return true; return true;
} }
@ -412,7 +413,7 @@ public:
return true; return true;
} }
bool try_lock_point_no_spin(const Bare_point &, int = 0) const bool try_lock_point_no_spin(const Weighted_point &, int = 0) const
{ {
return true; return true;
} }
@ -433,7 +434,7 @@ public:
} }
bool is_point_locked_by_this_thread(const Bare_point &) const bool is_point_locked_by_this_thread(const Weighted_point &) const
{ return false; } { return false; }
bool is_cell_locked_by_this_thread(const Cell_handle &) const bool is_cell_locked_by_this_thread(const Cell_handle &) const
@ -457,7 +458,8 @@ class C3T3_helpers_base<Tr, Parallel_tag>
{ {
protected: protected:
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Gt::Bare_point Bare_point; typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point;
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::Facet Facet; typedef typename Tr::Facet Facet;
@ -475,7 +477,7 @@ public:
return m_lock_ds; return m_lock_ds;
}*/ }*/
bool try_lock_point(const Bare_point &p, int lock_radius = 0) const bool try_lock_point(const Weighted_point &p, int lock_radius = 0) const
{ {
if (m_lock_ds) if (m_lock_ds)
{ {
@ -493,7 +495,7 @@ public:
return true; return true;
} }
bool try_lock_point_no_spin(const Bare_point &p, int lock_radius = 0) const bool try_lock_point_no_spin(const Weighted_point &p, int lock_radius = 0) const
{ {
if (m_lock_ds) if (m_lock_ds)
{ {
@ -537,7 +539,7 @@ public:
return success; return success;
} }
bool is_point_locked_by_this_thread(const Bare_point &p) const bool is_point_locked_by_this_thread(const Weighted_point &p) const
{ {
bool locked = true; bool locked = true;
if (m_lock_ds) if (m_lock_ds)
@ -634,11 +636,13 @@ class C3T3_helpers
typedef typename Gt::Vector_3 Vector_3; typedef typename Gt::Vector_3 Vector_3;
typedef typename Gt::Bare_point Bare_point; typedef typename Gt::Bare_point Bare_point;
typedef typename Gt::Weighted_point_3 Weighted_point;
typedef typename Gt::Plane_3 Plane_3; typedef typename Gt::Plane_3 Plane_3;
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 Gt::Construct_point_3 Construct_point_3;
typedef typename Gt::Construct_weighted_point_3 Construct_weighted_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;
@ -715,6 +719,7 @@ public:
, tr_(c3t3.triangulation()) , tr_(c3t3.triangulation())
, domain_(domain) , domain_(domain)
, wp2p_(tr_.geom_traits().construct_point_3_object()) , wp2p_(tr_.geom_traits().construct_point_3_object())
, p2wp_(tr_.geom_traits().construct_weighted_point_3_object())
{ } { }
/** /**
@ -733,7 +738,7 @@ public:
*/ */
template <typename SliverCriterion, typename OutputIterator> template <typename SliverCriterion, typename OutputIterator>
std::pair<bool,Vertex_handle> std::pair<bool,Vertex_handle>
update_mesh(const Bare_point& new_position, update_mesh(const Weighted_point& new_position,
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
const SliverCriterion& criterion, const SliverCriterion& criterion,
OutputIterator modified_vertices, OutputIterator modified_vertices,
@ -747,7 +752,7 @@ public:
*/ */
template <typename SliverCriterion, typename OutputIterator> template <typename SliverCriterion, typename OutputIterator>
std::pair<bool,Vertex_handle> std::pair<bool,Vertex_handle>
update_mesh_topo_change(const Bare_point& new_position, update_mesh_topo_change(const Weighted_point& new_position,
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
const SliverCriterion& criterion, const SliverCriterion& criterion,
OutputIterator modified_vertices, OutputIterator modified_vertices,
@ -760,7 +765,7 @@ public:
* Insert into modified vertices the vertices which are impacted by to move. * Insert into modified vertices the vertices which are impacted by to move.
*/ */
template <typename OutputIterator> template <typename OutputIterator>
Vertex_handle update_mesh(const Bare_point& new_position, Vertex_handle update_mesh(const Weighted_point& new_position,
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
OutputIterator modified_vertices, OutputIterator modified_vertices,
bool fill_modified_vertices = true); bool fill_modified_vertices = true);
@ -769,7 +774,7 @@ public:
* Updates mesh moving vertex \c old_vertex to \c new_position. Returns the * Updates mesh moving vertex \c old_vertex to \c new_position. Returns the
* new vertex of the triangulation. * new vertex of the triangulation.
*/ */
Vertex_handle update_mesh(const Bare_point& new_position, Vertex_handle update_mesh(const Weighted_point& new_position,
const Vertex_handle& old_vertex) const Vertex_handle& old_vertex)
{ {
return update_mesh(new_position, old_vertex, Emptyset_iterator(), false); return update_mesh(new_position, old_vertex, Emptyset_iterator(), false);
@ -821,11 +826,11 @@ public:
* The second one (with the could_lock_zone param) is for the parallel version * The second one (with the could_lock_zone param) is for the parallel version
*/ */
Vertex_handle move_point(const Vertex_handle& old_vertex, Vertex_handle move_point(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
Outdated_cell_set& outdated_cells_set, Outdated_cell_set& outdated_cells_set,
Moving_vertices_set& moving_vertices) const; Moving_vertices_set& moving_vertices) const;
Vertex_handle move_point(const Vertex_handle& old_vertex, Vertex_handle move_point(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
Outdated_cell_set& outdated_cells_set, Outdated_cell_set& outdated_cells_set,
Moving_vertices_set& moving_vertices, Moving_vertices_set& moving_vertices,
bool *could_lock_zone) const; bool *could_lock_zone) const;
@ -1631,7 +1636,7 @@ private:
*/ */
template <typename SliverCriterion, typename OutputIterator> template <typename SliverCriterion, typename OutputIterator>
std::pair<bool,Vertex_handle> std::pair<bool,Vertex_handle>
update_mesh_no_topo_change(const Bare_point& new_position, update_mesh_no_topo_change(const Weighted_point& new_position,
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
const SliverCriterion& criterion, const SliverCriterion& criterion,
OutputIterator modified_vertices, OutputIterator modified_vertices,
@ -1644,13 +1649,13 @@ private:
template < typename OutdatedCellsOutputIterator, template < typename OutdatedCellsOutputIterator,
typename DeletedCellsOutputIterator > typename DeletedCellsOutputIterator >
Vertex_handle move_point(const Vertex_handle& old_vertex, Vertex_handle move_point(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
OutdatedCellsOutputIterator outdated_cells, OutdatedCellsOutputIterator outdated_cells,
DeletedCellsOutputIterator deleted_cells) const; DeletedCellsOutputIterator deleted_cells) const;
Vertex_handle Vertex_handle
move_point_topo_change(const Vertex_handle& old_vertex, move_point_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
Outdated_cell_set& outdated_cells_set, Outdated_cell_set& outdated_cells_set,
bool *could_lock_zone = NULL) const; bool *could_lock_zone = NULL) const;
@ -1658,22 +1663,22 @@ private:
typename DeletedCellsOutputIterator > typename DeletedCellsOutputIterator >
Vertex_handle Vertex_handle
move_point_topo_change(const Vertex_handle& old_vertex, move_point_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
OutdatedCellsOutputIterator outdated_cells, OutdatedCellsOutputIterator outdated_cells,
DeletedCellsOutputIterator deleted_cells) const; DeletedCellsOutputIterator deleted_cells) const;
Vertex_handle move_point_topo_change(const Vertex_handle& old_vertex, Vertex_handle move_point_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position) const; const Weighted_point& new_position) const;
template < typename OutdatedCellsOutputIterator > template < typename OutdatedCellsOutputIterator >
Vertex_handle Vertex_handle
move_point_no_topo_change(const Vertex_handle& old_vertex, move_point_no_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
OutdatedCellsOutputIterator outdated_cells) const; OutdatedCellsOutputIterator outdated_cells) const;
Vertex_handle Vertex_handle
move_point_no_topo_change(const Vertex_handle& old_vertex, move_point_no_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position) const; const Weighted_point& new_position) const;
/** /**
* Returns the least square plane from v, using adjacent surface points * Returns the least square plane from v, using adjacent surface points
@ -1698,7 +1703,7 @@ private:
*/ */
template<typename OutputIterator> template<typename OutputIterator>
Vertex_handle revert_move(const Vertex_handle& new_vertex, Vertex_handle revert_move(const Vertex_handle& new_vertex,
const Bare_point& old_point, const Weighted_point& old_point,
OutputIterator outdated_cells) OutputIterator outdated_cells)
{ {
// Move vertex // Move vertex
@ -1753,14 +1758,14 @@ private:
template <typename OutputIterator> template <typename OutputIterator>
OutputIterator OutputIterator
get_conflict_zone_topo_change(const Vertex_handle& vertex, get_conflict_zone_topo_change(const Vertex_handle& vertex,
const Bare_point& conflict_point, const Weighted_point& conflict_point,
OutputIterator conflict_cells) const; OutputIterator conflict_cells) const;
template <typename CellsOutputIterator, template <typename CellsOutputIterator,
typename FacetsOutputIterator> typename FacetsOutputIterator>
void void
get_conflict_zone_topo_change(const Vertex_handle& v, get_conflict_zone_topo_change(const Vertex_handle& v,
const Bare_point& conflict_point, const Weighted_point& conflict_point,
CellsOutputIterator insertion_conflict_cells, CellsOutputIterator insertion_conflict_cells,
FacetsOutputIterator insertion_conflict_boundary, FacetsOutputIterator insertion_conflict_boundary,
CellsOutputIterator removal_conflict_cells, CellsOutputIterator removal_conflict_cells,
@ -1772,7 +1777,7 @@ private:
typename DeletedCellsOutputIterator > typename DeletedCellsOutputIterator >
Vertex_handle Vertex_handle
move_point_topo_change_conflict_zone_known(const Vertex_handle& old_vertex, move_point_topo_change_conflict_zone_known(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
const Facet& insertion_boundary_facet, const Facet& insertion_boundary_facet,
ConflictCellsInputIterator insertion_conflict_cells_begin, ConflictCellsInputIterator insertion_conflict_cells_begin,
ConflictCellsInputIterator insertion_conflict_cells_end, ConflictCellsInputIterator insertion_conflict_cells_end,
@ -2398,6 +2403,7 @@ private:
Tr& tr_; Tr& tr_;
const MeshDomain& domain_; const MeshDomain& domain_;
Construct_point_3 wp2p_; Construct_point_3 wp2p_;
Construct_weighted_point_3 p2wp_;
}; // class C3T3_helpers }; // class C3T3_helpers
@ -2405,7 +2411,7 @@ template <typename C3T3, typename MD>
template <typename SliverCriterion, typename OutputIterator> template <typename SliverCriterion, typename OutputIterator>
std::pair<bool,typename C3T3_helpers<C3T3,MD>::Vertex_handle> std::pair<bool,typename C3T3_helpers<C3T3,MD>::Vertex_handle>
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
update_mesh(const Bare_point& new_position, update_mesh(const Weighted_point& new_position,
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
const SliverCriterion& criterion, const SliverCriterion& criterion,
OutputIterator modified_vertices, OutputIterator modified_vertices,
@ -2444,7 +2450,7 @@ template <typename C3T3, typename MD>
template <typename SliverCriterion, typename OutputIterator> template <typename SliverCriterion, typename OutputIterator>
std::pair<bool,typename C3T3_helpers<C3T3,MD>::Vertex_handle> std::pair<bool,typename C3T3_helpers<C3T3,MD>::Vertex_handle>
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
update_mesh_no_topo_change(const Bare_point& new_position, update_mesh_no_topo_change(const Weighted_point& new_position,
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
const SliverCriterion& criterion, const SliverCriterion& criterion,
OutputIterator modified_vertices, OutputIterator modified_vertices,
@ -2461,7 +2467,7 @@ update_mesh_no_topo_change(const Bare_point& 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;
Bare_point old_position = wp2p_(old_vertex->point()); Weighted_point old_position = old_vertex->point();
// Move point // Move point
reset_circumcenter_cache(conflict_cells); reset_circumcenter_cache(conflict_cells);
@ -2503,7 +2509,7 @@ template <typename C3T3, typename MD>
template <typename SliverCriterion, typename OutputIterator> template <typename SliverCriterion, typename OutputIterator>
std::pair<bool,typename C3T3_helpers<C3T3,MD>::Vertex_handle> std::pair<bool,typename C3T3_helpers<C3T3,MD>::Vertex_handle>
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
update_mesh_topo_change(const Bare_point& new_position, update_mesh_topo_change(const Weighted_point& new_position,
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
const SliverCriterion& criterion, const SliverCriterion& criterion,
OutputIterator modified_vertices, OutputIterator modified_vertices,
@ -2545,7 +2551,7 @@ update_mesh_topo_change(const Bare_point& 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;
Bare_point old_position = wp2p_(old_vertex->point()); Weighted_point old_position = old_vertex->point();
// Keep old boundary // Keep old boundary
Vertex_set old_incident_surface_vertices; Vertex_set old_incident_surface_vertices;
@ -2621,7 +2627,7 @@ template <typename C3T3, typename MD>
template <typename OutputIterator> template <typename OutputIterator>
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
update_mesh(const Bare_point& new_position, update_mesh(const Weighted_point& new_position,
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
OutputIterator modified_vertices, OutputIterator modified_vertices,
bool fill_vertices) bool fill_vertices)
@ -2764,7 +2770,7 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells,
// Update moving vertices (it becomes new_vertex) // Update moving vertices (it becomes new_vertex)
moving_vertices.erase(*it); moving_vertices.erase(*it);
Vertex_handle new_vertex = update_mesh(new_pos,*it); Vertex_handle new_vertex = update_mesh(p2wp_(new_pos),*it);
c3t3_.set_dimension(new_vertex,2); c3t3_.set_dimension(new_vertex,2);
moving_vertices.insert(new_vertex); moving_vertices.insert(new_vertex);
@ -2897,7 +2903,7 @@ template <typename OutdatedCellsOutputIterator,
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point(const Vertex_handle& old_vertex, move_point(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
OutdatedCellsOutputIterator outdated_cells, OutdatedCellsOutputIterator outdated_cells,
DeletedCellsOutputIterator deleted_cells) const DeletedCellsOutputIterator deleted_cells) const
{ {
@ -2929,7 +2935,7 @@ template <typename C3T3, typename MD>
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point(const Vertex_handle& old_vertex, move_point(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
Outdated_cell_set& outdated_cells_set, Outdated_cell_set& outdated_cells_set,
Moving_vertices_set& moving_vertices) const Moving_vertices_set& moving_vertices) const
{ {
@ -2963,7 +2969,7 @@ template <typename C3T3, typename MD>
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point(const Vertex_handle& old_vertex, move_point(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
Outdated_cell_set& outdated_cells_set, Outdated_cell_set& outdated_cells_set,
Moving_vertices_set& moving_vertices, Moving_vertices_set& moving_vertices,
bool *could_lock_zone) const bool *could_lock_zone) const
@ -3039,7 +3045,7 @@ template <typename C3T3, typename MD>
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point_topo_change(const Vertex_handle& old_vertex, move_point_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
Outdated_cell_set& outdated_cells_set, Outdated_cell_set& outdated_cells_set,
bool *could_lock_zone) const bool *could_lock_zone) const
{ {
@ -3098,7 +3104,7 @@ template <typename OutdatedCellsOutputIterator,
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point_topo_change(const Vertex_handle& old_vertex, move_point_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
OutdatedCellsOutputIterator outdated_cells, OutdatedCellsOutputIterator outdated_cells,
DeletedCellsOutputIterator deleted_cells) const DeletedCellsOutputIterator deleted_cells) const
{ {
@ -3137,7 +3143,7 @@ typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point_topo_change_conflict_zone_known( move_point_topo_change_conflict_zone_known(
const Vertex_handle& old_vertex, const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
const Facet& insertion_boundary_facet, const Facet& insertion_boundary_facet,
ConflictCellsInputIterator insertion_conflict_cells_begin,//ordered ConflictCellsInputIterator insertion_conflict_cells_begin,//ordered
ConflictCellsInputIterator insertion_conflict_cells_end, ConflictCellsInputIterator insertion_conflict_cells_end,
@ -3148,7 +3154,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
{ {
Bare_point old_position = wp2p_(old_vertex->point()); Weighted_point old_position = 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,
@ -3203,7 +3209,7 @@ template <typename C3T3, typename MD>
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point_topo_change(const Vertex_handle& old_vertex, move_point_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position) const const Weighted_point& new_position) const
{ {
// Insert new_vertex, remove old_vertex // Insert new_vertex, remove old_vertex
int dimension = c3t3_.in_dimension(old_vertex); int dimension = c3t3_.in_dimension(old_vertex);
@ -3230,7 +3236,7 @@ template <typename OutdatedCellsOutputIterator>
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point_no_topo_change(const Vertex_handle& old_vertex, move_point_no_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position, const Weighted_point& new_position,
OutdatedCellsOutputIterator outdated_cells) const OutdatedCellsOutputIterator outdated_cells) const
{ {
@ -3246,7 +3252,7 @@ template <typename C3T3, typename MD>
typename C3T3_helpers<C3T3,MD>::Vertex_handle typename C3T3_helpers<C3T3,MD>::Vertex_handle
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
move_point_no_topo_change(const Vertex_handle& old_vertex, move_point_no_topo_change(const Vertex_handle& old_vertex,
const Bare_point& new_position) const const Weighted_point& new_position) const
{ {
// Change vertex position // Change vertex position
old_vertex->set_point(new_position); old_vertex->set_point(new_position);
@ -3768,7 +3774,7 @@ template <typename CellsOutputIterator,
void void
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
get_conflict_zone_topo_change(const Vertex_handle& v, get_conflict_zone_topo_change(const Vertex_handle& v,
const Bare_point& conflict_point, const Weighted_point& conflict_point,
CellsOutputIterator insertion_conflict_cells, CellsOutputIterator insertion_conflict_cells,
FacetsOutputIterator insertion_conflict_boundary, FacetsOutputIterator insertion_conflict_boundary,
CellsOutputIterator removal_conflict_cells, CellsOutputIterator removal_conflict_cells,
@ -3805,7 +3811,7 @@ template <typename OutputIterator>
OutputIterator OutputIterator
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
get_conflict_zone_topo_change(const Vertex_handle& vertex, get_conflict_zone_topo_change(const Vertex_handle& vertex,
const Bare_point& conflict_point, const Weighted_point& conflict_point,
OutputIterator conflict_cells) const OutputIterator conflict_cells) const
{ {
// Get triangulation_vertex incident cells // Get triangulation_vertex incident cells

View File

@ -112,7 +112,7 @@ public:
private: private:
/** /**
* Project_on_plane defines operator() to project Weighted_point object on plane. * Project_on_plane defines operator() to project point object on plane.
*/ */
struct Project_on_plane struct Project_on_plane
{ {
@ -126,14 +126,14 @@ private:
}; };
/** /**
* To_2d defines operator() to transform Weighted_point into Point_2 * To_2d defines operator() to transform Bare_point into Point_2
*/ */
struct To_2d struct To_2d
{ {
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 Weighted_point& p) const Point_2 operator()(const Bare_point& p) const
{ return Point_2(to_2d_.transform(p.point()).x(), to_2d_.transform(p.point()).y()); } { return Point_2(to_2d_.transform(p).x(), to_2d_.transform(p).y()); }
private: private:
const Aff_transformation_3& to_2d_; const Aff_transformation_3& to_2d_;
@ -146,7 +146,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) {}
Weighted_point operator()(const Point_2& p) const Bare_point operator()(const Point_2& p) const
{ return to_3d_.transform((Bare_point(p.x(),p.y(),0))); } { return to_3d_.transform((Bare_point(p.x(),p.y(),0))); }
private: private:
@ -221,16 +221,16 @@ private:
} }
case 2: // centroid case 2: // centroid
{ {
const Weighted_point& a = points.front(); const Bare_point& a = points.front();
const Weighted_point& b = points.back(); const Bare_point& b = points.back();
return centroid_segment_move(v,a,b,sizing_field); return centroid_segment_move(v,a,b,sizing_field);
break; break;
} }
case 3: // triangle centroid case 3: // triangle centroid
{ {
const Weighted_point& a = points.at(0); const Bare_point& a = points.at(0);
const Weighted_point& b = points.at(1); const Bare_point& b = points.at(1);
const Weighted_point& c = points.at(2); const Bare_point& c = points.at(2);
return centroid_triangle_move(v,a,b,c,sizing_field); return centroid_triangle_move(v,a,b,c,sizing_field);
break; break;
} }
@ -275,14 +275,15 @@ private:
* Return move from \c v to centroid of segment [a,b] * Return move from \c v to centroid of segment [a,b]
*/ */
Vector_3 centroid_segment_move(const Vertex_handle& v, Vector_3 centroid_segment_move(const Vertex_handle& v,
const Weighted_point& a, const Bare_point& a,
const Weighted_point& b, const Bare_point& b,
const Sizing_field& sizing_field) const const Sizing_field& sizing_field) const
{ {
typename Gt::Construct_vector_3 vector = typename Gt::Construct_vector_3 vector =
Gt().construct_vector_3_object(); Gt().construct_vector_3_object();
const Weighted_point& p = v->point(); typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
const Bare_point& p = wp2p(v->point());
FT da = density_1d(a,v,sizing_field); FT da = density_1d(a,v,sizing_field);
FT db = density_1d(b,v,sizing_field); FT db = density_1d(b,v,sizing_field);
@ -295,15 +296,16 @@ private:
* Return move from \c v to centroid of triangle [a,b,c] * Return move from \c v to centroid of triangle [a,b,c]
*/ */
Vector_3 centroid_triangle_move(const Vertex_handle& v, Vector_3 centroid_triangle_move(const Vertex_handle& v,
const Weighted_point& a, const Bare_point& a,
const Weighted_point& b, const Bare_point& b,
const Weighted_point& c, const Bare_point& c,
const Sizing_field& sizing_field) const const Sizing_field& sizing_field) const
{ {
typename Gt::Construct_vector_3 vector = typename Gt::Construct_vector_3 vector =
Gt().construct_vector_3_object(); Gt().construct_vector_3_object();
const Weighted_point& p = v->point(); typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
const Bare_point& p = wp2p(v->point());
FT da = density_2d<true>(a,v,sizing_field); FT da = density_2d<true>(a,v,sizing_field);
FT db = density_2d<false>(b,v,sizing_field); FT db = density_2d<false>(b,v,sizing_field);
@ -353,7 +355,7 @@ private:
std::back_inserter(ch_2d)); std::back_inserter(ch_2d));
// Lift back convex hull to 3D // Lift back convex hull to 3D
std::vector<Weighted_point> polygon_3d; std::vector<Bare_point> polygon_3d;
polygon_3d.reserve(ch_2d.size()); polygon_3d.reserve(ch_2d.size());
std::transform(ch_2d.begin(), ch_2d.end(), std::transform(ch_2d.begin(), ch_2d.end(),
std::back_inserter(polygon_3d), To_3d(to_3d)); std::back_inserter(polygon_3d), To_3d(to_3d));
@ -389,13 +391,13 @@ private:
const Weighted_point& vertex_position = v->point(); const Weighted_point& vertex_position = v->point();
// Use as reference point to triangulate // Use as reference point to triangulate
const Weighted_point& a = *first++; const Bare_point& a = *first++;
const Weighted_point* b = &(*first++); const Bare_point* b = &(*first++);
// Treat first point (optimize density_2d call) // Treat first point (optimize density_2d call)
const Weighted_point& c = *first++; const Bare_point& c = *first++;
Weighted_point triangle_centroid = centroid(a,*b,c); Bare_point triangle_centroid = centroid(a,*b,c);
FT density = density_2d<true>(triangle_centroid, v, sizing_field); FT density = density_2d<true>(triangle_centroid, v, sizing_field);
FT sum_masses = density * area(a,*b,c); FT sum_masses = density * area(a,*b,c);
@ -406,9 +408,9 @@ private:
// Next points // Next points
while ( first != last ) while ( first != last )
{ {
const Weighted_point& c = *first++; const Bare_point& c = *first++;
Weighted_point triangle_centroid = centroid(a,*b,c); Bare_point triangle_centroid = centroid(a,*b,c);
FT density = density_2d<false>(triangle_centroid, v, sizing_field); FT density = density_2d<false>(triangle_centroid, v, sizing_field);
FT mass = density * area(a,*b,c); FT mass = density * area(a,*b,c);
@ -427,7 +429,7 @@ private:
* Returns the transformation from reference_point to plane * Returns the transformation from reference_point to plane
*/ */
Aff_transformation_3 compute_to_3d_transform(const Plane_3& plane, Aff_transformation_3 compute_to_3d_transform(const Plane_3& plane,
const Weighted_point& reference_point) const const Bare_point& reference_point) const
{ {
typename Gt::Construct_base_vector_3 base = typename Gt::Construct_base_vector_3 base =
Gt().construct_base_vector_3_object(); Gt().construct_base_vector_3_object();
@ -453,7 +455,7 @@ private:
* returns density_1d * returns density_1d
*/ */
template <typename Sizing_field> template <typename Sizing_field>
FT density_1d(const Weighted_point& p, FT density_1d(const Bare_point& p,
const Vertex_handle& v, const Vertex_handle& v,
const Sizing_field& sizing_field) const const Sizing_field& sizing_field) const
{ {
@ -468,7 +470,7 @@ private:
* returns density_2d * returns density_2d
*/ */
template <bool use_v, typename Sizing_field> template <bool use_v, typename Sizing_field>
FT density_2d(const Weighted_point& p, FT density_2d(const Bare_point& p,
const Vertex_handle& v, const Vertex_handle& v,
const Sizing_field& sizing_field) const const Sizing_field& sizing_field) const
{ {
@ -483,7 +485,7 @@ private:
* returns density_3d * returns density_3d
*/ */
template <typename Sizing_field> template <typename Sizing_field>
FT density_3d(const Weighted_point& p, FT density_3d(const Bare_point& p,
const Cell_handle& cell, const Cell_handle& cell,
const Sizing_field& sizing_field) const const Sizing_field& sizing_field) const
{ {
@ -519,23 +521,26 @@ private:
typename Gt::Construct_vector_3 vector = typename Gt::Construct_vector_3 vector =
Gt().construct_vector_3_object(); Gt().construct_vector_3_object();
typename Gt::Construct_point_3 wp2p =
Gt().construct_point_3_object();
Cell_circulator current_cell = tr.incident_cells(edge); Cell_circulator current_cell = tr.incident_cells(edge);
Cell_circulator done = current_cell; Cell_circulator done = current_cell;
// a & b are fixed points // a & b are fixed points
const Weighted_point& a = v->point(); const Bare_point& a = wp2p(v->point());
const Weighted_point b = tr.dual(current_cell++); const Bare_point b = tr.dual(current_cell++);
CGAL_assertion(current_cell != done); CGAL_assertion(current_cell != done);
// c & d are moving points // c & d are moving points
Weighted_point c = tr.dual(current_cell++); Bare_point c = tr.dual(current_cell++);
CGAL_assertion(current_cell != done); CGAL_assertion(current_cell != done);
while ( current_cell != done ) while ( current_cell != done )
{ {
const Weighted_point d = tr.dual(current_cell++); const Bare_point d = tr.dual(current_cell++);
Weighted_point tet_centroid = centroid(a,b,c,d); Bare_point tet_centroid = centroid(a,b,c,d);
// Compute mass // Compute mass
FT density = density_3d(tet_centroid, current_cell, sizing_field); FT density = density_3d(tet_centroid, current_cell, sizing_field);

View File

@ -346,6 +346,7 @@ private:
#endif // CGAL_LINKED_WITH_TBB #endif // CGAL_LINKED_WITH_TBB
{ {
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
typename Gt::Construct_weighted_point_3 p2wp = Gt().construct_weighted_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() ; )
@ -359,7 +360,7 @@ private:
Bare_point new_position = translate(wp2p(oldv->point()),move); Bare_point 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,p2wp(new_position),size));
} }
else // CGAL::NULL_VECTOR == move else // CGAL::NULL_VECTOR == move
{ {
@ -480,6 +481,7 @@ private:
{ {
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(); typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
typename Gt::Construct_weighted_point_3 p2wp = Gt().construct_weighted_point_3_object();
if ( CGAL::NULL_VECTOR != move ) if ( CGAL::NULL_VECTOR != move )
{ {
Bare_point new_position = m_translate(wp2p(oldv->point()), move); Bare_point new_position = m_translate(wp2p(oldv->point()), move);
@ -489,7 +491,7 @@ private:
//if( !Th().inside_protecting_balls(tr_, oldv, new_position)) //if( !Th().inside_protecting_balls(tr_, oldv, new_position))
//note : this is not happening for Lloyd and ODT so it's commented //note : this is not happening for Lloyd and ODT so it's commented
// maybe for a new global optimizer it should be de-commented // maybe for a new global optimizer it should be de-commented
m_moves.push_back(cpp11::make_tuple(oldv, new_position, size)); m_moves.push_back(cpp11::make_tuple(oldv, p2wp(new_position), size));
} }
else // CGAL::NULL_VECTOR == move else // CGAL::NULL_VECTOR == move
{ {
@ -574,7 +576,7 @@ private:
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 Bare_point& new_position = wp2p(cpp11::get<1>(m_moves[i])); const Weighted_point& new_position = 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 )
{ {
@ -937,7 +939,7 @@ update_mesh(const Moves_vector& moves,
typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); 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 Bare_point& new_position = wp2p(cpp11::get<1>(*it)); const Weighted_point& new_position = 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 )
{ {
@ -1002,7 +1004,7 @@ void
Mesh_global_optimizer<C3T3,Md,Mf,V_>:: Mesh_global_optimizer<C3T3,Md,Mf,V_>::
fill_sizing_field() fill_sizing_field()
{ {
std::map<Weighted_point,FT> value_map; std::map<Bare_point,FT> value_map;
#ifdef CGAL_LINKED_WITH_TBB #ifdef CGAL_LINKED_WITH_TBB
// Parallel // Parallel
@ -1032,7 +1034,8 @@ fill_sizing_field()
vit != tr_.finite_vertices_end(); vit != tr_.finite_vertices_end();
++vit) ++vit)
{ {
value_map.insert(std::make_pair(vit->point(), typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object();
value_map.insert(std::make_pair(wp2p(vit->point()),
average_circumradius_length(vit))); average_circumradius_length(vit)));
} }
} }

View File

@ -96,7 +96,7 @@ class Mesh_sizing_field
{ {
// Types // Types
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Bare_point Bare_point;
typedef typename Gt::FT FT; typedef typename Gt::FT FT;
typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Vertex_handle Vertex_handle;
@ -115,43 +115,43 @@ public:
/** /**
* Fill sizing field, using size associated to point in \c value_map * Fill sizing field, using size associated to point in \c value_map
*/ */
void fill(const std::map<Weighted_point, FT>& value_map); void fill(const std::map<Bare_point, FT>& value_map);
/** /**
* Returns size at point \c p. * Returns size at point \c p.
*/ */
FT operator()(const Weighted_point& p) const FT operator()(const Bare_point& p) const
{ return this->operator()(p, this->get_last_cell()); } { return this->operator()(p, this->get_last_cell()); }
/** /**
* Returns size at point \c p, using \c v to accelerate \c p location * Returns size at point \c p, using \c v to accelerate \c p location
* in triangulation * in triangulation
*/ */
FT operator()(const Weighted_point& p, const Vertex_handle& v) const FT operator()(const Bare_point& p, const Vertex_handle& v) const
{ return this->operator()(p,v->cell()); } { return this->operator()(p,v->cell()); }
/** /**
* Returns size at point \c p. * Returns size at point \c p.
*/ */
FT operator()(const Weighted_point& p, const Cell_handle& c) const; FT operator()(const Bare_point& p, const Cell_handle& c) const;
/** /**
* Returns size at point \c p. Assumes that p is the centroid of c. * Returns size at point \c p. Assumes that p is the centroid of c.
*/ */
FT operator()(const Weighted_point& p, const std::pair<Cell_handle,bool>& c) const; FT operator()(const Bare_point& p, const std::pair<Cell_handle,bool>& c) const;
private: private:
/** /**
* Returns size at point \c p, by interpolation into tetrahedron. * Returns size at point \c p, by interpolation into tetrahedron.
*/ */
FT interpolate_on_cell_vertices(const Weighted_point& p, FT interpolate_on_cell_vertices(const Bare_point& p,
const Cell_handle& cell) const; const Cell_handle& cell) const;
/** /**
* Returns size at point \c p, by interpolation into facet (\c cell is assumed * Returns size at point \c p, by interpolation into facet (\c cell is assumed
* to be an infinite cell). * to be an infinite cell).
*/ */
FT interpolate_on_facet_vertices(const Weighted_point& p, FT interpolate_on_facet_vertices(const Bare_point& p,
const Cell_handle& cell) const; const Cell_handle& cell) const;
private: private:
@ -172,7 +172,7 @@ Mesh_sizing_field(Tr& tr)
template <typename Tr, bool B> template <typename Tr, bool B>
void void
Mesh_sizing_field<Tr,B>:: Mesh_sizing_field<Tr,B>::
fill(const std::map<Weighted_point, FT>& value_map) fill(const std::map<Bare_point, FT>& value_map)
{ {
typedef typename Tr::Finite_vertices_iterator Fvi; typedef typename Tr::Finite_vertices_iterator Fvi;
@ -180,8 +180,8 @@ fill(const std::map<Weighted_point, FT>& value_map)
vit != tr_.finite_vertices_end() ; vit != tr_.finite_vertices_end() ;
++ vit ) ++ vit )
{ {
typename std::map<Weighted_point, FT>::const_iterator find_result = typename std::map<Bare_point, FT>::const_iterator find_result =
value_map.find(vit->point()); value_map.find(tr_.geom_traits().construct_point_3_object()(vit->point()));
if ( find_result != value_map.end() ) if ( find_result != value_map.end() )
{ {
@ -198,16 +198,16 @@ fill(const std::map<Weighted_point, FT>& value_map)
template <typename Tr, bool B> template <typename Tr, bool B>
typename Mesh_sizing_field<Tr,B>::FT typename Mesh_sizing_field<Tr,B>::FT
Mesh_sizing_field<Tr,B>:: Mesh_sizing_field<Tr,B>::
operator()(const Weighted_point& p, const Cell_handle& c) const operator()(const Bare_point& p, const Cell_handle& c) const
{ {
#ifdef CGAL_MESH_3_SIZING_FIELD_INEXACT_LOCATE #ifdef CGAL_MESH_3_SIZING_FIELD_INEXACT_LOCATE
//use the inexact locate (much faster than locate) to get a hint //use the inexact locate (much faster than locate) to get a hint
//and then use locate to check whether p is really inside hint //and then use locate to check whether p is really inside hint
// if not, an exact locate will be performed // if not, an exact locate will be performed
Cell_handle hint = tr_.inexact_locate(p,c); Cell_handle hint = tr_.inexact_locate(tr_.geom_traits().construct_weighted_point_3_object()(p),c);
const Cell_handle cell = tr_.locate(p, hint); const Cell_handle cell = tr_.locate(tr_.geom_traits().construct_weighted_point_3_object()(p), hint);
#else #else
const Cell_handle cell = tr_.locate(p,c); const Cell_handle cell = tr_.locate(tr_.geom_traits().construct_weighted_point_3_object()(p),c);
#endif #endif
this->set_last_cell(cell); this->set_last_cell(cell);
@ -221,7 +221,7 @@ operator()(const Weighted_point& p, const Cell_handle& c) const
template <typename Tr, bool B> template <typename Tr, bool B>
typename Mesh_sizing_field<Tr,B>::FT typename Mesh_sizing_field<Tr,B>::FT
Mesh_sizing_field<Tr,B>:: Mesh_sizing_field<Tr,B>::
operator()(const Weighted_point&, const std::pair<Cell_handle,bool>& c) const operator()(const Bare_point&, const std::pair<Cell_handle,bool>& c) const
{ {
// Assumes that p is the centroid of c // Assumes that p is the centroid of c
const Cell_handle& cell = c.first; const Cell_handle& cell = c.first;
@ -239,10 +239,10 @@ operator()(const Weighted_point&, const std::pair<Cell_handle,bool>& c) const
template <typename Tr, bool B> template <typename Tr, bool B>
typename Mesh_sizing_field<Tr,B>::FT typename Mesh_sizing_field<Tr,B>::FT
Mesh_sizing_field<Tr,B>:: Mesh_sizing_field<Tr,B>::
interpolate_on_cell_vertices(const Weighted_point& p, const Cell_handle& cell) const interpolate_on_cell_vertices(const Bare_point& p, const Cell_handle& cell) const
{ {
typename Gt::Compute_volume_3 volume = typename Gt::Compute_volume_3 volume = tr_.geom_traits().compute_volume_3_object();
Gt().compute_volume_3_object(); typename Gt::Construct_point_3 wp2p = tr_.geom_traits().construct_point_3_object();
// Interpolate value using tet vertices values // Interpolate value using tet vertices values
const FT& va = cell->vertex(0)->meshing_info(); const FT& va = cell->vertex(0)->meshing_info();
@ -250,10 +250,10 @@ interpolate_on_cell_vertices(const Weighted_point& p, const Cell_handle& cell) c
const FT& vc = cell->vertex(2)->meshing_info(); const FT& vc = cell->vertex(2)->meshing_info();
const FT& vd = cell->vertex(3)->meshing_info(); const FT& vd = cell->vertex(3)->meshing_info();
const Weighted_point& a = cell->vertex(0)->point(); const Bare_point& a = wp2p(cell->vertex(0)->point());
const Weighted_point& b = cell->vertex(1)->point(); const Bare_point& b = wp2p(cell->vertex(1)->point());
const Weighted_point& c = cell->vertex(2)->point(); const Bare_point& c = wp2p(cell->vertex(2)->point());
const Weighted_point& d = cell->vertex(3)->point(); const Bare_point& d = wp2p(cell->vertex(3)->point());
const FT abcp = CGAL::abs(volume(a,b,c,p)); const FT abcp = CGAL::abs(volume(a,b,c,p));
const FT abdp = CGAL::abs(volume(a,d,b,p)); const FT abdp = CGAL::abs(volume(a,d,b,p));
@ -272,11 +272,11 @@ interpolate_on_cell_vertices(const Weighted_point& p, const Cell_handle& cell) c
template <typename Tr, bool B> template <typename Tr, bool B>
typename Mesh_sizing_field<Tr,B>::FT typename Mesh_sizing_field<Tr,B>::FT
Mesh_sizing_field<Tr,B>:: Mesh_sizing_field<Tr,B>::
interpolate_on_facet_vertices(const Weighted_point& p, const Cell_handle& cell) const interpolate_on_facet_vertices(const Bare_point& p, const Cell_handle& cell) const
{ {
typename Gt::Compute_area_3 area = typename Gt::Compute_area_3 area = tr_.geom_traits().compute_area_3_object();
Gt().compute_area_3_object();
typename Gt::Construct_point_3 wp2p = tr_.geom_traits().construct_point_3_object();
// Find infinite vertex and put it in k0 // Find infinite vertex and put it in k0
int k0 = 0; int k0 = 0;
int k1 = 1; int k1 = 1;
@ -295,9 +295,9 @@ interpolate_on_facet_vertices(const Weighted_point& p, const Cell_handle& cell)
const FT& vb = cell->vertex(k2)->meshing_info(); const FT& vb = cell->vertex(k2)->meshing_info();
const FT& vc = cell->vertex(k3)->meshing_info(); const FT& vc = cell->vertex(k3)->meshing_info();
const Weighted_point& a = cell->vertex(k1)->point(); const Bare_point& a = wp2p(cell->vertex(k1)->point());
const Weighted_point& b = cell->vertex(k2)->point(); const Bare_point& b = wp2p(cell->vertex(k2)->point());
const Weighted_point& c = cell->vertex(k3)->point(); const Bare_point& c = wp2p(cell->vertex(k3)->point());
const FT abp = area(a,b,p); const FT abp = area(a,b,p);
const FT acp = area(a,c,p); const FT acp = area(a,c,p);

View File

@ -555,7 +555,8 @@ initialize()
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);
for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point) for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
r_c3t3_.add_far_point(r_c3t3_.triangulation().geom_traits().construct_translated_point_3_object()(*random_point, center)); r_c3t3_.add_far_point(r_c3t3_.triangulation().geom_traits().construct_weighted_point_3_object()
(r_c3t3_.triangulation().geom_traits().construct_translated_point_3_object()(*random_point, center)));
# ifdef CGAL_CONCURRENT_MESH_3_VERBOSE # ifdef CGAL_CONCURRENT_MESH_3_VERBOSE
std::cerr << "done." << std::endl; std::cerr << "done." << std::endl;

View File

@ -51,6 +51,7 @@ class Odt_move
typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Facet Facet; typedef typename Tr::Facet Facet;
typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Weighted_point Weighted_point;
typedef typename Tr::Bare_point Bare_point;
typedef typename std::vector<Cell_handle> Cell_vector; typedef typename std::vector<Cell_handle> Cell_vector;
typedef typename std::vector<Vertex_handle> Vertex_vector; typedef typename std::vector<Vertex_handle> Vertex_vector;
@ -133,7 +134,7 @@ private:
typename Gt::Construct_centroid_3 centroid = typename Gt::Construct_centroid_3 centroid =
Gt().construct_centroid_3_object(); Gt().construct_centroid_3_object();
Weighted_point c = centroid(tr.tetrahedron(cell)); Bare_point c = centroid(tr.tetrahedron(cell));
FT s = sizing_field(c,std::make_pair(cell,true)); FT s = sizing_field(c,std::make_pair(cell,true));
CGAL_assertion(!is_zero(s)); CGAL_assertion(!is_zero(s));

View File

@ -117,6 +117,7 @@ public:
typedef Complex3InTriangulation3 C3t3; typedef Complex3InTriangulation3 C3t3;
typedef MeshDomain Mesh_domain; typedef MeshDomain Mesh_domain;
typedef typename Tr::Point Point; typedef typename Tr::Point Point;
typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Facet Facet; typedef typename Tr::Facet Facet;
typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Vertex_handle Vertex_handle;
@ -125,6 +126,7 @@ public:
protected: protected:
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::Construct_point_3 Construct_point_3;
typedef typename Tr::Edge Edge; typedef typename Tr::Edge Edge;
typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Cell_handle Cell_handle;
@ -179,13 +181,14 @@ private:
FT compute_sq_distance_to_facet_center(const Facet& f, FT compute_sq_distance_to_facet_center(const Facet& f,
const Vertex_handle v) const { const Vertex_handle v) const {
const Point& fcenter = f.first->get_facet_surface_center(f.second); Construct_point_3 wp2p = this->r_tr_.geom_traits().construct_point_3_object();
const Point& vpoint = v->point(); const Bare_point& fcenter = f.first->get_facet_surface_center(f.second);
const Bare_point& vpoint = wp2p(v->point());
return return
this->r_tr_.geom_traits().compute_squared_distance_3_object() this->r_tr_.geom_traits().compute_squared_distance_3_object()(fcenter,
(fcenter.point(), vpoint.point()) vpoint)
- vpoint.weight(); - v->point().weight();
} }
Facet Facet

View File

@ -174,6 +174,7 @@ public:
typedef Bare_point result_type; typedef Bare_point result_type;
typename Rt::Construct_point_3 wp2p = Rt().construct_point_3_object(); typename Rt::Construct_point_3 wp2p = Rt().construct_point_3_object();
typename Rt::Construct_weighted_point_3 p2wp = Rt().construct_weighted_point_3_object();
Bare_point operator() ( const Weighted_point & p, Bare_point operator() ( const Weighted_point & p,
const Weighted_point & q, const Weighted_point & q,
@ -215,7 +216,7 @@ public:
return res; return res;
} else { } else {
// Fast output // Fast output
if ( power_side_of_oriented_power_sphere(p,q,r,s,res) == CGAL::ON_POSITIVE_SIDE ) if ( power_side_of_oriented_power_sphere(p,q,r,s,p2wp(res)) == CGAL::ON_POSITIVE_SIDE )
return res; return res;
} }
} }

View File

@ -1312,7 +1312,7 @@ perturb_vertex( PVertex pv
} }
Point_3 p = wp2p(pv.vertex()->point()); Point_3 p = wp2p(pv.vertex()->point());
if (!helper_.try_lock_point_no_spin(p) || ! Gt().equal_3_object()(p,wp2p(pv.vertex()->point()))) if (!helper_.try_lock_point_no_spin(pv.vertex()->point()) || ! 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

@ -41,6 +41,7 @@ class Triangulation_helpers
{ {
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point;
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 std::vector<Cell_handle> Cell_vector; typedef std::vector<Cell_handle> Cell_vector;
@ -65,18 +66,18 @@ class Triangulation_helpers
{ {
/// When the requested will be about vh, the returned point will be p /// When the requested will be about vh, the returned point will be p
/// instead of vh->point() /// instead of vh->point()
Point_getter(const Vertex_handle &vh, const Bare_point&p) Point_getter(const Vertex_handle &vh, const Weighted_point&p)
: m_vh(vh), m_p(p) : m_vh(vh), m_p(p)
{} {}
const Bare_point& operator()(const Vertex_handle &vh) const const Weighted_point& operator()(const Vertex_handle &vh) const
{ {
return (vh == m_vh ? m_p : vh->point().point()); // AF: Can this be NOT a weighted point? return (vh == m_vh ? m_p : vh->point());
} }
private: private:
const Vertex_handle m_vh; const Vertex_handle m_vh;
const Bare_point &m_p; const Weighted_point &m_p;
}; };
public: public:
@ -89,7 +90,7 @@ public:
*/ */
void move_point(Tr& tr, void move_point(Tr& tr,
const Vertex_handle& v, const Vertex_handle& v,
const Bare_point& p) const; const Weighted_point& p) const;
/** /**
* Returns true if moving \c v to \c p makes no topological * Returns true if moving \c v to \c p makes no topological
@ -97,21 +98,21 @@ public:
*/ */
bool no_topological_change(const Tr& tr, bool no_topological_change(const Tr& tr,
const Vertex_handle& v, const Vertex_handle& v,
const Bare_point& p, const Weighted_point& p,
Cell_vector& cells_tos) const; Cell_vector& cells_tos) const;
bool no_topological_change__without_set_point( bool no_topological_change__without_set_point(
const Tr& tr, const Tr& tr,
const Vertex_handle& v, const Vertex_handle& v,
const Bare_point& p, const Weighted_point& p,
Cell_vector& cells_tos) const; Cell_vector& cells_tos) const;
bool no_topological_change(const Tr& tr, bool no_topological_change(const Tr& tr,
const Vertex_handle& v, const Vertex_handle& v,
const Bare_point& p) const; const Weighted_point& p) const;
bool no_topological_change__without_set_point( bool no_topological_change__without_set_point(
const Tr& tr, const Tr& tr,
const Vertex_handle& v, const Vertex_handle& v,
const Bare_point& p) const; const Weighted_point& p) const;
bool inside_protecting_balls(const Tr& tr, bool inside_protecting_balls(const Tr& tr,
@ -137,7 +138,7 @@ void
Triangulation_helpers<Tr>:: Triangulation_helpers<Tr>::
move_point(Tr& tr, move_point(Tr& tr,
const Vertex_handle& v, const Vertex_handle& v,
const Bare_point& p) const const Weighted_point& p) const
{ {
if ( no_topological_change(tr, v, p) ) if ( no_topological_change(tr, v, p) )
v->set_point(p); v->set_point(p);
@ -153,12 +154,12 @@ bool
Triangulation_helpers<Tr>:: Triangulation_helpers<Tr>::
no_topological_change(const Tr& tr, no_topological_change(const Tr& tr,
const Vertex_handle& v0, const Vertex_handle& v0,
const Bare_point& p, const Weighted_point& 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(); Tr::Geom_traits::Construct_point_3 wp2p = tr.geom_traits().construct_point_3_object();
bool np = true; bool np = true;
Bare_point fp = wp2p(v0->point()); const Weighted_point& fp = v0->point();
v0->set_point(p); v0->set_point(p);
if(!well_oriented(tr, cells_tos)) if(!well_oriented(tr, cells_tos))
@ -222,7 +223,7 @@ Triangulation_helpers<Tr>::
no_topological_change__without_set_point( no_topological_change__without_set_point(
const Tr& tr, const Tr& tr,
const Vertex_handle& v0, const Vertex_handle& v0,
const Bare_point& p, const Weighted_point& p,
Cell_vector& cells_tos) const Cell_vector& cells_tos) const
{ {
bool np = true; bool np = true;
@ -311,7 +312,7 @@ bool
Triangulation_helpers<Tr>:: Triangulation_helpers<Tr>::
no_topological_change(const Tr& tr, no_topological_change(const Tr& tr,
const Vertex_handle& v0, const Vertex_handle& v0,
const Bare_point& p) const const Weighted_point& p) const
{ {
Cell_vector cells_tos; Cell_vector cells_tos;
cells_tos.reserve(64); cells_tos.reserve(64);
@ -325,7 +326,7 @@ Triangulation_helpers<Tr>::
no_topological_change__without_set_point( no_topological_change__without_set_point(
const Tr& tr, const Tr& tr,
const Vertex_handle& v0, const Vertex_handle& v0,
const Bare_point& p) const const Weighted_point& p) const
{ {
Cell_vector cells_tos; Cell_vector cells_tos;
cells_tos.reserve(64); cells_tos.reserve(64);

View File

@ -445,6 +445,7 @@ protected:
typedef typename C3T3::Triangulation::Geom_traits Gt; typedef typename C3T3::Triangulation::Geom_traits Gt;
typedef typename Gt::FT FT; typedef typename Gt::FT FT;
typedef typename C3T3::Triangulation::Bare_point Bare_point; typedef typename C3T3::Triangulation::Bare_point Bare_point;
typedef typename C3T3::Triangulation::Weighted_point Weighted_point;
typedef Triangulation_helpers<typename C3T3::Triangulation> Th; typedef Triangulation_helpers<typename C3T3::Triangulation> Th;
typename Gt::Compute_squared_length_3 sq_length = typename Gt::Compute_squared_length_3 sq_length =
@ -456,6 +457,9 @@ protected:
typename Gt::Construct_point_3 wp2p = typename Gt::Construct_point_3 wp2p =
Gt().construct_point_3_object(); Gt().construct_point_3_object();
typename Gt::Construct_weighted_point_3 p2wp =
Gt().construct_weighted_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);
@ -466,8 +470,8 @@ protected:
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));
Bare_point new_loc = translate(wp2p(v->point()), step_length * gradient_vector); Bare_point new_loc = translate(wp2p(v->point()), step_length * gradient_vector);
Bare_point final_loc = new_loc; Bare_point final_loc = new_loc;
if ( c3t3.in_dimension(v) < 3 ) if ( c3t3.in_dimension(v) < 3 )
final_loc = helper.project_on_surface(new_loc, v); final_loc = helper.project_on_surface(new_loc, v);
@ -477,7 +481,7 @@ protected:
if (could_lock_zone) if (could_lock_zone)
{ {
while(Th().no_topological_change__without_set_point(c3t3.triangulation(), while(Th().no_topological_change__without_set_point(c3t3.triangulation(),
v, final_loc) v, p2wp(final_loc))
&& (++i <= max_step_nb_) ) && (++i <= max_step_nb_) )
{ {
new_loc = translate(new_loc, step_length * gradient_vector); new_loc = translate(new_loc, step_length * gradient_vector);
@ -490,7 +494,7 @@ protected:
} }
else else
{ {
while( Th().no_topological_change(c3t3.triangulation(), v, final_loc) while( Th().no_topological_change(c3t3.triangulation(), v, p2wp(final_loc))
&& (++i <= max_step_nb_) ) && (++i <= max_step_nb_) )
{ {
new_loc = translate(new_loc, step_length * gradient_vector); new_loc = translate(new_loc, step_length * gradient_vector);
@ -508,7 +512,7 @@ protected:
return std::make_pair(false,v); return std::make_pair(false,v);
// we know that there will be a combinatorial change // we know that there will be a combinatorial change
return helper.update_mesh_topo_change(final_loc, return helper.update_mesh_topo_change(p2wp(final_loc),
v, v,
criterion, criterion,
std::back_inserter(modified_vertices), std::back_inserter(modified_vertices),
@ -1255,9 +1259,12 @@ private:
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_weighted_point_3 p2wp =
Gt().construct_weighted_point_3_object();
modified_vertices.clear(); modified_vertices.clear();
// Create an 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);
@ -1291,7 +1298,7 @@ private:
// try to move vertex // try to move vertex
std::vector<Vertex_handle> tmp_mod_vertices; std::vector<Vertex_handle> tmp_mod_vertices;
std::pair<bool,Vertex_handle> update = std::pair<bool,Vertex_handle> update =
helper.update_mesh(new_location, helper.update_mesh(p2wp(new_location),
moving_vertex, moving_vertex,
criterion, criterion,
std::back_inserter(tmp_mod_vertices), std::back_inserter(tmp_mod_vertices),

View File

@ -123,11 +123,46 @@ public:
return f(p0, p1); return f(p0, p1);
} }
typename cpp11::result_of< Functor(Point_3,Point_3, Point_3) >::type operator() (const Point_3& p0, const Point_3& p1, const Point_3& p2) const
{
return f(p0, p1, p2);
}
typename cpp11::result_of< Functor(Point_3,Point_3, Point_3,Point_3) >::type operator() (const Point_3& p0, const Point_3& p1, const Point_3& p2, const Point_3& p3) const
{
return f(p0, p1, p2, p3);
}
typename cpp11::result_of< Functor(Point_3,Origin) >::type operator() (const Point_3& p0, const Origin& o) const
{
return f(p0, o);
}
typename cpp11::result_of< Functor(Point_3,Origin) >::type operator() (const Origin& o, const Point_3& p0) const
{
return f(o, p0);
}
typename cpp11::result_of< Functor(Plane_3,Point_3) >::type operator() (const Plane_3& pl, const Point_3& p) const
{
return f(pl, p);
}
typename cpp11::result_of< Functor(Point_3,Point_3) >::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1) const 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));
} }
typename cpp11::result_of< Functor(Point_3,Point_3) >::type operator() (const Point_3& p0, const Weighted_point_3& p1) const
{
return f(p0, cp(p1));
}
typename cpp11::result_of< Functor(Point_3,Point_3) >::type operator() (const Weighted_point_3& p0, const Point_3& p1) const
{
return f(cp(p0), p1);
}
typename cpp11::result_of<Functor(Plane_3,Point_3)>::type operator() (const Plane_3& p0, const Weighted_point_3& p1) const 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)); return f(p0, cp(p1));

View File

@ -550,6 +550,27 @@ namespace CGAL {
public: public:
Cell_handle locate(const Bare_point& bp) const
{
return this->locate(geom_traits().construct_weighted_point_3_object()(bp));
}
Cell_handle locate(const Bare_point& bp, Locate_type & lt, int & li, int & lj,
Cell_handle start = Cell_handle()) const
{
return this->locate(geom_traits().construct_weighted_point_3_object()(bp),
lt, li, lj, start);
}
Cell_handle locate(const Bare_point& bp, Locate_type & lt, int & li, int & lj,
Vertex_handle start) const
{
return this->locate(geom_traits().construct_weighted_point_3_object()(bp),
lt, li, lj, start);
}
#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO #ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
template < class InputIterator > template < class InputIterator >
std::ptrdiff_t std::ptrdiff_t
@ -791,6 +812,11 @@ namespace CGAL {
Vertex_handle insert(const Weighted_point & p, Locate_type lt, Vertex_handle insert(const Weighted_point & p, Locate_type lt,
Cell_handle c, int li, int, bool *could_lock_zone = NULL); Cell_handle c, int li, int, bool *could_lock_zone = NULL);
Vertex_handle insert(const Bare_point & p)
{
return insert(geom_traits().construct_weighted_point_3_object()(p, typename Geom_traits::FT(0)));
}
template <class CellIt> template <class CellIt>
Vertex_handle Vertex_handle
insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end, insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,