quick mael review

This commit is contained in:
Dmitry Anisimov 2021-06-08 13:36:09 +02:00
parent a4b645a6ad
commit cac04ed149
9 changed files with 45 additions and 58 deletions

View File

@ -392,14 +392,11 @@ private:
const FT cotan_k = CGAL::Weights::cotangent(p_j, p_k, p_i, traits); const FT cotan_k = CGAL::Weights::cotangent(p_j, p_k, p_i, traits);
const Vector_3& a = m_X[face_i]; const Vector_3& a = m_X[face_i];
const double i_entry = const double i_entry = (CGAL::to_double(scalar_product(a, v_ij) * cotan_k)) +
(CGAL::to_double(scalar_product(a, v_ij) * cotan_k)) +
(CGAL::to_double(scalar_product(a, v_ik) * cotan_j)); (CGAL::to_double(scalar_product(a, v_ik) * cotan_j));
const double j_entry = const double j_entry = (CGAL::to_double(scalar_product(a, v_jk) * cotan_i)) +
(CGAL::to_double(scalar_product(a, v_jk) * cotan_i)) +
(CGAL::to_double(scalar_product(a, v_ji) * cotan_k)); (CGAL::to_double(scalar_product(a, v_ji) * cotan_k));
const double k_entry = const double k_entry = (CGAL::to_double(scalar_product(a, v_ki) * cotan_j)) +
(CGAL::to_double(scalar_product(a, v_ki) * cotan_j)) +
(CGAL::to_double(scalar_product(a, v_kj) * cotan_i)); (CGAL::to_double(scalar_product(a, v_kj) * cotan_i));
indexD.add_coef(i, 0, (1./2)*i_entry); indexD.add_coef(i, 0, (1./2)*i_entry);

View File

@ -449,8 +449,7 @@ private:
const Point_3& position_vj = get(ppmap, vj); const Point_3& position_vj = get(ppmap, vj);
const Point_3& position_vk = get(ppmap, vk); const Point_3& position_vk = get(ppmap, vk);
const NT cot = CGAL::Weights:: const NT cot = CGAL::Weights::cotangent(position_vi, position_vj, position_vk);
cotangent(position_vi, position_vj, position_vk);
put(ctmap, hd, cot); put(ctmap, hd, cot);
} }

View File

@ -180,15 +180,14 @@ protected:
const Point_3& position_v_j = get(ppmap, *neighbor_vertex_v_j); const Point_3& position_v_j = get(ppmap, *neighbor_vertex_v_j);
vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j; vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j;
previous_vertex_v_k--; --previous_vertex_v_k;
const Point_3& position_v_k = get(ppmap, *previous_vertex_v_k); const Point_3& position_v_k = get(ppmap, *previous_vertex_v_k);
vertex_around_target_circulator next_vertex_v_l = neighbor_vertex_v_j; vertex_around_target_circulator next_vertex_v_l = neighbor_vertex_v_j;
next_vertex_v_l++; ++next_vertex_v_l;
const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); const Point_3& position_v_l = get(ppmap, *next_vertex_v_l);
return CGAL::Weights::authalic_weight( return CGAL::Weights::authalic_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
} }
}; };

View File

@ -176,15 +176,14 @@ protected:
const Point_3& position_v_j = get(ppmap, *neighbor_vertex_v_j); const Point_3& position_v_j = get(ppmap, *neighbor_vertex_v_j);
vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j; vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j;
previous_vertex_v_k--; --previous_vertex_v_k;
const Point_3& position_v_k = get(ppmap, *previous_vertex_v_k); const Point_3& position_v_k = get(ppmap, *previous_vertex_v_k);
vertex_around_target_circulator next_vertex_v_l = neighbor_vertex_v_j; vertex_around_target_circulator next_vertex_v_l = neighbor_vertex_v_j;
next_vertex_v_l++; ++next_vertex_v_l;
const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); const Point_3& position_v_l = get(ppmap, *next_vertex_v_l);
return CGAL::Weights::cotangent_weight( return CGAL::Weights::cotangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
} }
}; };

View File

@ -636,29 +636,27 @@ private:
Vertex_around_target_circulator<Triangle_mesh> neighbor_vertex_v_j) const Vertex_around_target_circulator<Triangle_mesh> neighbor_vertex_v_j) const
{ {
const PPM ppmap = get(vertex_point, tmesh); const PPM ppmap = get(vertex_point, tmesh);
const Point_3& position_v_i = get(ppmap, main_vertex_v_i); const PPM_ref position_v_i = get(ppmap, main_vertex_v_i);
const Point_3& position_v_j = get(ppmap, *neighbor_vertex_v_j); const PPM_ref position_v_j = get(ppmap, *neighbor_vertex_v_j);
const Vector_3 edge = position_v_i - position_v_j; const Vector_3 edge = position_v_i - position_v_j;
const NT squared_length = edge * edge; const NT squared_length = edge * edge;
vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j; vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j;
previous_vertex_v_k--; --previous_vertex_v_k;
const Point_3& position_v_k = get(ppmap, *previous_vertex_v_k); const PPM_ref position_v_k = get(ppmap, *previous_vertex_v_k);
vertex_around_target_circulator next_vertex_v_l = neighbor_vertex_v_j; vertex_around_target_circulator next_vertex_v_l = neighbor_vertex_v_j;
next_vertex_v_l++; ++next_vertex_v_l;
const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); const PPM_ref position_v_l = get(ppmap, *next_vertex_v_l);
NT weight = NT(0); NT weight = NT(0);
CGAL_assertion(squared_length > NT(0)); // two points are identical! CGAL_assertion(squared_length > NT(0)); // two points are identical!
if(squared_length != NT(0)) { if(squared_length != NT(0)) {
// This version was commented out to be an alternative weight // This version was commented out to be an alternative weight
// in the original code by authors. // in the original code by authors.
// weight = CGAL::Weights::authalic_weight( // weight = CGAL::Weights::authalic_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
// position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); weight = CGAL::Weights::cotangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
weight = CGAL::Weights::cotangent_weight(
position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
} }
return weight; return weight;
} }

