From c9a331ec192e37b4c949768d0f738f48ae7d3497 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 13 Apr 2021 10:18:06 +0200 Subject: [PATCH] Fix more conversion warnings --- .../include/CGAL/linear_least_squares_fitting_circles_2.h | 2 +- .../CGAL/linear_least_squares_fitting_rectangles_2.h | 4 ++-- .../include/CGAL/linear_least_squares_fitting_triangles_2.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h index 715f76cd0d0..c0698acc85f 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_circles_2.h @@ -241,7 +241,7 @@ linear_least_squares_fitting_2(InputIterator first, // isotropic case (infinite number of directions) // by default: assemble a line that goes through // the centroid and with a default horizontal vector. - line = Line(c, Vector(1.0, 0.0)); + line = Line(c, Vector(FT(1), FT(0))); return (FT)0.0; } } // end linear_least_squares_fitting_2 for circle set with 1D tag diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h index c3d8c2602f7..7fec0fea638 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_rectangles_2.h @@ -101,8 +101,8 @@ linear_least_squares_fitting_2(InputIterator first, transformation = area * transformation * moment * LA::transpose(transformation); // Translate the 2nd order moment to the center of the rectangle. - FT xav0 = (x1-x0)/2.0; - FT yav0 = (y2-y0)/2.0; + FT xav0 = (x1-x0)/FT(2); + FT yav0 = (y2-y0)/FT(2); // and add to covariance matrix covariance[0] += transformation[0][0] + area * (x0*xav0*2 + x0*x0); covariance[1] += transformation[0][1] + area * (x0*yav0 + xav0*y0 + x0*y0); diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h index 15843aa40fb..61857a079e8 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_triangles_2.h @@ -88,7 +88,7 @@ linear_least_squares_fitting_2(InputIterator first, t[1].y() - y0, t[2].y() - y0}; Matrix transformation = init_matrix(2,delta); - FT area = 0.5 * CGAL::abs(LA::determinant(transformation)); + FT area = FT(0.5) * CGAL::abs(LA::determinant(transformation)); CGAL_assertion(area!=0); // Find the 2nd order moment for the triangle wrt to the origin by an affine transformation. @@ -97,8 +97,8 @@ linear_least_squares_fitting_2(InputIterator first, transformation = 2 * area * transformation * moment * LA::transpose(transformation); // Translate the 2nd order moment to (x0,y0). - FT xav0 = (delta[0]+delta[1])/3.0; - FT yav0 = (delta[2]+delta[3])/3.0; + FT xav0 = (delta[0]+delta[1])/FT(3); + FT yav0 = (delta[2]+delta[3])/FT(3); // and add to the covariance matrix covariance[0] += transformation[0][0] + area * (x0*xav0*2 + x0*x0);