Fixed const correctness in SMP

This commit is contained in:
Mael Rouxel-Labbé 2016-11-09 14:09:23 +01:00
parent 62979fc9b5
commit b17c60f4d8
10 changed files with 29 additions and 27 deletions

View File

@ -52,7 +52,7 @@ Error_code parameterize_border(const TriangleMesh& mesh);
Indicate if the shape is convex.
*/
bool is_border_convex();
bool is_border_convex() const;
/// @}

View File

@ -123,7 +123,7 @@ protected:
/// Compute w_ij = (i,j), coefficient of matrix A for j neighbor vertex of i.
virtual NT compute_w_ij(const TriangleMesh& /* mesh */,
vertex_descriptor /* main_vertex_v_i */,
vertex_around_target_circulator /* neighbor_vertex_v_j */ )
vertex_around_target_circulator /* neighbor_vertex_v_j */ ) const
{
/// In the Tutte Barycentric Mapping algorithm, we have w_ij = 1,
/// for j neighbor vertex of i.

View File

@ -83,12 +83,13 @@ private:
protected:
virtual double compute_edge_length(const TriangleMesh& mesh,
vertex_descriptor source,
vertex_descriptor target) = 0;
vertex_descriptor target) const = 0;
// Private operations
private:
/// Compute the total length of the border
double compute_border_length(const TriangleMesh& mesh, halfedge_descriptor bhd)
double compute_border_length(const TriangleMesh& mesh,
halfedge_descriptor bhd) const
{
double len = 0.0;
BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_face(bhd, mesh)) {
@ -140,7 +141,7 @@ public:
}
/// Indicate if border's shape is convex.
bool is_border_convex() { return true; }
bool is_border_convex() const { return true; }
};
//
@ -180,7 +181,7 @@ protected:
/// Compute the length of an edge.
virtual double compute_edge_length(const TriangleMesh& /* mesh */,
vertex_descriptor /* source */,
vertex_descriptor /* target */)
vertex_descriptor /* target */) const
{
/// Uniform border parameterization: points are equally spaced.
return 1.;
@ -230,7 +231,7 @@ protected:
/// Compute the length of an edge.
virtual double compute_edge_length(const TriangleMesh& mesh,
vertex_descriptor source,
vertex_descriptor target)
vertex_descriptor target) const
{
VPM ppmap = get(vertex_point, mesh);

View File

@ -135,7 +135,7 @@ protected:
/// \param neighbor_vertex_v_j the vertex of `mesh` with index `j`
virtual NT compute_w_ij(const TriangleMesh& mesh,
vertex_descriptor main_vertex_v_i,
vertex_around_target_circulator neighbor_vertex_v_j)
vertex_around_target_circulator neighbor_vertex_v_j) const
{
typedef typename Parameterizer_traits_3<TriangleMesh>::VPM PPmap;
PPmap ppmap = get(vertex_point, mesh);

View File

@ -133,7 +133,7 @@ protected:
/// \param neighbor_vertex_v_j the vertex of `mesh` with index `j`
virtual NT compute_w_ij(const TriangleMesh& mesh,
vertex_descriptor main_vertex_v_i,
vertex_around_target_circulator neighbor_vertex_v_j) // its target is main_vertex_v_i
vertex_around_target_circulator neighbor_vertex_v_j) const // its target is main_vertex_v_i
{
typedef typename Parameterizer_traits_3<TriangleMesh>::VPM PPmap;
PPmap ppmap = get(vertex_point, mesh);

View File

@ -201,7 +201,7 @@ protected:
const TriangleMesh& mesh,
halfedge_descriptor bhd,
VertexUVmap uvmap,
VertexIndexMap vimap)
VertexIndexMap vimap) const
{
BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_face(bhd, mesh)){
// Get vertex index in sparse linear system
@ -224,7 +224,7 @@ protected:
/// \param neighbor_vertex_v_j the vertex of `mesh` with index `j`
virtual NT compute_w_ij(const TriangleMesh& mesh,
vertex_descriptor main_vertex_v_i,
vertex_around_target_circulator neighbor_vertex_v_j)
vertex_around_target_circulator neighbor_vertex_v_j) const
= 0;
/// Compute the line i of matrix A for i inner vertex:
@ -242,7 +242,7 @@ protected:
Vector&,
const TriangleMesh& mesh,
vertex_descriptor vertex,
VertexIndexMap vimap)
VertexIndexMap vimap) const
{
int i = get(vimap,vertex);

View File

@ -251,7 +251,7 @@ private:
const TriangleMesh& mesh,
UVmap uvmap,
VertexIndexMap vimap,
VertexParameterizedMap vpmap)
VertexParameterizedMap vpmap) const
{
BOOST_FOREACH(vertex_descriptor v, vertices(mesh)){
// Get vertex index in sparse linear system
@ -278,7 +278,7 @@ private:
/// Computes the coordinates of the vertices of a triangle
/// in a local 2D orthonormal basis of the triangle's plane.
void project_triangle(const Point_3& p0, const Point_3& p1, const Point_3& p2, // in
Point_2& z0, Point_2& z1, Point_2& z2); // out
Point_2& z0, Point_2& z1, Point_2& z2) const; // out
/// Create two lines in the linear system per triangle (one for u, one for v).
///
@ -287,7 +287,7 @@ private:
Error_code setup_triangle_relations(LeastSquaresSolver& solver,
const TriangleMesh& mesh,
face_descriptor facet,
VertexIndexMap vimap);
VertexIndexMap vimap) const;
// Private accessors
private:
@ -314,7 +314,7 @@ inline
void
LSCM_parameterizer_3<TriangleMesh, Border_param, Sparse_LA>::
project_triangle(const Point_3& p0, const Point_3& p1, const Point_3& p2, // in
Point_2& z0, Point_2& z1, Point_2& z2) // out
Point_2& z0, Point_2& z1, Point_2& z2) const // out
{
Vector_3 X = p1 - p0;
NT X_norm = std::sqrt(X * X);
@ -359,7 +359,7 @@ LSCM_parameterizer_3<TriangleMesh, Border_param, Sparse_LA>::
setup_triangle_relations(LeastSquaresSolver& solver,
const TriangleMesh& mesh,
face_descriptor facet,
VertexIndexMap vimap)
VertexIndexMap vimap) const
{
typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::const_type PPmap;
PPmap ppmap = get(vertex_point, mesh);

View File

@ -138,7 +138,7 @@ protected:
/// \param neighbor_vertex_v_j the vertex of `mesh` with index `j`
virtual NT compute_w_ij(const TriangleMesh& mesh,
vertex_descriptor main_vertex_v_i,
vertex_around_target_circulator neighbor_vertex_v_j)
vertex_around_target_circulator neighbor_vertex_v_j) const
{
typedef typename Parameterizer_traits_3<TriangleMesh>::VPM PPmap;

View File

@ -99,12 +99,13 @@ private:
protected:
virtual double compute_edge_length(const TriangleMesh& mesh,
vertex_descriptor source,
vertex_descriptor target) = 0;
vertex_descriptor target) const = 0;
// Private operations
private:
/// Compute the total length of the border.
double compute_border_length(const TriangleMesh& mesh, halfedge_descriptor bhd)
double compute_border_length(const TriangleMesh& mesh,
halfedge_descriptor bhd) const
{
double len = 0.0;
BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_face(bhd, mesh)) {
@ -118,7 +119,7 @@ private:
halfedge_around_face_iterator closest_iterator(const TriangleMesh& mesh,
halfedge_descriptor bhd,
Offset_map& offset,
double value)
double value) const
{
halfedge_around_face_iterator b, e, best;
double min = DBL_MAX; // distance for 'best'
@ -145,7 +146,7 @@ private:
Error_code set_default_corners(const TriangleMesh& mesh,
halfedge_descriptor bhd,
VertexParameterizedMap vpmap,
Offset_map& offset)
Offset_map& offset) const
{
// map to [0,4[
double len = 0.0; // current position on square in [0, total_len[
@ -197,7 +198,7 @@ private:
halfedge_descriptor bhd,
VertexParameterizedMap vpmap,
const char* filename,
Offset_map& offset)
Offset_map& offset) const
{
assert(offset.empty());
@ -352,7 +353,7 @@ public:
}
/// Indicate if the border's shape is convex.
bool is_border_convex() { return true; }
bool is_border_convex() const { return true; }
};
//
@ -392,7 +393,7 @@ protected:
/// Compute the length of an edge.
virtual double compute_edge_length(const TriangleMesh& /* mesh */,
vertex_descriptor /* source */,
vertex_descriptor /* target */)
vertex_descriptor /* target */) const
{
/// Uniform border parameterization: points are equally spaced.
return 1;
@ -440,7 +441,7 @@ protected:
/// Compute the length of an edge.
virtual double compute_edge_length(const TriangleMesh& mesh,
vertex_descriptor source,
vertex_descriptor target)
vertex_descriptor target) const
{
VPM ppmap = get(vertex_point, mesh);

View File

@ -258,7 +258,7 @@ public:
/// Indicate if the border's shape is convex.
/// Meaningless for free border parameterization algorithms.
bool is_border_convex() { return false; }
bool is_border_convex() const { return false; }
};
} // namespace CGAL