diff --git a/.clang-tidy b/.clang-tidy index b7f07abf900..6d45e7c27b6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: '-clang-diagnostic*,-clang-analyzer*,modernize-use-nullptr' +Checks: '-clang-diagnostic*,-clang-analyzer*,google-readability-casting' HeaderFilterRegex: 'CGAL/*' ... diff --git a/AABB_tree/demo/AABB_tree/Color_ramp.h b/AABB_tree/demo/AABB_tree/Color_ramp.h index c626c8ee99b..830ba38ead2 100644 --- a/AABB_tree/demo/AABB_tree/Color_ramp.h +++ b/AABB_tree/demo/AABB_tree/Color_ramp.h @@ -44,10 +44,10 @@ public : int x2 = m_nodes[i+1]; int y1 = m_colors[k][x1]; int y2 = m_colors[k][x2]; - float a = (float)(y2-y1) / (float)(x2-x1); - float b = (float)y1 - a*(float)x1; + float a = static_cast(y2-y1) / static_cast(x2-x1); + float b = static_cast(y1) - a*static_cast(x1); for(int j=x1;j(a*static_cast(j)+b); } } diff --git a/AABB_tree/demo/AABB_tree/MainWindow.cpp b/AABB_tree/demo/AABB_tree/MainWindow.cpp index 8b111b61f01..95fc4056bf7 100644 --- a/AABB_tree/demo/AABB_tree/MainWindow.cpp +++ b/AABB_tree/demo/AABB_tree/MainWindow.cpp @@ -153,9 +153,8 @@ void MainWindow::on_actionInside_points_triggered() { bool ok; - const unsigned int nb_points = (unsigned) - QInputDialog::getInt(nullptr, "#Points", - "#Points:",10000,1,100000000,9,&ok); + const unsigned int nb_points = static_cast(QInputDialog::getInt(nullptr, "#Points", + "#Points:",10000,1,100000000,9,&ok)); if(!ok) return; @@ -170,9 +169,8 @@ void MainWindow::on_actionPoints_in_interval_triggered() { bool ok; - const unsigned int nb_points = (unsigned) - QInputDialog::getInt(nullptr, "#Points", - "#Points:",10000,1,100000000,9,&ok); + const unsigned int nb_points = static_cast(QInputDialog::getInt(nullptr, "#Points", + "#Points:",10000,1,100000000,9,&ok)); if(!ok) return; @@ -198,9 +196,8 @@ void MainWindow::on_actionBoundary_segments_triggered() { bool ok; - const unsigned int nb_slices = (unsigned) - QInputDialog::getInt(nullptr, "#Slices", - "Slices:",100,1,1000000,8,&ok); + const unsigned int nb_slices = static_cast(QInputDialog::getInt(nullptr, "#Slices", + "Slices:",100,1,1000000,8,&ok)); if(!ok) return; @@ -215,9 +212,8 @@ void MainWindow::on_actionBoundary_points_triggered() { bool ok; - const unsigned int nb_points = (unsigned) - QInputDialog::getInt(nullptr, "#Points", - "Points:",1000,1,10000000,8,&ok); + const unsigned int nb_points = static_cast(QInputDialog::getInt(nullptr, "#Points", + "Points:",1000,1,10000000,8,&ok)); if(!ok) return; @@ -232,9 +228,8 @@ void MainWindow::on_actionEdge_points_triggered() { bool ok; - const unsigned int nb_points = (unsigned) - QInputDialog::getInt(nullptr, "#Points", - "Points:",1000,1,10000000,8,&ok); + const unsigned int nb_points = static_cast(QInputDialog::getInt(nullptr, "#Points", + "Points:",1000,1,10000000,8,&ok)); if(!ok) return; diff --git a/AABB_tree/demo/AABB_tree/Scene.cpp b/AABB_tree/demo/AABB_tree/Scene.cpp index 6ae939bfc38..793adcd71ef 100644 --- a/AABB_tree/demo/AABB_tree/Scene.cpp +++ b/AABB_tree/demo/AABB_tree/Scene.cpp @@ -43,7 +43,7 @@ Scene::Scene() // distance function m_red_ramp.build_red(); m_blue_ramp.build_blue(); - m_max_distance_function = (FT)0.0; + m_max_distance_function = static_cast(0.0); texture = new Texture(m_grid_size,m_grid_size); ready_to_cut = true; are_buffers_initialized = false; @@ -481,7 +481,7 @@ void Scene::compute_texture(int i, int j,Color_ramp pos_ramp ,Color_ramp neg_ram const FT& d00 = m_distance_function[i][j].second; // determines grey level - unsigned int i00 = 255-(unsigned)(255.0 * (double)std::fabs(d00) / m_max_distance_function); + unsigned int i00 = 255-static_cast(255.0 * std::fabs(d00) / m_max_distance_function); if(d00 > 0.0) texture->setData(i,j,pos_ramp.r(i00),pos_ramp.g(i00),pos_ramp.b(i00)); @@ -498,7 +498,7 @@ void Scene::attrib_buffers(CGAL::QGLViewer* viewer) viewer->camera()->getModelViewProjectionMatrix(mat); for(int i=0; i < 16; i++) { - mvpMatrix.data()[i] = (float)mat[i]; + mvpMatrix.data()[i] = static_cast(mat[i]); } rendering_program.bind(); mvpLocation = rendering_program.uniformLocation("mvp_matrix"); @@ -717,8 +717,8 @@ void Scene::draw(CGAL::QGLViewer* viewer) FT Scene::random_in(const double a, const double b) { - double r = rand() / (double)RAND_MAX; - return (FT)(a + (b - a) * r); + double r = rand() / static_cast(RAND_MAX); + return static_cast(a + (b - a) * r); } Point Scene::random_point(const CGAL::Bbox_3& bbox) @@ -890,7 +890,7 @@ void Scene::generate_points_in(const unsigned int nb_points, // measure sign Ray ray(p,vec); - int nb_intersections = (int)tree.number_of_intersected_primitives(ray); + int nb_intersections = static_cast(tree.number_of_intersected_primitives(ray)); if(nb_intersections % 2 != 0) signed_distance *= -1.0; @@ -903,7 +903,7 @@ void Scene::generate_points_in(const unsigned int nb_points, } nb_trials++; } - double speed = (double)nb_trials / timer.time(); + double speed = static_cast(nb_trials) / timer.time(); std::cout << "done (" << nb_trials << " trials, " << timer.time() << " s, " << speed << " queries/s)" << std::endl; @@ -937,7 +937,7 @@ void Scene::generate_inside_points(const unsigned int nb_points) { Point p = random_point(tree.bbox()); Ray ray(p,vec); - int nb_intersections = (int)tree.number_of_intersected_primitives(ray); + int nb_intersections = static_cast(tree.number_of_intersected_primitives(ray)); if(nb_intersections % 2 != 0) { m_points.push_back(p); @@ -946,7 +946,7 @@ void Scene::generate_inside_points(const unsigned int nb_points) } nb_trials++; } - double speed = (double)nb_trials / timer.time(); + double speed = static_cast(nb_trials) / timer.time(); std::cout << "done (" << nb_trials << " trials, " << timer.time() << " s, " << speed << " queries/s)" << std::endl; @@ -974,14 +974,14 @@ void Scene::generate_boundary_segments(const unsigned int nb_slices) timer.start(); std::cout << "Generate boundary segments from " << nb_slices << " slices: "; - Vector normal((FT)0.0,(FT)0.0,(FT)1.0); + Vector normal(static_cast(0.0),static_cast(0.0),static_cast(1.0)); unsigned int i; const double dz = m_bbox.zmax() - m_bbox.zmin(); for(i=0;i(i) / static_cast(nb_slices) * dz; + Point p(static_cast(0.0), static_cast(0.0), z); Plane plane(p,normal); std::list intersections; diff --git a/AABB_tree/demo/AABB_tree/benchmarks.cpp b/AABB_tree/demo/AABB_tree/benchmarks.cpp index 0b51ef6de2a..c337e43efe7 100644 --- a/AABB_tree/demo/AABB_tree/benchmarks.cpp +++ b/AABB_tree/demo/AABB_tree/benchmarks.cpp @@ -115,7 +115,7 @@ void Scene::bench_memory() Refiner refiner(m_pPolyhedron); std::size_t digits = nb_digits(m_pPolyhedron->size_of_facets()); unsigned int nb_splits = - static_cast(0.2 * std::pow(10.0,(double)digits - 1.0)); + static_cast(0.2 * std::pow(10.0,static_cast(digits) - 1.0)); refiner.run_nb_splits(nb_splits); // constructs tree and measure memory before then after @@ -126,8 +126,8 @@ void Scene::bench_memory() size_type after = CGAL::Memory_sizer().virtual_size(); size_type bytes = after - before; // in Bytes - double mbytes = (double)bytes / (double)1048576; // in MBytes - double bpp = (double)bytes / (double)m_pPolyhedron->size_of_facets(); + double mbytes = static_cast(bytes) / static_cast(1048576); // in MBytes + double bpp = static_cast(bytes) / static_cast(m_pPolyhedron->size_of_facets()); std::cout << m_pPolyhedron->size_of_facets() << ", " << bytes << ", " << mbytes << ", " @@ -152,7 +152,7 @@ void Scene::bench_construction() Refiner refiner(m_pPolyhedron); std::size_t digits = nb_digits(m_pPolyhedron->size_of_facets()); unsigned int nb_splits = - static_cast(0.2 * std::pow(10.0,(double)digits - 1.0)); + static_cast(0.2 * std::pow(10.0,static_cast(digits) - 1.0)); refiner.run_nb_splits(nb_splits); // constructs tree @@ -197,7 +197,7 @@ void Scene::bench_intersections_vs_nbt() Refiner refiner(m_pPolyhedron); std::size_t digits = nb_digits(m_pPolyhedron->size_of_facets()); unsigned int nb_splits = - static_cast(0.2 * std::pow(10.0,(double)digits - 1.0)); + static_cast(0.2 * std::pow(10.0,static_cast(digits) - 1.0)); refiner.run_nb_splits(nb_splits); // constructs tree (out of timing) @@ -210,7 +210,7 @@ void Scene::bench_intersections_vs_nbt() for(int i=0;i(static_cast(nb_queries) / duration); std::cout << m_pPolyhedron->size_of_facets() << ", " << speed << std::endl; } @@ -241,7 +241,7 @@ void Scene::bench_distances_vs_nbt() Refiner refiner(m_pPolyhedron); std::size_t digits = nb_digits(m_pPolyhedron->size_of_facets()); unsigned int nb_splits = - static_cast(0.2 * std::pow(10.0,(double)digits - 1.0)); + static_cast(0.2 * std::pow(10.0,static_cast(digits) - 1.0)); refiner.run_nb_splits(nb_splits); // constructs tree (out of timing) @@ -253,7 +253,7 @@ void Scene::bench_distances_vs_nbt() for(int i=0;i(static_cast(nb_queries) / duration); std::cout << m_pPolyhedron->size_of_facets() << ", " << speed << std::endl; } @@ -298,7 +298,7 @@ void Scene::bench_intersection(Facet_tree& tree, nb++; } - double speed = (double)nb / (double)timer.time(); + double speed = static_cast(nb) / timer.time(); std::cout << speed << " queries/s with " << query_name << std::endl; } @@ -340,7 +340,7 @@ void Scene::bench_distance(Facet_tree& tree, nb++; } - double speed = (double)nb / (double)timer.time(); + double speed = static_cast(nb) / timer.time(); std::cout << speed << " queries/s" << std::endl; } diff --git a/AABB_tree/test/AABB_tree/AABB_test_util.h b/AABB_tree/test/AABB_tree/AABB_test_util.h index 0d09ce81f42..f8f7c4d4461 100644 --- a/AABB_tree/test/AABB_tree/AABB_test_util.h +++ b/AABB_tree/test/AABB_tree/AABB_test_util.h @@ -33,7 +33,7 @@ double random_in(const double a, const double b) { - double r = rand() / (double)RAND_MAX; + double r = rand() / static_cast(RAND_MAX); return a + (b - a) * r; } @@ -165,7 +165,7 @@ void test_distance_speed(Tree& tree, (void) closest; nb++; } - double speed = (double)nb / timer.time(); + double speed = static_cast(nb) / timer.time(); std::cout << speed << " distance queries/s" << std::endl; timer.stop(); } diff --git a/AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp b/AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp index 49da548f08d..b683450cd03 100644 --- a/AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp @@ -79,7 +79,7 @@ void test_speed_for_query(const Tree& tree, } nb++; } - unsigned int speed = (unsigned int)(nb / timer.time()); + unsigned int speed = static_cast(nb / timer.time()); std::cout.precision(10); std::cout.width(15); std::cout << speed << " intersections/s with " << query_name << std::endl; diff --git a/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp b/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp index 55f275bbdd9..587e53cbe85 100644 --- a/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp +++ b/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp @@ -41,7 +41,7 @@ int main() { std::cout << "The approximate probability that 3 spheres with radius 1" << std::endl; std::cout << "chosen (uniformly) randomly on a 5x5x5 box intersect is: " - << ((double)count)/((double)(10000)) << std::endl; + << (static_cast(count))/(static_cast(10000)) << std::endl; return 0; } diff --git a/Classification/examples/Classification/gis_tutorial_example.cpp b/Classification/examples/Classification/gis_tutorial_example.cpp index fe90c423415..65bc65b0a2e 100644 --- a/Classification/examples/Classification/gis_tutorial_example.cpp +++ b/Classification/examples/Classification/gis_tutorial_example.cpp @@ -556,7 +556,7 @@ int main (int argc, char** argv) double height_ratio = (height_at_query - bbox.zmin()) / (bbox.zmax() - bbox.zmin()); colors = color_ramp.get(height_ratio); } - raster_ofile.write ((char*)(&colors), 3); + raster_ofile.write (reinterpret_cast(&colors), 3); } raster_ofile.close(); diff --git a/Classification/examples/Classification/include/Color_ramp.h b/Classification/examples/Classification/include/Color_ramp.h index b7e9b305262..a6a74b174bc 100644 --- a/Classification/examples/Classification/include/Color_ramp.h +++ b/Classification/examples/Classification/include/Color_ramp.h @@ -35,7 +35,7 @@ class Color_ramp Color out; for (std::size_t i = 0; i < 3; ++ i) - out[i] = (unsigned char)((1 - ratio) * c0[i] + ratio * c1[i]); + out[i] = static_cast((1 - ratio) * c0[i] + ratio * c1[i]); return out; } diff --git a/Generator/examples/Generator/grid_d.cpp b/Generator/examples/Generator/grid_d.cpp index c862894a23c..5bf64c37aa8 100644 --- a/Generator/examples/Generator/grid_d.cpp +++ b/Generator/examples/Generator/grid_d.cpp @@ -18,7 +18,7 @@ int main () < v; v.reserve(nb_points); - CGAL::points_on_cube_grid_d (dim, size, (std::size_t) nb_points, + CGAL::points_on_cube_grid_d (dim, size, static_cast(nb_points), std::back_inserter(v), Creator_d(dim) ); for (int i = 0; i < nb_points; ++i) std::cout<<" "<(f2); // check the auto-assignment std::cerr << "Copy-construction...\n"; Map f3(f); // check the copy constructor diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp index 7a326ee1b2f..5b0a8a23196 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp @@ -53,7 +53,7 @@ int main() domain, image, criteria, - (unsigned char)0); + static_cast(0)); CGAL::refine_mesh_3(c3t3, domain, criteria); /// [Meshing] diff --git a/Mesh_3/examples/Mesh_3/random_labeled_image.h b/Mesh_3/examples/Mesh_3/random_labeled_image.h index 8d03d462d49..7e153a21345 100644 --- a/Mesh_3/examples/Mesh_3/random_labeled_image.h +++ b/Mesh_3/examples/Mesh_3/random_labeled_image.h @@ -11,7 +11,7 @@ CGAL::Image_3 random_labeled_image() _image* image = _createImage(dim, dim, dim, 1, 1.f, 1.f, 1.f, 1, WK_FIXED, SGN_UNSIGNED); - unsigned char* ptr = (unsigned char*)(image->data); + unsigned char* ptr = static_cast(image->data); std::fill(ptr, ptr+dim*dim*dim, '\0'); std::ptrdiff_t center = dim / 2; diff --git a/Mesh_3/test/Mesh_3/test_c3t3_io.cpp b/Mesh_3/test/Mesh_3/test_c3t3_io.cpp index 5e75b344e14..a937d691868 100644 --- a/Mesh_3/test/Mesh_3/test_c3t3_io.cpp +++ b/Mesh_3/test/Mesh_3/test_c3t3_io.cpp @@ -86,9 +86,9 @@ class Output_rep { //! perform the output, calls \c operator\<\< by default. std::ostream& operator()( std::ostream& out) const { if(IO::is_ascii(out)) { - out << (int)t; + out << static_cast(t); } else { - CGAL::write(out, (int)t); + CGAL::write(out, static_cast(t)); } return out; } @@ -109,7 +109,7 @@ class Input_rep { } else { CGAL::read(in, i); } - t = (T)i; + t = static_cast(i); return in; } }; diff --git a/Point_set_3/examples/Point_set_3/point_set_property.cpp b/Point_set_3/examples/Point_set_3/point_set_property.cpp index 80e48a223d6..899cd53410b 100644 --- a/Point_set_3/examples/Point_set_3/point_set_property.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_property.cpp @@ -26,9 +26,9 @@ void print_point_set (const Point_set& point_set) for (Point_set::const_iterator it = point_set.begin(); it != point_set.end(); ++ it) { std::cerr << "* Point " << point_set.point(*it) // or point_set[it] - << " with color [" << (int)(color[*it][0]) - << " " << (int)(color[*it][1]) - << " " << (int)(color[*it][2]) + << " with color [" << static_cast(color[*it][0]) + << " " << static_cast(color[*it][1]) + << " " << static_cast(color[*it][2]) << "] and intensity " << intensity[*it] << std::endl; } @@ -53,11 +53,11 @@ int main (int, char**) for (std::size_t i = 0; i < 10; ++ i) { Point_set::iterator it = point_set.insert (Point (double(i), double(i), double(i))); - Color c = {{ (unsigned char)(CGAL::get_default_random().get_int(0, 255)), - (unsigned char)(CGAL::get_default_random().get_int(0, 255)), - (unsigned char)(CGAL::get_default_random().get_int(0, 255)) }}; + Color c = {{ static_cast(CGAL::get_default_random().get_int(0, 255)), + static_cast(CGAL::get_default_random().get_int(0, 255)), + static_cast(CGAL::get_default_random().get_int(0, 255)) }}; color[*it] = c; - intensity[*it] = rand() / (double)(RAND_MAX); + intensity[*it] = rand() / static_cast(RAND_MAX); } print_point_set (point_set); diff --git a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp index 9ef2280fef9..e0adc09a1b8 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp @@ -44,7 +44,7 @@ int main(int argc, char*argv[]) CGAL::parameters::threshold_percent (100.). // No limit on the number of outliers to remove threshold_distance (2. * average_spacing)); // Point with distance above 2*average_spacing are considered outliers - std::cerr << (100. * std::distance(first_to_remove, points.end()) / (double)(points.size())) + std::cerr << (100. * std::distance(first_to_remove, points.end()) / static_cast(points.size())) << "% of the points are considered outliers when using a distance threshold of " << 2. * average_spacing << std::endl; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp index ab9451d1e9d..13e7af3c633 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp @@ -47,10 +47,10 @@ int main(int, char**) for (int i = 0; i < 10; ++ i) points.push_back (std::make_tuple (Point (i / 10., i / 20., i / 30.), - CGAL::make_array ((unsigned char)(255 / (i + 1)), - (unsigned char)(192 / (i + 1)), - (unsigned char)(128 / (i + 1)), - (unsigned char)(64 / (i + 1))), + CGAL::make_array (static_cast(255 / (i + 1)), + static_cast(192 / (i + 1)), + static_cast(128 / (i + 1)), + static_cast(64 / (i + 1))), i)); std::ofstream f("out.ply", std::ios::binary); diff --git a/Polyhedron/demo/Polyhedron/Color_map.h b/Polyhedron/demo/Polyhedron/Color_map.h index 2e04a3ee5bd..a55f0c658d2 100644 --- a/Polyhedron/demo/Polyhedron/Color_map.h +++ b/Polyhedron/demo/Polyhedron/Color_map.h @@ -20,7 +20,7 @@ compute_color_map(QColor base_color, Output_color_iterator out) { qreal hue = base_color.hueF(); - const qreal step = ((qreal)1) / nb_of_colors; + const qreal step = (static_cast(1)) / nb_of_colors; qreal h = hue==-1 ? 0 :hue; diff --git a/Polyhedron/demo/Polyhedron/Edge_container.cpp b/Polyhedron/demo/Polyhedron/Edge_container.cpp index 09a2b47d258..50584f8e94f 100644 --- a/Polyhedron/demo/Polyhedron/Edge_container.cpp +++ b/Polyhedron/demo/Polyhedron/Edge_container.cpp @@ -167,8 +167,8 @@ void Edge_container::draw(Viewer_interface *viewer, if(getVao(viewer)->program->property("hasViewport").toBool()) { getVao(viewer)->program->setUniformValue("viewport", getViewport()); - getVao(viewer)->program->setUniformValue("near",(GLfloat)viewer->camera()->zNear()); - getVao(viewer)->program->setUniformValue("far",(GLfloat)viewer->camera()->zFar()); + getVao(viewer)->program->setUniformValue("near",static_cast(viewer->camera()->zNear())); + getVao(viewer)->program->setUniformValue("far",static_cast(viewer->camera()->zFar())); } if(getVao(viewer)->program->property("hasWidth").toBool()) getVao(viewer)->program->setUniformValue("width", getWidth()); diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 59d944291bc..284f118bbd0 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -2496,15 +2496,15 @@ void MainWindow::viewerShowObject() Scene_item* item = nullptr; QAction* sender_action = qobject_cast(sender()); if(sender_action && !sender_action->data().isNull()) { - item = (Scene_item*)sender_action->data().value(); + item = static_cast(sender_action->data().value()); } if(item) { const Scene::Bbox bbox = item->bbox(); - CGAL::qglviewer::Vec min((float)bbox.xmin()+viewer->offset().x, (float)bbox.ymin()+viewer->offset().y, (float)bbox.zmin()+viewer->offset().z), - max((float)bbox.xmax()+viewer->offset().x, (float)bbox.ymax()+viewer->offset().y, (float)bbox.zmax()+viewer->offset().z); + CGAL::qglviewer::Vec min(static_cast(bbox.xmin())+viewer->offset().x, static_cast(bbox.ymin())+viewer->offset().y, static_cast(bbox.zmin())+viewer->offset().z), + max(static_cast(bbox.xmax())+viewer->offset().x, static_cast(bbox.ymax())+viewer->offset().y, static_cast(bbox.zmax())+viewer->offset().z); viewer->setSceneBoundingBox(min, max); - viewerShow((float)min.x, (float)min.y, (float)min.z, - (float)max.x, (float)max.y, (float)max.z); + viewerShow(static_cast(min.x), static_cast(min.y), static_cast(min.z), + static_cast(max.x), static_cast(max.y), static_cast(max.z)); } } /* to check @@ -3599,9 +3599,9 @@ void SubViewer::lookat() if (viewer->camera()->frame()->isSpinning()) viewer->camera()->frame()->stopSpinning(); mw->viewerShow(viewer, - (float)dialog.get_x() + viewer->offset().x, - (float)dialog.get_y() + viewer->offset().y, - (float)dialog.get_z() + viewer->offset().z); + static_cast(dialog.get_x()) + viewer->offset().x, + static_cast(dialog.get_y()) + viewer->offset().y, + static_cast(dialog.get_z()) + viewer->offset().z); } } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h b/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h index 7432244e8e9..361c4a0d7d3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h @@ -302,7 +302,7 @@ public Q_SLOTS: } if(total == 0) continue; - CGAL::qglviewer::Vec center(x/(double)total, y/(double)total, z/(double)total); + CGAL::qglviewer::Vec center(x/static_cast(total), y/static_cast(total), z/static_cast(total)); CGAL::qglviewer::Vec orig; CGAL::qglviewer::Vec dir; if(camera->type() == CGAL::qglviewer::Camera::PERSPECTIVE) diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index bf1bc48d08f..1e17db5fffc 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -765,8 +765,8 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) std::vector fbos; std::vector depth_test; QColor background = viewer->backgroundColor(); - fbos.resize((int)viewer->total_pass()); - depth_test.resize((int)viewer->total_pass()-1); + fbos.resize(static_cast(viewer->total_pass())); + depth_test.resize(static_cast(viewer->total_pass())-1); //first pass fbos[0] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F); @@ -836,8 +836,8 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) //last pass - fbos[(int)viewer->total_pass()-1] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F); - fbos[(int)viewer->total_pass()-1]->bind(); + fbos[static_cast(viewer->total_pass())-1] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F); + fbos[static_cast(viewer->total_pass())-1]->bind(); viewer->glDisable(GL_BLEND); viewer->glEnable(GL_DEPTH_TEST); viewer->glDepthFunc(GL_LESS); @@ -847,18 +847,18 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) 0.0f); viewer->glClearDepthf(1); viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - renderScene(opaque_items , viewer, picked_item_IDs, false, (int)viewer->total_pass()-1, false, depth_test[(int)viewer->total_pass()-2]); - renderScene(transparent_items, viewer, picked_item_IDs, false, (int)viewer->total_pass()-1, false, depth_test[(int)viewer->total_pass()-2]); - fbos[(int)viewer->total_pass()-1]->release(); + renderScene(opaque_items , viewer, picked_item_IDs, false, static_cast(viewer->total_pass())-1, false, depth_test[static_cast(viewer->total_pass())-2]); + renderScene(transparent_items, viewer, picked_item_IDs, false, static_cast(viewer->total_pass())-1, false, depth_test[static_cast(viewer->total_pass())-2]); + fbos[static_cast(viewer->total_pass())-1]->release(); if(viewer->getStoredFrameBuffer() != nullptr) viewer->getStoredFrameBuffer()->bind(); //blending program.bind(); vaos[viewer]->bind(); - viewer->glClearColor((GLclampf)background.redF(), - (GLclampf)background.greenF(), - (GLclampf)background.blueF(), + viewer->glClearColor(static_cast(background.redF()), + static_cast(background.greenF()), + static_cast(background.blueF()), 0.0f); viewer->glDisable(GL_DEPTH_TEST); viewer->glClear(GL_COLOR_BUFFER_BIT); @@ -869,9 +869,9 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) proj_mat.setToIdentity(); proj_mat.ortho(-1,1,-1,1,0,1); program.setUniformValue("projection_matrix", proj_mat); - for(int i=0; i< (int)viewer->total_pass()-1; ++i) + for(int i=0; i< static_cast(viewer->total_pass())-1; ++i) delete depth_test[i]; - for(int i = (int)viewer->total_pass()-1; i>=0; --i) + for(int i = static_cast(viewer->total_pass())-1; i>=0; --i) { viewer->glBindTexture(GL_TEXTURE_2D, fbos[i]->texture()); viewer->glDrawArrays(GL_TRIANGLES,0,static_cast(6)); diff --git a/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp b/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp index 3f36dc6c958..30239fa2be0 100644 --- a/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp @@ -88,7 +88,7 @@ float Scene_item_rendering_helper::alpha() const { if(!priv->alphaSlider) return 1.0f; - return (float)priv->alphaSlider->value() / 255.0f; + return static_cast(priv->alphaSlider->value()) / 255.0f; } void Scene_item_rendering_helper::initGL(CGAL::Three::Viewer_interface* viewer) const diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp index 63707001765..db4de5ef72d 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -671,7 +671,7 @@ void Scene_points_with_normal_item::drawEdges(CGAL::Three::Viewer_interface* vie double ratio_displayed = 1.0; if (viewer->inFastDrawing () && (d->nb_lines/6 > limit_fast_drawing)) // arbitrary large value - ratio_displayed = 6 * limit_fast_drawing / (double)(d->nb_lines); + ratio_displayed = 6 * limit_fast_drawing / static_cast(d->nb_lines); if(!isInit(viewer)) initGL(viewer); if ( getBuffersFilled() && @@ -699,7 +699,7 @@ drawPoints(CGAL::Three::Viewer_interface* viewer) const double ratio_displayed = 1.0; if ((viewer->inFastDrawing () || d->isPointSliderMoving()) &&((d->nb_points )/3 > limit_fast_drawing)) // arbitrary large value - ratio_displayed = 3 * limit_fast_drawing / (double)(d->nb_points); + ratio_displayed = 3 * limit_fast_drawing / static_cast(d->nb_points); if(!isInit(viewer)) initGL(viewer); diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp index 116ff34f6b1..e403b2dcda1 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp @@ -196,16 +196,16 @@ Scene_polygon_soup_item_priv::triangulate_polygon(Polygons_iterator pit, int pol normals.push_back(normal.z()); if(!soup->fcolors.empty()) { - f_colors.push_back((float)color.red()/255); - f_colors.push_back((float)color.green()/255); - f_colors.push_back((float)color.blue()/255); + f_colors.push_back(static_cast(color.red())/255); + f_colors.push_back(static_cast(color.green())/255); + f_colors.push_back(static_cast(color.blue())/255); } if(!soup->vcolors.empty()) { CGAL::IO::Color vcolor = soup->vcolors[triangulation.v2v[ffit->vertex(i)]]; - v_colors.push_back((float)vcolor.red()/255); - v_colors.push_back((float)vcolor.green()/255); - v_colors.push_back((float)vcolor.blue()/255); + v_colors.push_back(static_cast(vcolor.red())/255); + v_colors.push_back(static_cast(vcolor.green())/255); + v_colors.push_back(static_cast(vcolor.blue())/255); } } } @@ -263,17 +263,17 @@ Scene_polygon_soup_item_priv::compute_normals_and_vertices() const{ if(!soup->fcolors.empty()) { const CGAL::IO::Color color = soup->fcolors[nb]; - f_colors.push_back((float)color.red()/255); - f_colors.push_back((float)color.green()/255); - f_colors.push_back((float)color.blue()/255); + f_colors.push_back(static_cast(color.red())/255); + f_colors.push_back(static_cast(color.green())/255); + f_colors.push_back(static_cast(color.blue())/255); } if(!soup->vcolors.empty()) { const CGAL::IO::Color color = soup->vcolors[it->at(i)]; - v_colors.push_back((float)color.red()/255); - v_colors.push_back((float)color.green()/255); - v_colors.push_back((float)color.blue()/255); + v_colors.push_back(static_cast(color.red())/255); + v_colors.push_back(static_cast(color.green())/255); + v_colors.push_back(static_cast(color.blue())/255); } } } diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp index c65af7bdfa2..548d45663ba 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp @@ -389,21 +389,21 @@ void Scene_surface_mesh_item_priv::addFlatData(Point p, EPICK::Vector_3 n, CGAL: const CGAL::qglviewer::Vec offset = static_cast(CGAL::QGLViewer::QGLViewerPool().first())->offset(); if(name.testFlag(Scene_item_rendering_helper::GEOMETRY)) { - flat_vertices.push_back((cgal_gl_data)(p.x()+offset[0])); - flat_vertices.push_back((cgal_gl_data)(p.y()+offset[1])); - flat_vertices.push_back((cgal_gl_data)(p.z()+offset[2])); + flat_vertices.push_back(static_cast(p.x()+offset[0])); + flat_vertices.push_back(static_cast(p.y()+offset[1])); + flat_vertices.push_back(static_cast(p.z()+offset[2])); } if(name.testFlag(Scene_item_rendering_helper::NORMALS)) { - flat_normals.push_back((cgal_gl_data)n.x()); - flat_normals.push_back((cgal_gl_data)n.y()); - flat_normals.push_back((cgal_gl_data)n.z()); + flat_normals.push_back(static_cast(n.x())); + flat_normals.push_back(static_cast(n.y())); + flat_normals.push_back(static_cast(n.z())); } if(c != nullptr && name.testFlag(Scene_item_rendering_helper::COLORS)) { - f_colors.push_back((float)c->red()/255); - f_colors.push_back((float)c->green()/255); - f_colors.push_back((float)c->blue()/255); + f_colors.push_back(static_cast(c->red())/255); + f_colors.push_back(static_cast(c->green())/255); + f_colors.push_back(static_cast(c->blue())/255); } } @@ -649,9 +649,9 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: for(vertex_descriptor vd : vertices(*smesh_)) { CGAL::IO::Color c = vcolors[vd]; - v_colors.push_back((float)c.red()/255); - v_colors.push_back((float)c.green()/255); - v_colors.push_back((float)c.blue()/255); + v_colors.push_back(static_cast(c.red())/255); + v_colors.push_back(static_cast(c.green())/255); + v_colors.push_back(static_cast(c.blue())/255); } } @@ -1603,8 +1603,8 @@ void Scene_surface_mesh_item_priv:: invalidate_stats() { - number_of_degenerated_faces = (unsigned int)(-1); - number_of_null_length_edges = (unsigned int)(-1); + number_of_degenerated_faces = static_cast(-1); + number_of_null_length_edges = static_cast(-1); has_nm_vertices = false; volume = -std::numeric_limits::infinity(); area = -std::numeric_limits::infinity(); @@ -1712,7 +1712,7 @@ QString Scene_surface_mesh_item::computeStats(int type) { if(is_triangle_mesh(*d->smesh_)) { - if (d->number_of_degenerated_faces == (unsigned int)(-1)) + if (d->number_of_degenerated_faces == static_cast(-1)) d->number_of_degenerated_faces = nb_degenerate_faces(d->smesh_); return QString::number(d->number_of_degenerated_faces); } @@ -2370,7 +2370,7 @@ float Scene_surface_mesh_item::alpha() const { if(!d->alphaSlider) return 1.0f; - return (float)d->alphaSlider->value() / 255.0f; + return static_cast(d->alphaSlider->value()) / 255.0f; } void Scene_surface_mesh_item::setAlpha(int alpha) diff --git a/Polyhedron/demo/Polyhedron/Triangle_container.cpp b/Polyhedron/demo/Polyhedron/Triangle_container.cpp index ae6ee18ae71..3442f948e3a 100644 --- a/Polyhedron/demo/Polyhedron/Triangle_container.cpp +++ b/Polyhedron/demo/Polyhedron/Triangle_container.cpp @@ -165,8 +165,8 @@ void Triangle_container::draw(Viewer_interface* viewer, getVao(viewer)->program->setUniformValue("comparing", viewer->currentPass() > 0); getVao(viewer)->program->setUniformValue("width", viewer->width()*1.0f); getVao(viewer)->program->setUniformValue("height", viewer->height()*1.0f); - getVao(viewer)->program->setUniformValue("near", (float)viewer->camera()->zNear()); - getVao(viewer)->program->setUniformValue("far", (float)viewer->camera()->zFar()); + getVao(viewer)->program->setUniformValue("near", static_cast(viewer->camera()->zNear())); + getVao(viewer)->program->setUniformValue("far", static_cast(viewer->camera()->zFar())); getVao(viewer)->program->setUniformValue("writing", viewer->isDepthWriting()); getVao(viewer)->program->setUniformValue("alpha", d->alpha); if( fbo) @@ -205,8 +205,8 @@ void Triangle_container::draw(Viewer_interface* viewer, getVao(viewer)->program->setUniformValue("comparing", viewer->currentPass() > 0); getVao(viewer)->program->setUniformValue("width", viewer->width()*1.0f); getVao(viewer)->program->setUniformValue("height", viewer->height()*1.0f); - getVao(viewer)->program->setUniformValue("near", (float)viewer->camera()->zNear()); - getVao(viewer)->program->setUniformValue("far", (float)viewer->camera()->zFar()); + getVao(viewer)->program->setUniformValue("near", static_cast(viewer->camera()->zNear())); + getVao(viewer)->program->setUniformValue("far", static_cast(viewer->camera()->zFar())); getVao(viewer)->program->setUniformValue("writing", viewer->isDepthWriting()); getVao(viewer)->program->setUniformValue("alpha", d->alpha); if( fbo) diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 515bda440ba..1d9cbbc2c0c 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -502,7 +502,7 @@ void Viewer::init() connect(d->logger, SIGNAL(messageLogged(QOpenGLDebugMessage)), this, SLOT(messageLogged(QOpenGLDebugMessage))); d->logger->startLogging(); } - glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)this->context()->getProcAddress("glDrawArraysInstancedARB"); + glDrawArraysInstanced = reinterpret_cast(this->context()->getProcAddress("glDrawArraysInstancedARB")); if(!glDrawArraysInstanced) { qDebug()<<"glDrawArraysInstancedARB : extension not found. Spheres will be displayed as points."; @@ -511,7 +511,7 @@ void Viewer::init() else d->extension_is_found = true; - glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORARBPROC)this->context()->getProcAddress("glVertexAttribDivisorARB"); + glVertexAttribDivisor = reinterpret_cast(this->context()->getProcAddress("glVertexAttribDivisorARB")); if(!glDrawArraysInstanced) { qDebug()<<"glVertexAttribDivisorARB : extension not found. Spheres will be displayed as points."; @@ -1092,7 +1092,7 @@ void Viewer::drawVisualHints() camera()->getModelViewProjectionMatrix(mat); for(int i=0; i < 16; i++) { - mvpMatrix.data()[i] = (float)mat[i]; + mvpMatrix.data()[i] = static_cast(mat[i]); } if(!isOpenGL_4_3()) { @@ -1114,8 +1114,8 @@ void Viewer::drawVisualHints() program->bind(); QVector2D vp(width(), height()); program->setUniformValue("viewport", vp); - program->setUniformValue("near",(GLfloat)camera()->zNear()); - program->setUniformValue("far",(GLfloat)camera()->zFar()); + program->setUniformValue("near",static_cast(camera()->zNear())); + program->setUniformValue("far",static_cast(camera()->zFar())); program->setUniformValue("width", GLfloat(3.0f)); program->setAttributeValue("colors", QColor(Qt::black)); program->setUniformValue("mvp_matrix", mvpMatrix); @@ -1852,9 +1852,9 @@ void Viewer::setLighting() //set ambient connect(dialog, &LightingDialog::s_ambient_changed, [this, dialog](){ - d->ambient=QVector4D((float)dialog->ambient.redF(), - (float)dialog->ambient.greenF(), - (float)dialog->ambient.blueF(), + d->ambient=QVector4D(static_cast(dialog->ambient.redF()), + static_cast(dialog->ambient.greenF()), + static_cast(dialog->ambient.blueF()), 1.0f); update(); }); @@ -1862,18 +1862,18 @@ void Viewer::setLighting() //set diffuse connect(dialog, &LightingDialog::s_diffuse_changed, [this, dialog](){ - d->diffuse=QVector4D((float)dialog->diffuse.redF(), - (float)dialog->diffuse.greenF(), - (float)dialog->diffuse.blueF(), + d->diffuse=QVector4D(static_cast(dialog->diffuse.redF()), + static_cast(dialog->diffuse.greenF()), + static_cast(dialog->diffuse.blueF()), 1.0f); update(); }); //set specular connect(dialog, &LightingDialog::s_specular_changed, [this, dialog](){ - d->specular=QVector4D((float)dialog->specular.redF(), - (float)dialog->specular.greenF(), - (float)dialog->specular.blueF(), + d->specular=QVector4D(static_cast(dialog->specular.redF()), + static_cast(dialog->specular.greenF()), + static_cast(dialog->specular.blueF()), 1.0f); update(); @@ -2035,8 +2035,8 @@ void Viewer::scaleScene() else d->scaler = QVector3D(1,1,1); - CGAL::qglviewer::Vec vmin(((float)bbox.xmin()+offset().x)*d->scaler.x(), ((float)bbox.ymin()+offset().y)*d->scaler.y(), ((float)bbox.zmin()+offset().z)*d->scaler.z()), - vmax(((float)bbox.xmax()+offset().x)*d->scaler.x(), ((float)bbox.ymax()+offset().y)*d->scaler.y(), ((float)bbox.zmax()+offset().z)*d->scaler.z()); + CGAL::qglviewer::Vec vmin((static_cast(bbox.xmin())+offset().x)*d->scaler.x(), (static_cast(bbox.ymin())+offset().y)*d->scaler.y(), (static_cast(bbox.zmin())+offset().z)*d->scaler.z()), + vmax((static_cast(bbox.xmax())+offset().x)*d->scaler.x(), (static_cast(bbox.ymax())+offset().y)*d->scaler.y(), (static_cast(bbox.zmax())+offset().z)*d->scaler.z()); camera()->setPivotPoint((vmin+vmax)*0.5); camera()->setSceneBoundingBox(vmin, vmax); camera()->fitBoundingBox(vmin, vmax); @@ -2132,8 +2132,8 @@ void Viewer::showEntireScene() CGAL::QGLViewer::showEntireScene(); CGAL::Bbox_3 bbox = CGAL::Three::Three::scene()->bbox(); - CGAL::qglviewer::Vec vmin(((float)bbox.xmin()+offset().x)*d->scaler.x(), ((float)bbox.ymin()+offset().y)*d->scaler.y(), ((float)bbox.zmin()+offset().z)*d->scaler.z()), - vmax(((float)bbox.xmax()+offset().x)*d->scaler.x(), ((float)bbox.ymax()+offset().y)*d->scaler.y(), ((float)bbox.zmax()+offset().z)*d->scaler.z()); + CGAL::qglviewer::Vec vmin((static_cast(bbox.xmin())+offset().x)*d->scaler.x(), (static_cast(bbox.ymin())+offset().y)*d->scaler.y(), (static_cast(bbox.zmin())+offset().z)*d->scaler.z()), + vmax((static_cast(bbox.xmax())+offset().x)*d->scaler.x(), (static_cast(bbox.ymax())+offset().y)*d->scaler.y(), (static_cast(bbox.zmax())+offset().z)*d->scaler.z()); camera()->setPivotPoint((vmin+vmax)*0.5); camera()->setSceneBoundingBox(vmin, vmax); camera()->fitBoundingBox(vmin, vmax); diff --git a/Ridges_3/examples/Ridges_3/Compute_Ridges_Umbilics.cpp b/Ridges_3/examples/Ridges_3/Compute_Ridges_Umbilics.cpp index 66516d5e092..5b48681a654 100644 --- a/Ridges_3/examples/Ridges_3/Compute_Ridges_Umbilics.cpp +++ b/Ridges_3/examples/Ridges_3/Compute_Ridges_Umbilics.cpp @@ -282,7 +282,7 @@ int main() std::ifstream stream(if_name.c_str()); stream >> P; fprintf(stderr, "loadMesh %d Ves %d Facets\n", - (int)P.size_of_vertices(), (int)P.size_of_facets()); + static_cast(P.size_of_vertices()), static_cast(P.size_of_facets())); if(verbose) out_verb << "Polysurf with " << P.size_of_vertices() << " vertices and " << P.size_of_facets() diff --git a/Ridges_3/examples/Ridges_3/Ridges_Umbilics_LCC.cpp b/Ridges_3/examples/Ridges_3/Ridges_Umbilics_LCC.cpp index 5df0c1a42c7..e5724ba00ce 100644 --- a/Ridges_3/examples/Ridges_3/Ridges_Umbilics_LCC.cpp +++ b/Ridges_3/examples/Ridges_3/Ridges_Umbilics_LCC.cpp @@ -287,7 +287,7 @@ int main() PolyhedralSurf P; CGAL::IO::read_polygon_mesh(if_name.c_str(), P); fprintf(stderr, "loadMesh %d Ves %d Facets\n", - (int)num_vertices(P), (int)num_faces(P)); + static_cast(num_vertices(P)), static_cast(num_faces(P))); if(verbose) out_verb << "Polysurf with " << num_vertices(P) << " vertices and " << num_faces(P) diff --git a/Ridges_3/examples/Ridges_3/Ridges_Umbilics_SM.cpp b/Ridges_3/examples/Ridges_3/Ridges_Umbilics_SM.cpp index b73f19cb409..dbc64c7b974 100644 --- a/Ridges_3/examples/Ridges_3/Ridges_Umbilics_SM.cpp +++ b/Ridges_3/examples/Ridges_3/Ridges_Umbilics_SM.cpp @@ -272,7 +272,7 @@ int main() std::ifstream stream(if_name.c_str()); stream >> P; fprintf(stderr, "loadMesh %d Ves %d Facets\n", - (int)num_vertices(P), (int)num_faces(P)); + static_cast(num_vertices(P)), static_cast(num_faces(P))); if(verbose) out_verb << "Polysurf with " << num_vertices(P) << " vertices and " << num_faces(P) diff --git a/Shape_detection/examples/Shape_detection/region_growing_circles_on_point_set_2.cpp b/Shape_detection/examples/Shape_detection/region_growing_circles_on_point_set_2.cpp index 015fce068a8..362ab391cc9 100644 --- a/Shape_detection/examples/Shape_detection/region_growing_circles_on_point_set_2.cpp +++ b/Shape_detection/examples/Shape_detection/region_growing_circles_on_point_set_2.cpp @@ -91,9 +91,9 @@ int main (int argc, char** argv) ([&](const std::vector& region) { // Assign a random color to each region - unsigned char r = (unsigned char)(random.get_int(64, 192)); - unsigned char g = (unsigned char)(random.get_int(64, 192)); - unsigned char b = (unsigned char)(random.get_int(64, 192)); + unsigned char r = static_cast(random.get_int(64, 192)); + unsigned char g = static_cast(random.get_int(64, 192)); + unsigned char b = static_cast(random.get_int(64, 192)); for (const std::size_t& idx : region) { red[idx] = r; diff --git a/Shape_detection/examples/Shape_detection/region_growing_cylinders_on_point_set_3.cpp b/Shape_detection/examples/Shape_detection/region_growing_cylinders_on_point_set_3.cpp index 60b8c956ec7..89a2a5ab660 100644 --- a/Shape_detection/examples/Shape_detection/region_growing_cylinders_on_point_set_3.cpp +++ b/Shape_detection/examples/Shape_detection/region_growing_cylinders_on_point_set_3.cpp @@ -72,9 +72,9 @@ int main (int argc, char** argv) ([&](const std::vector& region) { // Assign a random color to each region - unsigned char r = (unsigned char)(random.get_int(64, 192)); - unsigned char g = (unsigned char)(random.get_int(64, 192)); - unsigned char b = (unsigned char)(random.get_int(64, 192)); + unsigned char r = static_cast(random.get_int(64, 192)); + unsigned char g = static_cast(random.get_int(64, 192)); + unsigned char b = static_cast(random.get_int(64, 192)); for (const std::size_t& idx : region) { red[idx] = r; diff --git a/Shape_detection/examples/Shape_detection/region_growing_spheres_on_point_set_3.cpp b/Shape_detection/examples/Shape_detection/region_growing_spheres_on_point_set_3.cpp index 0a9c240f036..e1ff91a0b02 100644 --- a/Shape_detection/examples/Shape_detection/region_growing_spheres_on_point_set_3.cpp +++ b/Shape_detection/examples/Shape_detection/region_growing_spheres_on_point_set_3.cpp @@ -72,9 +72,9 @@ int main (int argc, char** argv) ([&](const std::vector& region) { // Assign a random color to each region - unsigned char r = (unsigned char)(random.get_int(64, 192)); - unsigned char g = (unsigned char)(random.get_int(64, 192)); - unsigned char b = (unsigned char)(random.get_int(64, 192)); + unsigned char r = static_cast(random.get_int(64, 192)); + unsigned char g = static_cast(random.get_int(64, 192)); + unsigned char b = static_cast(random.get_int(64, 192)); for (const std::size_t& idx : region) { red[idx] = r; diff --git a/Solver_interface/examples/Solver_interface/sparse_solvers.cpp b/Solver_interface/examples/Solver_interface/sparse_solvers.cpp index e72c4414422..52fb6639e5e 100644 --- a/Solver_interface/examples/Solver_interface/sparse_solvers.cpp +++ b/Solver_interface/examples/Solver_interface/sparse_solvers.cpp @@ -21,7 +21,7 @@ int main(void) int x = rand() % degree; int y = rand() % degree; - FT value = rand() / (FT)RAND_MAX; + FT value = rand() / static_cast(RAND_MAX); A.add_coef(x, y, value); A.add_coef(y, x, value); diff --git a/Three/include/CGAL/Three/Scene_item.h b/Three/include/CGAL/Three/Scene_item.h index 0f170f2186e..6c2c43de591 100644 --- a/Three/include/CGAL/Three/Scene_item.h +++ b/Three/include/CGAL/Three/Scene_item.h @@ -331,7 +331,7 @@ public Q_SLOTS: //!This function is called by `Scene::changeGroup` and should not be //!called manually. virtual void moveToGroup(Scene_group_item* group); - void setRenderingMode(int m) { setRenderingMode((RenderingMode)m);} + void setRenderingMode(int m) { setRenderingMode(static_cast(m));} //!Sets the rendering mode of the item. //!@see RenderingMode virtual void setRenderingMode(RenderingMode m) {