View File

@ -393,8 +393,7 @@ private:
const Point_2& p = pk; const Point_2& p = pk;
const Point_2& q = pi; const Point_2& q = pi;
const Point_2& r = pj; const Point_2& r = pj;
const CGAL::Weights::internal:: const CGAL::Weights::internal::Tangent_weight_wrapper<NT> tangent_weight(p, q, r);
Tangent_weight_wrapper<NT> tangent_weight(p, q, r);
// Set w_ij in matrix // Set w_ij in matrix
const NT w_ij = tangent_weight.get_w_r(); const NT w_ij = tangent_weight.get_w_r();

View File

@ -199,15 +199,14 @@ protected:
const Point_3& position_v_j = get(ppmap, *neighbor_vertex_v_j); const Point_3& position_v_j = get(ppmap, *neighbor_vertex_v_j);
vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j; vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j;
previous_vertex_v_k--; --previous_vertex_v_k;
const Point_3& position_v_k = get(ppmap, *previous_vertex_v_k); const Point_3& position_v_k = get(ppmap, *previous_vertex_v_k);
vertex_around_target_circulator next_vertex_v_l = neighbor_vertex_v_j; vertex_around_target_circulator next_vertex_v_l = neighbor_vertex_v_j;
next_vertex_v_l++; ++next_vertex_v_l;
const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); const Point_3& position_v_l = get(ppmap, *next_vertex_v_l);
return CGAL::Weights::tangent_weight( return CGAL::Weights::tangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
position_v_k, position_v_j, position_v_l, position_v_i) / NT(2);
} }
}; };

View File

@ -722,8 +722,7 @@ private:
const Point_3& p = pk; const Point_3& p = pk;
const Point_3& q = pi; const Point_3& q = pi;
const Point_3& r = pj; const Point_3& r = pj;
const CGAL::Weights::internal:: const CGAL::Weights::internal::Tangent_weight_wrapper<NT> tangent_weight(p, q, r);
Tangent_weight_wrapper<NT> tangent_weight(p, q, r);
// Set w_ij in matrix // Set w_ij in matrix
const NT w_ij = tangent_weight.get_w_r(); const NT w_ij = tangent_weight.get_w_r();

View File

@ -223,8 +223,7 @@ public:
typedef typename boost::graph_traits<mTriangleMesh>::edge_iterator edge_iterator; typedef typename boost::graph_traits<mTriangleMesh>::edge_iterator edge_iterator;
// Get weight from the weight interface. // Get weight from the weight interface.
typedef CGAL::Weights::internal:: typedef CGAL::Weights::internal::Cotangent_weight_wrapper<mTriangleMesh> Weight_calculator;
Cotangent_weight_wrapper<mTriangleMesh> Weight_calculator;
typedef internal::Curve_skeleton<mTriangleMesh, typedef internal::Curve_skeleton<mTriangleMesh,
VertexIndexMap, VertexIndexMap,
@ -372,14 +371,14 @@ public:
Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh, Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh,
VertexPointMap vertex_point_map, VertexPointMap vertex_point_map,
const Traits& traits = Traits()) const Traits& traits = Traits())
: m_traits(traits), m_weight_calculator(true) : m_traits(traits), m_weight_calculator(true /* use_secure_version */)
{ {
init(tmesh, vertex_point_map); init(tmesh, vertex_point_map);
} }
Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh, Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh,
const Traits& traits = Traits()) const Traits& traits = Traits())
: m_traits(traits), m_weight_calculator(true) : m_traits(traits), m_weight_calculator(true /* use_secure_version */)
{ {
init(tmesh); init(tmesh);
} }
@ -887,8 +886,7 @@ private:
m_edge_weight.reserve(2 * num_edges(m_tmesh)); m_edge_weight.reserve(2 * num_edges(m_tmesh));
for(halfedge_descriptor hd : halfedges(m_tmesh)) for(halfedge_descriptor hd : halfedges(m_tmesh))
{ {
m_edge_weight.push_back( m_edge_weight.push_back(m_weight_calculator(hd, m_tmesh, m_tmesh_point_pmap));
m_weight_calculator(hd, m_tmesh, m_tmesh_point_pmap));
} }
} }