Merge pull request #6054 from janetournois/Mesh_3-uninitialized_warnings-GF

Mesh_3 - fix maybe uninitialized warning
This commit is contained in:
Laurent Rineau 2021-10-29 16:59:45 +02:00
commit aca24f489b
1 changed files with 12 additions and 10 deletions

View File

@ -1684,9 +1684,8 @@ private:
/** /**
* Returns the least square plane from v, using adjacent surface points * Returns the least square plane from v, using adjacent surface points
*/ */
boost::optional<Plane_3> std::pair<boost::optional<Plane_3>, Bare_point>
get_least_square_surface_plane(const Vertex_handle& v, get_least_square_surface_plane(const Vertex_handle& v,
Bare_point& ref_point,
Surface_patch_index index = Surface_patch_index()) const; Surface_patch_index index = Surface_patch_index()) const;
/** /**
@ -3414,10 +3413,10 @@ project_on_surface_aux(const Bare_point& p,
template <typename C3T3, typename MD> template <typename C3T3, typename MD>
boost::optional<typename C3T3_helpers<C3T3,MD>::Plane_3> std::pair<boost::optional<typename C3T3_helpers<C3T3,MD>::Plane_3>,
typename C3T3_helpers<C3T3, MD>::Bare_point>
C3T3_helpers<C3T3,MD>:: C3T3_helpers<C3T3,MD>::
get_least_square_surface_plane(const Vertex_handle& v, get_least_square_surface_plane(const Vertex_handle& v,
Bare_point& reference_point,
Surface_patch_index patch_index) const Surface_patch_index patch_index) const
{ {
typedef typename C3T3::Triangulation::Triangle Triangle; typedef typename C3T3::Triangulation::Triangle Triangle;
@ -3467,7 +3466,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
// In some cases point is not a real surface point // In some cases point is not a real surface point
if ( triangles.empty() ) if ( triangles.empty() )
return boost::none; return std::make_pair(boost::none, Bare_point());
// Compute least square fitting plane // Compute least square fitting plane
Plane_3 plane; Plane_3 plane;
@ -3481,9 +3480,8 @@ get_least_square_surface_plane(const Vertex_handle& v,
tr_.geom_traits(), tr_.geom_traits(),
Default_diagonalize_traits<FT, 3>()); Default_diagonalize_traits<FT, 3>());
reference_point = ref_facet.first->get_facet_surface_center(ref_facet.second); return std::make_pair(plane,
ref_facet.first->get_facet_surface_center(ref_facet.second));
return plane;
} }
@ -3515,9 +3513,10 @@ project_on_surface_if_possible(const Vertex_handle& v,
typename Gt::Equal_3 equal = tr_.geom_traits().equal_3_object(); typename Gt::Equal_3 equal = tr_.geom_traits().equal_3_object();
// Get plane // Get plane
Bare_point reference_point; std::pair<boost::optional<Plane_3>, Bare_point> pl_rp
boost::optional<Plane_3> opt_plane = get_least_square_surface_plane(v, reference_point, index); = get_least_square_surface_plane(v, index);
boost::optional<Plane_3> opt_plane = pl_rp.first;
if(!opt_plane) return boost::none; if(!opt_plane) return boost::none;
// Project // Project
@ -3525,7 +3524,10 @@ project_on_surface_if_possible(const Vertex_handle& v,
if ( ! equal(p, cp(position)) ) if ( ! equal(p, cp(position)) )
return project_on_surface_aux(p, cp(position), opt_plane->orthogonal_vector()); return project_on_surface_aux(p, cp(position), opt_plane->orthogonal_vector());
else else
{
const Bare_point& reference_point = pl_rp.second;
return project_on_surface_aux(p, reference_point, opt_plane->orthogonal_vector()); return project_on_surface_aux(p, reference_point, opt_plane->orthogonal_vector());
}
} }