mirror of https://github.com/CGAL/cgal
compute distances in a canonical order to make ODT deterministic
This commit is contained in:
parent
f4ae054d81
commit
44fa8f7a93
|
|
@ -26,6 +26,8 @@
|
|||
#ifndef CGAL_MESH_3_MESH_SIZING_FIELD_H
|
||||
#define CGAL_MESH_3_MESH_SIZING_FIELD_H
|
||||
|
||||
#include <CGAL/Mesh_3/comparison_operators.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Mesh_3
|
||||
|
|
@ -44,6 +46,8 @@ class Mesh_sizing_field
|
|||
|
||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||
typedef typename Tr::Cell_handle Cell_handle;
|
||||
|
||||
typedef typename CGAL::Mesh_3::Vertex_handle_comparator<Vertex_handle> Vcomp;
|
||||
|
||||
public:
|
||||
// update vertices of mesh triangulation ?
|
||||
|
|
@ -171,12 +175,18 @@ operator()(const Point_3&, const std::pair<Cell_handle,bool>& c) const
|
|||
{
|
||||
// Assumes that p is the centroid of c
|
||||
const Cell_handle& cell = c.first;
|
||||
|
||||
std::vector<Vertex_handle> v;
|
||||
v.push_back(cell->vertex(0));
|
||||
v.push_back(cell->vertex(1));
|
||||
v.push_back(cell->vertex(2));
|
||||
v.push_back(cell->vertex(3));
|
||||
std::sort(v.begin(), v.end(), Vcomp());
|
||||
|
||||
// Interpolate value using tet vertices values
|
||||
const FT& va = cell->vertex(0)->meshing_info();
|
||||
const FT& vb = cell->vertex(1)->meshing_info();
|
||||
const FT& vc = cell->vertex(2)->meshing_info();
|
||||
const FT& vd = cell->vertex(3)->meshing_info();
|
||||
const FT& va = v[0]->meshing_info();
|
||||
const FT& vb = v[1]->meshing_info();
|
||||
const FT& vc = v[2]->meshing_info();
|
||||
const FT& vd = v[3]->meshing_info();
|
||||
|
||||
return ( (va+vb+vc+vd)/4 );
|
||||
}
|
||||
|
|
@ -190,16 +200,23 @@ interpolate_on_cell_vertices(const Point_3& p, const Cell_handle& cell) const
|
|||
typename Gt::Compute_volume_3 volume =
|
||||
Gt().compute_volume_3_object();
|
||||
|
||||
std::vector<Vertex_handle> v;
|
||||
v.push_back(cell->vertex(0));
|
||||
v.push_back(cell->vertex(1));
|
||||
v.push_back(cell->vertex(2));
|
||||
v.push_back(cell->vertex(3));
|
||||
std::sort(v.begin(), v.end(), Vcomp());
|
||||
|
||||
// Interpolate value using tet vertices values
|
||||
const FT& va = cell->vertex(0)->meshing_info();
|
||||
const FT& vb = cell->vertex(1)->meshing_info();
|
||||
const FT& vc = cell->vertex(2)->meshing_info();
|
||||
const FT& vd = cell->vertex(3)->meshing_info();
|
||||
const FT& va = v[0]->meshing_info();
|
||||
const FT& vb = v[1]->meshing_info();
|
||||
const FT& vc = v[2]->meshing_info();
|
||||
const FT& vd = v[3]->meshing_info();
|
||||
|
||||
const Point_3& a = cell->vertex(0)->point();
|
||||
const Point_3& b = cell->vertex(1)->point();
|
||||
const Point_3& c = cell->vertex(2)->point();
|
||||
const Point_3& d = cell->vertex(3)->point();
|
||||
const Point_3& a = v[0]->point();
|
||||
const Point_3& b = v[1]->point();
|
||||
const Point_3& c = v[2]->point();
|
||||
const Point_3& d = v[3]->point();
|
||||
|
||||
const FT abcp = CGAL::abs(volume(a,b,c,p));
|
||||
const FT abdp = CGAL::abs(volume(a,d,b,p));
|
||||
|
|
|
|||
Loading…
Reference in New Issue