diff --git a/.clang-tidy b/.clang-tidy index 5b0383fadf9..4e807fdab59 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,7 +1,11 @@ --- Checks: > -*, + bugprone-assert-side-effect, bugprone-copy-constructor-init, + bugprone-dangling-handle, + bugprone-forward-declaration-namespace, + bugprone-inaccurate-erase, bugprone-macro-parentheses, bugprone-unhandled-self-assignment, bugprone-unused-raii, @@ -49,5 +53,5 @@ Checks: > readability-simplify-subscript-expr, WarningsAsErrors: '*' CheckOptions: -- {key: modernize-use-auto.MinTypeNameLength, value: 7} + - {key: modernize-use-auto.MinTypeNameLength, value: 7} UseColor: true diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 59fc4071c26..130948b34b9 100755 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -1,23 +1,25 @@ name: clang-tidy - -on: [push, pull_request] - +'on': + - push + - pull_request jobs: tidy: runs-on: ubuntu-latest container: - image: pointcloudlibrary/env:24.04 - + image: 'pointcloudlibrary/env:24.04' steps: - - uses: actions/checkout@v4 - - - name: Run clang-tidy - run: | + - uses: actions/checkout@v4 + - name: Run clang-tidy + run: > bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" - cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_COMPILER=/usr/bin/clang-18 -DCMAKE_C_COMPILER=/usr/bin/clang-18 . \ + + cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -DCMAKE_CXX_COMPILER=/usr/bin/clang-18 + -DCMAKE_C_COMPILER=/usr/bin/clang-18 . \ -DBUILD_benchmarks=ON \ -DBUILD_examples=ON \ + -DBUILD_surface_on_nurbs=ON \ -DBUILD_simulation=ON \ -DBUILD_global_tests=ON - + run-clang-tidy -header-filter='.*' diff --git a/common/include/pcl/common/fft/.clang-tidy b/common/include/pcl/common/fft/.clang-tidy new file mode 100644 index 00000000000..c08e73d82ee --- /dev/null +++ b/common/include/pcl/common/fft/.clang-tidy @@ -0,0 +1,8 @@ +--- +# Minimal checks for third-party code (kiss_fft) - disable all except one to avoid CI "no checks" error +Checks: '-*,-clang-diagnostic-*,-clang-analyzer-*,readability-identifier-naming' +WarningsAsErrors: '' +CheckOptions: + # Effectively disables the check by not configuring naming rules + - key: readability-identifier-naming.AbstractClassCase + value: '' diff --git a/common/src/fft/.clang-tidy b/common/src/fft/.clang-tidy new file mode 100644 index 00000000000..c08e73d82ee --- /dev/null +++ b/common/src/fft/.clang-tidy @@ -0,0 +1,8 @@ +--- +# Minimal checks for third-party code (kiss_fft) - disable all except one to avoid CI "no checks" error +Checks: '-*,-clang-diagnostic-*,-clang-analyzer-*,readability-identifier-naming' +WarningsAsErrors: '' +CheckOptions: + # Effectively disables the check by not configuring naming rules + - key: readability-identifier-naming.AbstractClassCase + value: '' diff --git a/examples/surface/example_nurbs_fitting_closed_curve.cpp b/examples/surface/example_nurbs_fitting_closed_curve.cpp index 65342497a35..9c6ffda9bdb 100644 --- a/examples/surface/example_nurbs_fitting_closed_curve.cpp +++ b/examples/surface/example_nurbs_fitting_closed_curve.cpp @@ -43,9 +43,9 @@ VisualizeCurve (ON_NurbsCurve &curve, double r, double g, double b, bool show_cp curve.GetCV (i, cp); pcl::PointXYZ p; - p.x = float (cp.x); - p.y = float (cp.y); - p.z = float (cp.z); + p.x = static_cast(cp.x); + p.y = static_cast(cp.y); + p.z = static_cast(cp.z); cps->push_back (p); } pcl::visualization::PointCloudColorHandlerCustom handler (cps, 255 * r, 255 * g, 255 * b); diff --git a/examples/surface/example_nurbs_fitting_closed_curve3d.cpp b/examples/surface/example_nurbs_fitting_closed_curve3d.cpp index c6da7235fac..4595e520b47 100644 --- a/examples/surface/example_nurbs_fitting_closed_curve3d.cpp +++ b/examples/surface/example_nurbs_fitting_closed_curve3d.cpp @@ -41,9 +41,9 @@ VisualizeCurve (ON_NurbsCurve &curve, double r, double g, double b, bool show_cp curve.GetCV (i, cp); pcl::PointXYZ p; - p.x = float (cp.x); - p.y = float (cp.y); - p.z = float (cp.z); + p.x = static_cast(cp.x); + p.y = static_cast(cp.y); + p.z = static_cast(cp.z); cps->push_back (p); } pcl::visualization::PointCloudColorHandlerCustom handler (cps, 255 * r, 255 * g, 255 * b); diff --git a/examples/surface/example_nurbs_fitting_curve2d.cpp b/examples/surface/example_nurbs_fitting_curve2d.cpp index f66b050cfdd..e43ee38fe3f 100644 --- a/examples/surface/example_nurbs_fitting_curve2d.cpp +++ b/examples/surface/example_nurbs_fitting_curve2d.cpp @@ -41,9 +41,9 @@ VisualizeCurve (ON_NurbsCurve &curve, double r, double g, double b, bool show_cp curve.GetCV (i, cp); pcl::PointXYZ p; - p.x = float (cp.x); - p.y = float (cp.y); - p.z = float (cp.z); + p.x = static_cast(cp.x); + p.y = static_cast(cp.y); + p.z = static_cast(cp.z); cps->push_back (p); } pcl::visualization::PointCloudColorHandlerCustom handler (cps, 255 * r, 255 * g, 255 * b); diff --git a/examples/surface/example_nurbs_fitting_surface.cpp b/examples/surface/example_nurbs_fitting_surface.cpp index 0cbda86ac80..ee52a8dea05 100644 --- a/examples/surface/example_nurbs_fitting_surface.cpp +++ b/examples/surface/example_nurbs_fitting_surface.cpp @@ -202,9 +202,9 @@ visualizeCurve (ON_NurbsCurve &curve, ON_NurbsSurface &surface, pcl::visualizati double pnt[3]; surface.Evaluate (p1.x, p1.y, 0, 3, pnt); pcl::PointXYZRGB p2; - p2.x = float (pnt[0]); - p2.y = float (pnt[1]); - p2.z = float (pnt[2]); + p2.x = static_cast(pnt[0]); + p2.y = static_cast(pnt[1]); + p2.z = static_cast(pnt[2]); p2.r = 255; p2.g = 0; diff --git a/examples/surface/example_nurbs_viewer_surface.cpp b/examples/surface/example_nurbs_viewer_surface.cpp index d77d7f02075..d7b8f5b81f0 100644 --- a/examples/surface/example_nurbs_viewer_surface.cpp +++ b/examples/surface/example_nurbs_viewer_surface.cpp @@ -48,7 +48,13 @@ main (int argc, char *argv[]) return -1; } - const ON_NurbsSurface& on_surf = *(ON_NurbsSurface*)on_object; + const auto* on_surf_ptr = dynamic_cast(on_object); + if (!on_surf_ptr) + { + std::cerr << "object[0] is not a NURBS surface." << std::endl; + return -1; + } + const ON_NurbsSurface& on_surf = *on_surf_ptr; pcl::PolygonMesh mesh; std::string mesh_id = "mesh_nurbs"; @@ -68,7 +74,13 @@ main (int argc, char *argv[]) return -1; } - const ON_NurbsCurve& on_curv = *(ON_NurbsCurve*)on_object; + const auto* on_curv_ptr = dynamic_cast(on_object); + if (!on_curv_ptr) + { + std::cerr << "object[1] is not a NURBS curve." << std::endl; + return -1; + } + const ON_NurbsCurve& on_curv = *on_curv_ptr; pcl::on_nurbs::Triangulation::convertTrimmedSurface2PolygonMesh (on_surf, on_curv, mesh, mesh_resolution); diff --git a/examples/surface/test_nurbs_fitting_surface.cpp b/examples/surface/test_nurbs_fitting_surface.cpp index 74a52083587..6de44b36e68 100644 --- a/examples/surface/test_nurbs_fitting_surface.cpp +++ b/examples/surface/test_nurbs_fitting_surface.cpp @@ -12,15 +12,15 @@ CreateCylinderPoints (pcl::PointCloud::Ptr cloud, pcl::on_nurbs::vector_v { for (unsigned i = 0; i < npoints; i++) { - double da = alpha * double (rand ()) / RAND_MAX; - double dh = h * (double (rand ()) / RAND_MAX - 0.5); + double da = alpha * static_cast(rand ()) / RAND_MAX; + double dh = h * (static_cast(rand ()) / RAND_MAX - 0.5); Point p; - p.x = float (r * std::cos (da)); - p.y = float (r * sin (da)); - p.z = float (dh); + p.x = static_cast(r * std::cos (da)); + p.y = static_cast(r * sin (da)); + p.z = static_cast(dh); - data.push_back (Eigen::Vector3d (p.x, p.y, p.z)); + data.emplace_back (p.x, p.y, p.z); cloud->push_back (p); } } diff --git a/features/include/pcl/features/ppfrgb.h b/features/include/pcl/features/ppfrgb.h index c50fee1d314..9bbf999ae79 100644 --- a/features/include/pcl/features/ppfrgb.h +++ b/features/include/pcl/features/ppfrgb.h @@ -64,7 +64,7 @@ namespace pcl * \param output the resulting point cloud (which should be of type pcl::PPFRGBSignature); */ void - computeFeature (PointCloudOut &output); + computeFeature (PointCloudOut &output) override; }; template diff --git a/outofcore/include/pcl/outofcore/impl/lru_cache.hpp b/outofcore/include/pcl/outofcore/impl/lru_cache.hpp index 9bdef7920fd..e0564c08876 100644 --- a/outofcore/include/pcl/outofcore/impl/lru_cache.hpp +++ b/outofcore/include/pcl/outofcore/impl/lru_cache.hpp @@ -33,9 +33,7 @@ class LRUCache using KeyIndex = std::list; using KeyIndexIterator = typename KeyIndex::iterator; - using Cache = std::map >; - using CacheIterator = typename Cache::iterator; LRUCache (std::size_t c) : capacity_ (c) @@ -53,7 +51,7 @@ class LRUCache get (const KeyT& k) { // Get existing key - const CacheIterator it = cache_.find (k); + const auto it = cache_.find (k); assert(it != cache_.end ()); // Move key to MRU key index @@ -67,7 +65,7 @@ class LRUCache touch (const KeyT& key) { // Get existing key - const CacheIterator it = cache_.find (key); + const auto it = cache_.find (key); assert(it != cache_.end ()); // Move key to MRU key index @@ -93,7 +91,7 @@ class LRUCache while (size + item_size >= capacity_) { - const CacheIterator cache_it = cache_.find (*key_it); + const auto cache_it = cache_.find (*key_it); // Get tail item (Least Recently Used) std::size_t tail_timestamp = cache_it->second.first.timestamp; @@ -133,7 +131,7 @@ class LRUCache CacheItemT& tailItem () { - const CacheIterator it = cache_.find (key_index_.front ()); + const auto it = cache_.find (key_index_.front ()); return it->second.first; } @@ -153,7 +151,7 @@ class LRUCache return false; // Get LRU item - const CacheIterator it = cache_.find (key_index_.front ()); + const auto it = cache_.find (key_index_.front ()); assert(it != cache_.end()); // Remove LRU item from cache and key index diff --git a/recognition/include/pcl/recognition/3rdparty/.clang-tidy b/recognition/include/pcl/recognition/3rdparty/.clang-tidy new file mode 100644 index 00000000000..99e42069716 --- /dev/null +++ b/recognition/include/pcl/recognition/3rdparty/.clang-tidy @@ -0,0 +1,8 @@ +--- +# Minimal checks for third-party code - disable all except one to avoid CI "no checks" error +Checks: '-*,-clang-diagnostic-*,-clang-analyzer-*,readability-identifier-naming' +WarningsAsErrors: '' +CheckOptions: + # Effectively disables the check by not configuring naming rules + - key: readability-identifier-naming.AbstractClassCase + value: '' diff --git a/surface/include/pcl/surface/3rdparty/.clang-tidy b/surface/include/pcl/surface/3rdparty/.clang-tidy new file mode 100644 index 00000000000..99e42069716 --- /dev/null +++ b/surface/include/pcl/surface/3rdparty/.clang-tidy @@ -0,0 +1,8 @@ +--- +# Minimal checks for third-party code - disable all except one to avoid CI "no checks" error +Checks: '-*,-clang-diagnostic-*,-clang-analyzer-*,readability-identifier-naming' +WarningsAsErrors: '' +CheckOptions: + # Effectively disables the check by not configuring naming rules + - key: readability-identifier-naming.AbstractClassCase + value: '' diff --git a/surface/include/pcl/surface/on_nurbs/fitting_curve_2d.h b/surface/include/pcl/surface/on_nurbs/fitting_curve_2d.h index 6e9c90e8655..49db7046ef9 100644 --- a/surface/include/pcl/surface/on_nurbs/fitting_curve_2d.h +++ b/surface/include/pcl/surface/on_nurbs/fitting_curve_2d.h @@ -58,12 +58,9 @@ namespace pcl /** \brief Parameters for fitting */ struct Parameter { - double smoothness; - double rScale; - Parameter () : - smoothness (0.1), rScale (1.0) - { - } + double smoothness{0.1}; + double rScale{1.0}; + Parameter () = default; }; struct FitParameter diff --git a/surface/include/pcl/surface/on_nurbs/fitting_curve_2d_apdm.h b/surface/include/pcl/surface/on_nurbs/fitting_curve_2d_apdm.h index 72853647919..24fa6fc0c44 100644 --- a/surface/include/pcl/surface/on_nurbs/fitting_curve_2d_apdm.h +++ b/surface/include/pcl/surface/on_nurbs/fitting_curve_2d_apdm.h @@ -58,18 +58,14 @@ namespace pcl /** \brief Parameters for fitting */ struct Parameter { - double interior_sigma2; - double smoothness; - double closest_point_weight; - double closest_point_sigma2; - unsigned closest_point_resolution; - double smooth_concavity; - double rScale; - Parameter () : - interior_sigma2 (0.1), smoothness (0.1), closest_point_weight (0.1), closest_point_sigma2 (0.1), - closest_point_resolution (0), smooth_concavity (1.0), rScale (1.0) - { - } + double interior_sigma2{0.1}; + double smoothness{0.1}; + double closest_point_weight{0.1}; + double closest_point_sigma2{0.1}; + unsigned closest_point_resolution{0}; + double smooth_concavity{1.0}; + double rScale{1.0}; + Parameter () = default; }; struct FitParameter diff --git a/surface/include/pcl/surface/on_nurbs/fitting_curve_2d_pdm.h b/surface/include/pcl/surface/on_nurbs/fitting_curve_2d_pdm.h index 59c457131b4..10ea6bcddc2 100644 --- a/surface/include/pcl/surface/on_nurbs/fitting_curve_2d_pdm.h +++ b/surface/include/pcl/surface/on_nurbs/fitting_curve_2d_pdm.h @@ -58,12 +58,9 @@ namespace pcl /** \brief Parameters for fitting */ struct Parameter { - double smoothness; - double rScale; - Parameter () : - smoothness (0.1), rScale (1.0) - { - } + double smoothness{0.1}; + double rScale{1.0}; + Parameter () = default; }; struct FitParameter diff --git a/surface/include/pcl/surface/on_nurbs/fitting_surface_im.h b/surface/include/pcl/surface/on_nurbs/fitting_surface_im.h index 3fefdcf3b2d..047c70660a9 100644 --- a/surface/include/pcl/surface/on_nurbs/fitting_surface_im.h +++ b/surface/include/pcl/surface/on_nurbs/fitting_surface_im.h @@ -59,11 +59,8 @@ namespace pcl /** \brief Parameters for fitting */ struct Parameter { - double smoothness; - Parameter () : - smoothness (0.1) - { - } + double smoothness{0.1}; + Parameter () = default; }; protected: diff --git a/surface/include/pcl/surface/on_nurbs/nurbs_data.h b/surface/include/pcl/surface/on_nurbs/nurbs_data.h index d74f3503bac..c3052357547 100644 --- a/surface/include/pcl/surface/on_nurbs/nurbs_data.h +++ b/surface/include/pcl/surface/on_nurbs/nurbs_data.h @@ -51,9 +51,9 @@ namespace pcl { // http://eigen.tuxfamily.org/dox-devel/TopicStlContainers.html - typedef std::vector > vector_vec2i; - typedef std::vector > vector_vec2d; - typedef std::vector > vector_vec3d; + using vector_vec2i = std::vector>; + using vector_vec2d = std::vector>; + using vector_vec3d = std::vector>; /** \brief Data structure for NURBS surface fitting * (FittingSurface, FittingSurfaceTDM, FittingCylinder, GlobalOptimization, GlobalOptimizationTDM) */ diff --git a/surface/include/pcl/surface/on_nurbs/nurbs_solve.h b/surface/include/pcl/surface/on_nurbs/nurbs_solve.h index 491da21a465..c4739746331 100644 --- a/surface/include/pcl/surface/on_nurbs/nurbs_solve.h +++ b/surface/include/pcl/surface/on_nurbs/nurbs_solve.h @@ -53,10 +53,7 @@ namespace pcl { public: /** \brief Empty constructor */ - NurbsSolve () : - m_quiet (true) - { - } + NurbsSolve () = default; /** \brief Assign size and dimension (2D, 3D) of system of equations. */ void @@ -122,7 +119,7 @@ namespace pcl } private: - bool m_quiet; + bool m_quiet{true}; SparseMat m_Ksparse; Eigen::MatrixXd m_Keig; Eigen::MatrixXd m_xeig; diff --git a/surface/src/3rdparty/.clang-tidy b/surface/src/3rdparty/.clang-tidy new file mode 100644 index 00000000000..99e42069716 --- /dev/null +++ b/surface/src/3rdparty/.clang-tidy @@ -0,0 +1,8 @@ +--- +# Minimal checks for third-party code - disable all except one to avoid CI "no checks" error +Checks: '-*,-clang-diagnostic-*,-clang-analyzer-*,readability-identifier-naming' +WarningsAsErrors: '' +CheckOptions: + # Effectively disables the check by not configuring naming rules + - key: readability-identifier-naming.AbstractClassCase + value: '' diff --git a/surface/src/on_nurbs/closing_boundary.cpp b/surface/src/on_nurbs/closing_boundary.cpp index 4bb1637e36b..2b1c4ba65bd 100644 --- a/surface/src/on_nurbs/closing_boundary.cpp +++ b/surface/src/on_nurbs/closing_boundary.cpp @@ -243,7 +243,7 @@ ClosingBoundary::sampleUniform (ON_NurbsSurface *nurbs, vector_vec3d &point_list { params (0) = minU + (maxU - minU) * ds * i; nurbs->Evaluate (params (0), params (1), 0, 3, points); - point_list.push_back (Eigen::Vector3d (points[0], points[1], points[2])); + point_list.emplace_back(points[0], points[1], points[2]); } } } @@ -262,10 +262,10 @@ ClosingBoundary::sampleRandom (ON_NurbsSurface *nurbs, vector_vec3d &point_list, for (unsigned i = 0; i < samples; i++) { - params (0) = minU + (maxU - minU) * (double (rand ()) / RAND_MAX); - params (1) = minV + (maxV - minV) * (double (rand ()) / RAND_MAX); + params (0) = minU + (maxU - minU) * (static_cast(rand ()) / RAND_MAX); + params (1) = minV + (maxV - minV) * (static_cast(rand ()) / RAND_MAX); nurbs->Evaluate (params (0), params (1), 0, 3, points); - point_list.push_back (Eigen::Vector3d (points[0], points[1], points[2])); + point_list.emplace_back(points[0], points[1], points[2]); } } @@ -290,7 +290,7 @@ ClosingBoundary::sampleFromBoundary (ON_NurbsSurface *nurbs, vector_vec3d &point { params (1) = minV + (maxV - minV) * ds * i; nurbs->Evaluate (params (0), params (1), 0, 3, points); - point_list.push_back (Eigen::Vector3d (points[0], points[1], points[2])); + point_list.emplace_back(points[0], points[1], points[2]); param_list.push_back (params); } @@ -300,7 +300,7 @@ ClosingBoundary::sampleFromBoundary (ON_NurbsSurface *nurbs, vector_vec3d &point { params (1) = minV + (maxV - minV) * ds * i; nurbs->Evaluate (params (0), params (1), 0, 3, points); - point_list.push_back (Eigen::Vector3d (points[0], points[1], points[2])); + point_list.emplace_back(points[0], points[1], points[2]); param_list.push_back (params); } @@ -310,7 +310,7 @@ ClosingBoundary::sampleFromBoundary (ON_NurbsSurface *nurbs, vector_vec3d &point { params (0) = minU + (maxU - minU) * ds * i; nurbs->Evaluate (params (0), params (1), 0, 3, points); - point_list.push_back (Eigen::Vector3d (points[0], points[1], points[2])); + point_list.emplace_back(points[0], points[1], points[2]); param_list.push_back (params); } @@ -320,7 +320,7 @@ ClosingBoundary::sampleFromBoundary (ON_NurbsSurface *nurbs, vector_vec3d &point { params (0) = minU + (maxU - minU) * ds * i; nurbs->Evaluate (params (0), params (1), 0, 3, points); - point_list.push_back (Eigen::Vector3d (points[0], points[1], points[2])); + point_list.emplace_back(points[0], points[1], points[2]); param_list.push_back (params); } } diff --git a/surface/src/on_nurbs/fitting_curve_2d.cpp b/surface/src/on_nurbs/fitting_curve_2d.cpp index fbafd5a8fa5..0aceacb41e7 100644 --- a/surface/src/on_nurbs/fitting_curve_2d.cpp +++ b/surface/src/on_nurbs/fitting_curve_2d.cpp @@ -74,7 +74,7 @@ int FittingCurve2d::findElement (double xi, const std::vector &elements) { if (xi >= elements.back ()) - return (int (elements.size ()) - 2); + return (static_cast(elements.size ()) - 2); for (std::size_t i = 0; i < elements.size () - 1; i++) { @@ -120,7 +120,7 @@ FittingCurve2d::assemble (const Parameter ¶meter) { int ncp = m_nurbs.m_cv_count; int nCageReg = m_nurbs.m_cv_count - 2; - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); double wInt = 1.0; if (!m_data->interior_weight.empty ()) @@ -290,7 +290,7 @@ FittingCurve2d::initNurbsPCA (int order, NurbsDataCurve2d *data, int ncps) if (ncps < order) ncps = order; - unsigned s = static_cast (data->interior.size ()); + auto s = static_cast (data->interior.size ()); data->interior_param.clear (); NurbsTools::pca (data->interior, mean, eigenvectors, eigenvalues); @@ -399,7 +399,7 @@ FittingCurve2d::getElementVector (const ON_NurbsCurve &nurbs) void FittingCurve2d::assembleInterior (double wInt, double rScale, unsigned &row) { - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); m_data->interior_error.clear (); m_data->interior_normals.clear (); m_data->interior_line_start.clear (); @@ -413,7 +413,7 @@ FittingCurve2d::assembleInterior (double wInt, double rScale, unsigned &row) double param; Eigen::Vector2d pt, t; double error; - if (p < int (m_data->interior_param.size ())) + if (p < static_cast(m_data->interior_param.size ())) { param = findClosestElementMidPoint (m_nurbs, pcp, m_data->interior_param[p]); param = inverseMapping (m_nurbs, pcp, param, error, pt, t, rScale, in_max_steps, in_accuracy, m_quiet); @@ -428,7 +428,7 @@ FittingCurve2d::assembleInterior (double wInt, double rScale, unsigned &row) m_data->interior_error.push_back (error); - if (p < int (m_data->interior_weight.size ())) + if (p < static_cast(m_data->interior_weight.size ())) wInt = m_data->interior_weight[p]; m_data->interior_line_start.push_back (pcp); diff --git a/surface/src/on_nurbs/fitting_curve_2d_apdm.cpp b/surface/src/on_nurbs/fitting_curve_2d_apdm.cpp index b30bc04f74b..0693b70dbfe 100644 --- a/surface/src/on_nurbs/fitting_curve_2d_apdm.cpp +++ b/surface/src/on_nurbs/fitting_curve_2d_apdm.cpp @@ -75,7 +75,7 @@ int FittingCurve2dAPDM::findElement (double xi, const std::vector &elements) { if (xi >= elements.back ()) - return (int (elements.size ()) - 2); + return (static_cast(elements.size ()) - 2); for (std::size_t i = 0; i < elements.size () - 1; i++) { @@ -148,8 +148,8 @@ FittingCurve2dAPDM::assemble (const Parameter ¶meter) int cp_red = m_nurbs.m_order - 2; int ncp = m_nurbs.m_cv_count - 2 * cp_red; int nCageReg = m_nurbs.m_cv_count - 2 * cp_red; - int nInt = int (m_data->interior.size ()); - int nClosestP = int (elements.size ()) * cp_res; + int nInt = static_cast(m_data->interior.size ()); + int nClosestP = static_cast(elements.size ()) * cp_res; double wInt = 1.0; if (!m_data->interior_weight.empty ()) @@ -330,8 +330,8 @@ FittingCurve2dAPDM::removeCPsOnLine (const ON_NurbsCurve &nurbs, double min_curv } int order = nurbs.Order (); - ON_NurbsCurve nurbs_opt = ON_NurbsCurve (2, false, order, int (cps.size ()) + 2 * cp_red); - nurbs_opt.MakePeriodicUniformKnotVector (1.0 / (double (cps.size ()))); + ON_NurbsCurve nurbs_opt = ON_NurbsCurve (2, false, order, static_cast(cps.size ()) + 2 * cp_red); + nurbs_opt.MakePeriodicUniformKnotVector (1.0 / (static_cast(cps.size ()))); nurbs_opt.m_knot[cp_red] = 0.0; nurbs_opt.m_knot[nurbs_opt.m_knot_capacity - cp_red - 1] = 1.0; @@ -428,7 +428,7 @@ FittingCurve2dAPDM::addCageRegularisation (double weight, unsigned &row, const s { int i = j % ncp; - if (i >= int (m_data->closest_points_error.size () - 1)) + if (i >= static_cast(m_data->closest_points_error.size () - 1)) { printf ("[FittingCurve2dAPDM::addCageRegularisation] Warning, index for closest_points_error out of bounds\n"); m_solver.f (row, 0, 0.0); @@ -512,7 +512,7 @@ FittingCurve2dAPDM::initCPsNurbsCurve2D (int order, const vector_vec2d &cps) return nurbs; } - int ncps = int (cps.size ()) + 2 * cp_red; // +2*cp_red for smoothness and +1 for closing + int ncps = static_cast(cps.size ()) + 2 * cp_red; // +2*cp_red for smoothness and +1 for closing nurbs = ON_NurbsCurve (2, false, order, ncps); nurbs.MakePeriodicUniformKnotVector (1.0 / (ncps - order + 1)); @@ -520,7 +520,7 @@ FittingCurve2dAPDM::initCPsNurbsCurve2D (int order, const vector_vec2d &cps) nurbs.SetCV (cp_red + j, ON_3dPoint (cps[j] (0), cps[j] (1), 0.0)); // close nurbs - nurbs.SetCV (cp_red + int (cps.size ()), ON_3dPoint (cps[0] (0), cps[0] (1), 0.0)); + nurbs.SetCV (cp_red + static_cast(cps.size ()), ON_3dPoint (cps[0] (0), cps[0] (1), 0.0)); // make smooth at closing point for (int j = 0; j < cp_red; j++) @@ -544,7 +544,7 @@ FittingCurve2dAPDM::initNurbsCurve2D (int order, const vector_vec2d &data, int n Eigen::Vector2d mean = NurbsTools::computeMean (data); - unsigned s = unsigned (data.size ()); + auto s = static_cast(data.size ()); double r (0.0); for (unsigned i = 0; i < s; i++) @@ -641,7 +641,7 @@ FittingCurve2dAPDM::getElementVector (const ON_NurbsCurve &nurbs) void FittingCurve2dAPDM::assembleInterior (double wInt, double sigma2, double rScale, unsigned &row) { - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); bool wFunction (true); double ds = 1.0 / (2.0 * sigma2); m_data->interior_error.clear (); @@ -657,7 +657,7 @@ FittingCurve2dAPDM::assembleInterior (double wInt, double sigma2, double rScale, double param; Eigen::Vector2d pt, t; double error; - if (p < int (m_data->interior_param.size ())) + if (p < static_cast(m_data->interior_param.size ())) { param = findClosestElementMidPoint (m_nurbs, pcp, m_data->interior_param[p]); param = inverseMapping (m_nurbs, pcp, param, error, pt, t, rScale, in_max_steps, in_accuracy, m_quiet); @@ -677,10 +677,10 @@ FittingCurve2dAPDM::assembleInterior (double wInt, double sigma2, double rScale, Eigen::Vector3d b (t (0), t (1), 0.0); Eigen::Vector3d z = a.cross (b); - if (p < int (m_data->interior_weight.size ())) + if (p < static_cast(m_data->interior_weight.size ())) wInt = m_data->interior_weight[p]; - if (p < int (m_data->interior_weight_function.size ())) + if (p < static_cast(m_data->interior_weight_function.size ())) wFunction = m_data->interior_weight_function[p]; double w (wInt); diff --git a/surface/src/on_nurbs/fitting_curve_2d_asdm.cpp b/surface/src/on_nurbs/fitting_curve_2d_asdm.cpp index dbdc041942c..1cf4d3f333d 100644 --- a/surface/src/on_nurbs/fitting_curve_2d_asdm.cpp +++ b/surface/src/on_nurbs/fitting_curve_2d_asdm.cpp @@ -59,12 +59,12 @@ FittingCurve2dASDM::assemble (const FittingCurve2dAPDM::Parameter ¶meter) int cp_red = m_nurbs.m_order - 2; int ncp = m_nurbs.m_cv_count - 2 * cp_red; int nCageReg = m_nurbs.m_cv_count - 2 * cp_red; - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); // int nCommon = m_data->common.size(); // int nClosestP = parameter.closest_point_resolution; std::vector elements = getElementVector (m_nurbs); - int nClosestP = int (elements.size ()); + int nClosestP = static_cast(elements.size ()); double wInt = 1.0; if (!m_data->interior_weight.empty ()) @@ -213,7 +213,7 @@ FittingCurve2dASDM::addCageRegularisation (double weight, unsigned &row, const s { int i = j % ncp; - if (i >= int (m_data->closest_points_error.size () - 1)) + if (i >= static_cast(m_data->closest_points_error.size () - 1)) { printf ("[FittingCurve2dASDM::addCageRegularisation] Warning, index for closest_points_error out of bounds\n"); } @@ -259,7 +259,7 @@ FittingCurve2dASDM::addCageRegularisation (double weight, unsigned &row, const s void FittingCurve2dASDM::assembleInterior (double wInt, double sigma2, double rScale, unsigned &row) { - unsigned nInt = unsigned (m_data->interior.size ()); + auto nInt = static_cast(m_data->interior.size ()); bool wFunction (true); double ds = 1.0 / (2.0 * sigma2); m_data->interior_line_start.clear (); @@ -410,7 +410,7 @@ FittingCurve2dASDM::assembleClosestPoints (const std::vector &elements, for (std::size_t i = 0; i < elements.size (); i++) { - int j = (i + 1) % int (elements.size ()); + int j = (i + 1) % static_cast(elements.size ()); double dxi = elements[j] - elements[i]; double xi = elements[i] + 0.5 * dxi; @@ -444,7 +444,7 @@ FittingCurve2dASDM::assembleClosestPoints (const std::vector &elements, if (m_data->closest_rho.size () != elements.size ()) { printf ("[FittingCurve2dASDM::assembleClosestPoints] ERROR: size does not match %d %d\n", - int (m_data->closest_rho.size ()), int (elements.size ())); + static_cast(m_data->closest_rho.size ()), static_cast(elements.size ())); } else { diff --git a/surface/src/on_nurbs/fitting_curve_2d_atdm.cpp b/surface/src/on_nurbs/fitting_curve_2d_atdm.cpp index 8c66856a47e..10fe12c2c2e 100644 --- a/surface/src/on_nurbs/fitting_curve_2d_atdm.cpp +++ b/surface/src/on_nurbs/fitting_curve_2d_atdm.cpp @@ -58,12 +58,12 @@ FittingCurve2dATDM::assemble (const FittingCurve2dAPDM::Parameter ¶meter) int cp_red = m_nurbs.m_order - 2; int ncp = m_nurbs.m_cv_count - 2 * cp_red; int nCageReg = m_nurbs.m_cv_count - 2 * cp_red; - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); // int nCommon = m_data->common.size(); // int nClosestP = parameter.closest_point_resolution; std::vector elements = getElementVector (m_nurbs); - int nClosestP = int (elements.size ()); + int nClosestP = static_cast(elements.size ()); double wInt = 1.0; if (!m_data->interior_weight.empty ()) @@ -189,7 +189,7 @@ FittingCurve2dATDM::addCageRegularisation (double weight, unsigned &row, const s { int i = j % ncp; - if (i >= int (m_data->closest_points_error.size () - 1)) + if (i >= static_cast(m_data->closest_points_error.size () - 1)) { printf ("[FittingCurve2dATDM::addCageRegularisation] Warning, index for closest_points_error out of bounds\n"); } @@ -235,7 +235,7 @@ FittingCurve2dATDM::addCageRegularisation (double weight, unsigned &row, const s void FittingCurve2dATDM::assembleInterior (double wInt, double sigma2, double rScale, unsigned &row) { - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); bool wFunction (true); double ds = 1.0 / (2.0 * sigma2); m_data->interior_line_start.clear (); @@ -250,7 +250,7 @@ FittingCurve2dATDM::assembleInterior (double wInt, double sigma2, double rScale, double param; Eigen::Vector2d pt, t, n; double error; - if (p < int (m_data->interior_param.size ())) + if (p < static_cast(m_data->interior_param.size ())) { param = findClosestElementMidPoint (m_nurbs, pcp, m_data->interior_param[p]); param = inverseMapping (m_nurbs, pcp, param, error, pt, t, rScale, in_max_steps, in_accuracy, m_quiet); @@ -279,10 +279,10 @@ FittingCurve2dATDM::assembleInterior (double wInt, double sigma2, double rScale, Eigen::Vector3d b (t (0), t (1), 0.0); Eigen::Vector3d z = a.cross (b); - if (p < int (m_data->interior_weight.size ())) + if (p < static_cast(m_data->interior_weight.size ())) wInt = m_data->interior_weight[p]; - if (p < int (m_data->interior_weight_function.size ())) + if (p < static_cast(m_data->interior_weight_function.size ())) wFunction = m_data->interior_weight_function[p]; double w (wInt); @@ -325,7 +325,7 @@ FittingCurve2dATDM::assembleClosestPoints (const std::vector &elements, for (std::size_t i = 0; i < elements.size (); i++) { - int j = i % int (elements.size ()); + int j = i % static_cast(elements.size ()); double dxi = elements[j] - elements[i]; double xi = elements[i] + 0.5 * dxi; diff --git a/surface/src/on_nurbs/fitting_curve_2d_pdm.cpp b/surface/src/on_nurbs/fitting_curve_2d_pdm.cpp index 4310a8d4b34..0bc30e45ca6 100644 --- a/surface/src/on_nurbs/fitting_curve_2d_pdm.cpp +++ b/surface/src/on_nurbs/fitting_curve_2d_pdm.cpp @@ -74,7 +74,7 @@ int FittingCurve2dPDM::findElement (double xi, const std::vector &elements) { if (xi >= elements.back ()) - return (int (elements.size ()) - 2); + return (static_cast(elements.size ()) - 2); for (std::size_t i = 0; i < elements.size () - 1; i++) { @@ -121,7 +121,7 @@ FittingCurve2dPDM::assemble (const Parameter ¶meter) int cp_red = m_nurbs.m_order - 2; int ncp = m_nurbs.m_cv_count - 2 * cp_red; int nCageReg = m_nurbs.m_cv_count - 2 * cp_red; - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); double wInt = 1.0; if (!m_data->interior_weight.empty ()) @@ -296,8 +296,8 @@ FittingCurve2dPDM::removeCPsOnLine (const ON_NurbsCurve &nurbs, double min_curve } int order = nurbs.Order (); - ON_NurbsCurve nurbs_opt = ON_NurbsCurve (2, false, order, int (cps.size ()) + 2 * cp_red); - nurbs_opt.MakePeriodicUniformKnotVector (1.0 / double (cps.size ())); + ON_NurbsCurve nurbs_opt = ON_NurbsCurve (2, false, order, static_cast(cps.size ()) + 2 * cp_red); + nurbs_opt.MakePeriodicUniformKnotVector (1.0 / static_cast(cps.size ())); nurbs_opt.m_knot[cp_red] = 0.0; nurbs_opt.m_knot[nurbs_opt.m_knot_capacity - cp_red - 1] = 1.0; @@ -372,7 +372,7 @@ FittingCurve2dPDM::initCPsNurbsCurve2D (int order, const vector_vec2d &cps) return nurbs; } - int ncps = int (cps.size ()) + 2 * cp_red; // +2*cp_red for smoothness and +1 for closing + int ncps = static_cast(cps.size ()) + 2 * cp_red; // +2*cp_red for smoothness and +1 for closing nurbs = ON_NurbsCurve (2, false, order, ncps); nurbs.MakePeriodicUniformKnotVector (1.0 / (ncps - order + 1)); @@ -380,7 +380,7 @@ FittingCurve2dPDM::initCPsNurbsCurve2D (int order, const vector_vec2d &cps) nurbs.SetCV (cp_red + j, ON_3dPoint (cps[j] (0), cps[j] (1), 0.0)); // close nurbs - nurbs.SetCV (cp_red + int (cps.size ()), ON_3dPoint (cps[0] (0), cps[0] (1), 0.0)); + nurbs.SetCV (cp_red + static_cast(cps.size ()), ON_3dPoint (cps[0] (0), cps[0] (1), 0.0)); // make smooth at closing point for (int j = 0; j < cp_red; j++) @@ -404,7 +404,7 @@ FittingCurve2dPDM::initNurbsCurve2D (int order, const vector_vec2d &data, int nc Eigen::Vector2d mean = NurbsTools::computeMean (data); - unsigned s = unsigned (data.size ()); + auto s = static_cast(data.size ()); double r (0.0); for (unsigned i = 0; i < s; i++) @@ -516,7 +516,7 @@ FittingCurve2dPDM::getElementVector (const ON_NurbsCurve &nurbs) void FittingCurve2dPDM::assembleInterior (double wInt, double rScale, unsigned &row) { - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); m_data->interior_error.clear (); m_data->interior_normals.clear (); m_data->interior_line_start.clear (); @@ -530,7 +530,7 @@ FittingCurve2dPDM::assembleInterior (double wInt, double rScale, unsigned &row) double param; Eigen::Vector2d pt, t; double error; - if (p < int (m_data->interior_param.size ())) + if (p < static_cast(m_data->interior_param.size ())) { param = findClosestElementMidPoint (m_nurbs, pcp, m_data->interior_param[p]); param = inverseMapping (m_nurbs, pcp, param, error, pt, t, rScale, in_max_steps, in_accuracy, m_quiet); @@ -545,7 +545,7 @@ FittingCurve2dPDM::assembleInterior (double wInt, double rScale, unsigned &row) m_data->interior_error.push_back (error); - if (p < int (m_data->interior_weight.size ())) + if (p < static_cast(m_data->interior_weight.size ())) wInt = m_data->interior_weight[p]; m_data->interior_line_start.push_back (pcp); diff --git a/surface/src/on_nurbs/fitting_curve_2d_sdm.cpp b/surface/src/on_nurbs/fitting_curve_2d_sdm.cpp index a08b6faece8..996a4f0fd76 100644 --- a/surface/src/on_nurbs/fitting_curve_2d_sdm.cpp +++ b/surface/src/on_nurbs/fitting_curve_2d_sdm.cpp @@ -59,7 +59,7 @@ FittingCurve2dSDM::assemble (const FittingCurve2dPDM::Parameter ¶meter) int cp_red = m_nurbs.m_order - 2; int ncp = m_nurbs.m_cv_count - 2 * cp_red; int nCageReg = m_nurbs.m_cv_count - 2 * cp_red; - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); double wInt = 1.0; if (!m_data->interior_weight.empty ()) @@ -211,7 +211,7 @@ FittingCurve2dSDM::addCageRegularisation (double weight, unsigned &row) void FittingCurve2dSDM::assembleInterior (double wInt, double rScale, unsigned &row) { - unsigned nInt = int (m_data->interior.size ()); + auto nInt = static_cast(m_data->interior.size ()); m_data->interior_line_start.clear (); m_data->interior_line_end.clear (); m_data->interior_error.clear (); diff --git a/surface/src/on_nurbs/fitting_curve_2d_tdm.cpp b/surface/src/on_nurbs/fitting_curve_2d_tdm.cpp index e7b04cf3c11..88478b19fc0 100644 --- a/surface/src/on_nurbs/fitting_curve_2d_tdm.cpp +++ b/surface/src/on_nurbs/fitting_curve_2d_tdm.cpp @@ -57,7 +57,7 @@ FittingCurve2dTDM::assemble (const FittingCurve2dPDM::Parameter ¶meter) int cp_red = m_nurbs.m_order - 2; int ncp = m_nurbs.m_cv_count - 2 * cp_red; int nCageReg = m_nurbs.m_cv_count - 2 * cp_red; - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); double wInt = 1.0; if (!m_data->interior_weight.empty ()) @@ -189,7 +189,7 @@ FittingCurve2dTDM::addCageRegularisation (double weight, unsigned &row) void FittingCurve2dTDM::assembleInterior (double wInt, double rScale, unsigned &row) { - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); m_data->interior_line_start.clear (); m_data->interior_line_end.clear (); m_data->interior_error.clear (); @@ -202,7 +202,7 @@ FittingCurve2dTDM::assembleInterior (double wInt, double rScale, unsigned &row) double param; Eigen::Vector2d pt, t, n; double error; - if (p < int (m_data->interior_param.size ())) + if (p < static_cast(m_data->interior_param.size ())) { param = findClosestElementMidPoint (m_nurbs, pcp, m_data->interior_param[p]); param = inverseMapping (m_nurbs, pcp, param, error, pt, t, rScale, in_max_steps, in_accuracy, m_quiet); @@ -227,7 +227,7 @@ FittingCurve2dTDM::assembleInterior (double wInt, double rScale, unsigned &row) n (1) = pointAndTangents[5]; n.normalize (); - if (p < int (m_data->interior_weight.size ())) + if (p < static_cast(m_data->interior_weight.size ())) wInt = m_data->interior_weight[p]; addPointConstraint (m_data->interior_param[p], m_data->interior[p], n, wInt, row); diff --git a/surface/src/on_nurbs/fitting_curve_pdm.cpp b/surface/src/on_nurbs/fitting_curve_pdm.cpp index 95ec19b1538..67e993ada8e 100644 --- a/surface/src/on_nurbs/fitting_curve_pdm.cpp +++ b/surface/src/on_nurbs/fitting_curve_pdm.cpp @@ -74,7 +74,7 @@ int FittingCurve::findElement (double xi, const std::vector &elements) { if (xi >= elements.back ()) - return (int (elements.size ()) - 2); + return (static_cast(elements.size ()) - 2); for (std::size_t i = 0; i < elements.size () - 1; i++) { @@ -109,7 +109,7 @@ FittingCurve::assemble (const Parameter ¶meter) int cp_red = m_nurbs.m_order - 2; int ncp = m_nurbs.m_cv_count - 2 * cp_red; int nCageReg = m_nurbs.m_cv_count - 2 * cp_red; - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); int nrows = nInt + nCageReg; @@ -213,7 +213,7 @@ FittingCurve::initNurbsCurve2D (int order, const vector_vec2d &data) Eigen::Vector2d mean = NurbsTools::computeMean (data); - unsigned s = unsigned (data.size ()); + auto s = static_cast(data.size ()); double r (0.0); for (unsigned i = 0; i < s; i++) @@ -252,7 +252,7 @@ FittingCurve::initNurbsCurvePCA (int order, const vector_vec3d &data, int ncps, Eigen::Matrix3d eigenvectors; Eigen::Vector3d eigenvalues; - unsigned s = unsigned (data.size ()); + auto s = static_cast(data.size ()); NurbsTools::pca (data, mean, eigenvectors, eigenvalues); @@ -312,7 +312,7 @@ FittingCurve::getElementVector (const ON_NurbsCurve &nurbs) void FittingCurve::assembleInterior (double wInt, unsigned &row) { - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); m_data->interior_line_start.clear (); m_data->interior_line_end.clear (); m_data->interior_error.clear (); @@ -325,7 +325,7 @@ FittingCurve::assembleInterior (double wInt, unsigned &row) double param; Eigen::Vector3d pt, t; double error; - if (p < int (m_data->interior_param.size ())) + if (p < static_cast(m_data->interior_param.size ())) { param = inverseMapping (m_nurbs, pcp, m_data->interior_param[p], error, pt, t, in_max_steps, in_accuracy); m_data->interior_param[p] = param; diff --git a/surface/src/on_nurbs/fitting_cylinder_pdm.cpp b/surface/src/on_nurbs/fitting_cylinder_pdm.cpp index 5f3b970df9a..bebcc2dcedc 100644 --- a/surface/src/on_nurbs/fitting_cylinder_pdm.cpp +++ b/surface/src/on_nurbs/fitting_cylinder_pdm.cpp @@ -136,7 +136,7 @@ FittingCylinder::assemble (double smoothness) { int cp_red = (m_nurbs.m_order[1] - 2); int ncp = m_nurbs.m_cv_count[0] * (m_nurbs.m_cv_count[1] - 2 * cp_red); - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); int nCageRegInt = (m_nurbs.m_cv_count[0] - 2) * (m_nurbs.m_cv_count[1] - 2 * cp_red); int nCageRegBnd = 2 * (m_nurbs.m_cv_count[1] - 2 * cp_red); @@ -224,7 +224,7 @@ FittingCylinder::initNurbsPCACylinder (int order, NurbsDataSurface *data) Eigen::Matrix3d eigenvectors; Eigen::Vector3d eigenvalues; - unsigned s = unsigned (data->interior.size ()); + auto s = static_cast(data->interior.size ()); NurbsTools::pca (data->interior, mean, eigenvectors, eigenvalues); @@ -289,7 +289,7 @@ FittingCylinder::initNurbsCylinderWithAxes (int order, NurbsDataSurface *data, E { Eigen::Vector3d mean; - unsigned s = unsigned (data->interior.size ()); + auto s = static_cast(data->interior.size ()); mean = NurbsTools::computeMean (data->interior); data->mean = mean; @@ -410,7 +410,7 @@ FittingCylinder::assembleInterior (double wInt, unsigned &row) m_data->interior_line_end.clear (); m_data->interior_error.clear (); m_data->interior_normals.clear (); - unsigned nInt = unsigned (m_data->interior.size ()); + auto nInt = static_cast(m_data->interior.size ()); for (unsigned p = 0; p < nInt; p++) { Vector3d pcp; diff --git a/surface/src/on_nurbs/fitting_sphere_pdm.cpp b/surface/src/on_nurbs/fitting_sphere_pdm.cpp index 296df348d4c..23ddcf9214e 100644 --- a/surface/src/on_nurbs/fitting_sphere_pdm.cpp +++ b/surface/src/on_nurbs/fitting_sphere_pdm.cpp @@ -83,7 +83,7 @@ FittingSphere::assemble (double smoothness) { int cp_red = (m_nurbs.m_order[1] - 2); int ncp = m_nurbs.m_cv_count[0] * (m_nurbs.m_cv_count[1] - 2 * cp_red); - int nInt = int (m_data->interior.size ()); + int nInt = static_cast(m_data->interior.size ()); int nCageRegInt = (m_nurbs.m_cv_count[0] - 2) * (m_nurbs.m_cv_count[1] - 2 * cp_red); int nCageRegBnd = 2 * (m_nurbs.m_cv_count[1] - 2 * cp_red); @@ -311,7 +311,7 @@ FittingSphere::assembleInterior (double wInt, unsigned &row) m_data->interior_line_end.clear (); m_data->interior_error.clear (); m_data->interior_normals.clear (); - unsigned nInt = unsigned (m_data->interior.size ()); + auto nInt = static_cast(m_data->interior.size ()); for (unsigned p = 0; p < nInt; p++) { Vector3d pcp; diff --git a/surface/src/on_nurbs/fitting_surface_im.cpp b/surface/src/on_nurbs/fitting_surface_im.cpp index f86d0d653f1..a2d0b2537c3 100644 --- a/surface/src/on_nurbs/fitting_surface_im.cpp +++ b/surface/src/on_nurbs/fitting_surface_im.cpp @@ -53,7 +53,7 @@ FittingSurfaceIM::computeMean () const u.y = 0.0; u.z = 0.0; - double ds = 1.0 / double (m_indices.size ()); + double ds = 1.0 / static_cast(m_indices.size ()); const pcl::PointCloud &cloud_ref = *m_cloud; for (const auto &index : m_indices) @@ -65,9 +65,9 @@ FittingSurfaceIM::computeMean () const if (std::isnan (point.x) || std::isnan (point.y) || std::isnan (point.z)) continue; - u.x += point.x * float (ds); - u.y += point.y * float (ds); - u.z += point.z * float (ds); + u.x += point.x * static_cast(ds); + u.y += point.y * static_cast(ds); + u.z += point.z * static_cast(ds); } return u; @@ -181,19 +181,19 @@ FittingSurfaceIM::refine () Eigen::Vector2d bbx (m_nurbs.Knot (0, 0), m_nurbs.Knot (0, m_nurbs.KnotCount (0) - 1)); Eigen::Vector2d bby (m_nurbs.Knot (1, 0), m_nurbs.Knot (1, m_nurbs.KnotCount (1) - 1)); - int dx = int (bbx (1) - bbx (0)); - int dy = int (bby (1) - bby (0)); - double ddx = double (dx) / (m_nurbs.CVCount (0) - 1); - double ddy = double (dy) / (m_nurbs.CVCount (1) - 1); + int dx = static_cast(bbx (1) - bbx (0)); + int dy = static_cast(bby (1) - bby (0)); + double ddx = static_cast(dx) / (m_nurbs.CVCount (0) - 1); + double ddy = static_cast(dy) / (m_nurbs.CVCount (1) - 1); m_cps_px.clear (); for (int i = 0; i < m_nurbs.CVCount (0); i++) { for (int j = 0; j < m_nurbs.CVCount (1); j++) { - int px = int (bbx (0) + ddx * i); - int py = int (bby (0) + ddy * j); - m_cps_px.push_back (Eigen::Vector2i (px, py)); + int px = static_cast(bbx (0) + ddx * i); + int py = static_cast(bby (0) + ddy * j); + m_cps_px.emplace_back(px, py); } } } @@ -244,10 +244,10 @@ FittingSurfaceIM::initSurface (int order, const Eigen::Vector4d &bb) { for (int j = 0; j < m_nurbs.Order (1); j++) { - int px = int (m_bb (0) + ddx * i + 0.5); - int py = int (m_bb (2) + ddy * j + 0.5); + int px = static_cast(m_bb (0) + ddx * i + 0.5); + int py = static_cast(m_bb (2) + ddy * j + 0.5); - m_cps_px.push_back (Eigen::Vector2i (px, py)); + m_cps_px.emplace_back(px, py); ON_3dPoint p; p.x = pt.z * (px - m_intrinsic (0, 2)) / m_intrinsic (0, 0); @@ -265,7 +265,7 @@ FittingSurfaceIM::initSurface (int order, const Eigen::Vector4d &bb) void FittingSurfaceIM::assemble (bool inverse_mapping) { - int nInt = int (m_indices.size ()); + int nInt = static_cast(m_indices.size ()); int nCageReg = (m_nurbs.m_cv_count[0] - 2) * (m_nurbs.m_cv_count[1] - 2); int nCageRegBnd = 2 * (m_nurbs.m_cv_count[0] - 1) + 2 * (m_nurbs.m_cv_count[1] - 1); @@ -296,8 +296,8 @@ FittingSurfaceIM::assemble (bool inverse_mapping) Eigen::Vector3d p, tu, tv; Eigen::Vector2d params1 (params (0), params (1)); params1 = inverseMapping (m_nurbs, point, params1, error, p, tu, tv, 200, 1e-6, true); - params (0) = int (params1 (0)); - params (1) = int (params1 (1)); + params (0) = static_cast(params1 (0)); + params (1) = static_cast(params1 (1)); } addPointConstraint (params, pt.z, 1.0, row); diff --git a/surface/src/on_nurbs/fitting_surface_pdm.cpp b/surface/src/on_nurbs/fitting_surface_pdm.cpp index 0fd07201d25..fbbbe42dc45 100644 --- a/surface/src/on_nurbs/fitting_surface_pdm.cpp +++ b/surface/src/on_nurbs/fitting_surface_pdm.cpp @@ -282,7 +282,7 @@ FittingSurface::assembleInterior (double wInt, unsigned &row) m_data->interior_line_end.clear (); m_data->interior_error.clear (); m_data->interior_normals.clear (); - unsigned nInt = static_cast (m_data->interior.size ()); + auto nInt = static_cast (m_data->interior.size ()); for (unsigned p = 0; p < nInt; p++) { Vector3d &pcp = m_data->interior[p]; @@ -326,7 +326,7 @@ FittingSurface::assembleBoundary (double wBnd, unsigned &row) m_data->boundary_line_end.clear (); m_data->boundary_error.clear (); m_data->boundary_normals.clear (); - unsigned nBnd = static_cast (m_data->boundary.size ()); + auto nBnd = static_cast (m_data->boundary.size ()); for (unsigned p = 0; p < nBnd; p++) { Vector3d &pcp = m_data->boundary[p]; @@ -407,7 +407,7 @@ FittingSurface::initNurbsPCA (int order, NurbsDataSurface *m_data, Eigen::Vector Eigen::Matrix3d eigenvectors; Eigen::Vector3d eigenvalues; - unsigned s = static_cast (m_data->interior.size ()); + auto s = static_cast (m_data->interior.size ()); NurbsTools::pca (m_data->interior, mean, eigenvectors, eigenvalues); @@ -455,7 +455,7 @@ FittingSurface::initNurbsPCABoundingBox (int order, NurbsDataSurface *m_data, Ei Eigen::Matrix3d eigenvectors; Eigen::Vector3d eigenvalues; - unsigned s = static_cast (m_data->interior.size ()); + auto s = static_cast (m_data->interior.size ()); m_data->interior_param.clear (); NurbsTools::pca (m_data->interior, mean, eigenvectors, eigenvalues); @@ -479,7 +479,7 @@ FittingSurface::initNurbsPCABoundingBox (int order, NurbsDataSurface *m_data, Ei for (unsigned i = 0; i < s; i++) { Eigen::Vector3d p (eigenvectors_inv * (m_data->interior[i] - mean)); - m_data->interior_param.push_back (Eigen::Vector2d (p (0), p (1))); + m_data->interior_param.emplace_back (p (0), p (1)); if (p (0) > v_max (0)) v_max (0) = p (0); @@ -1168,15 +1168,15 @@ FittingSurface::inverseMappingBoundary (const ON_NurbsSurface &nurbs, const Vect // NORTH - SOUTH for (std::size_t i = 0; i < (elementsV.size () - 1); i++) { - ini_points.emplace_back(WEST, elementsV[i] + 0.5 * (elementsV[i + 1] - elementsV[i])); - ini_points.emplace_back(EAST, elementsV[i] + 0.5 * (elementsV[i + 1] - elementsV[i])); + ini_points.emplace_back (WEST, elementsV[i] + 0.5 * (elementsV[i + 1] - elementsV[i])); + ini_points.emplace_back (EAST, elementsV[i] + 0.5 * (elementsV[i + 1] - elementsV[i])); } // WEST - EAST for (std::size_t i = 0; i < (elementsU.size () - 1); i++) { - ini_points.emplace_back(NORTH, elementsU[i] + 0.5 * (elementsU[i + 1] - elementsU[i])); - ini_points.emplace_back(SOUTH, elementsU[i] + 0.5 * (elementsU[i + 1] - elementsU[i])); + ini_points.emplace_back (NORTH, elementsU[i] + 0.5 * (elementsU[i + 1] - elementsU[i])); + ini_points.emplace_back (SOUTH, elementsU[i] + 0.5 * (elementsU[i + 1] - elementsU[i])); } for (std::size_t i = 0; i < ini_points.size (); i++) diff --git a/surface/src/on_nurbs/fitting_surface_tdm.cpp b/surface/src/on_nurbs/fitting_surface_tdm.cpp index fd71feb60de..fe2df537472 100644 --- a/surface/src/on_nurbs/fitting_surface_tdm.cpp +++ b/surface/src/on_nurbs/fitting_surface_tdm.cpp @@ -145,7 +145,7 @@ FittingSurfaceTDM::assembleInterior (double wInt, double wTangent, unsigned &row m_data->interior_line_end.clear (); m_data->interior_error.clear (); m_data->interior_normals.clear (); - unsigned nInt = static_cast (m_data->interior.size ()); + auto nInt = static_cast (m_data->interior.size ()); for (unsigned p = 0; p < nInt; p++) { Vector3d &pcp = m_data->interior[p]; @@ -190,7 +190,7 @@ FittingSurfaceTDM::assembleBoundary (double wBnd, double wTangent, unsigned &row m_data->boundary_line_end.clear (); m_data->boundary_error.clear (); m_data->boundary_normals.clear (); - unsigned nBnd = static_cast (m_data->boundary.size ()); + auto nBnd = static_cast (m_data->boundary.size ()); for (unsigned p = 0; p < nBnd; p++) { Vector3d &pcp = m_data->boundary[p]; diff --git a/surface/src/on_nurbs/global_optimization_pdm.cpp b/surface/src/on_nurbs/global_optimization_pdm.cpp index 079dc0726a1..d3875524ab8 100644 --- a/surface/src/on_nurbs/global_optimization_pdm.cpp +++ b/surface/src/on_nurbs/global_optimization_pdm.cpp @@ -78,7 +78,7 @@ GlobalOptimization::assemble (Parameter params) { // determine number of rows of matrix m_ncols = 0; - unsigned nnurbs = static_cast (m_nurbs.size ()); + auto nnurbs = static_cast (m_nurbs.size ()); unsigned nInt (0), nBnd (0), nCageRegInt (0), nCageRegBnd (0), nCommonBnd (0), nCommonPar (0); for (unsigned i = 0; i < nnurbs; i++) { @@ -413,7 +413,7 @@ GlobalOptimization::assembleBoundaryPoints (unsigned id, int ncps, double weight ON_NurbsSurface *nurbs = m_nurbs[id]; NurbsDataSurface *data = m_data[id]; - unsigned nBnd = static_cast (m_data[id]->boundary.size ()); + auto nBnd = static_cast (m_data[id]->boundary.size ()); // interior points should lie on surface data->boundary_line_start.clear (); diff --git a/surface/src/on_nurbs/global_optimization_tdm.cpp b/surface/src/on_nurbs/global_optimization_tdm.cpp index fa9bd21606d..a0ae969fbae 100644 --- a/surface/src/on_nurbs/global_optimization_tdm.cpp +++ b/surface/src/on_nurbs/global_optimization_tdm.cpp @@ -57,7 +57,7 @@ GlobalOptimizationTDM::assemble (Parameter params) { // determine number of rows of matrix m_ncols = 0; - unsigned nnurbs = static_cast (m_nurbs.size ()); + auto nnurbs = static_cast (m_nurbs.size ()); unsigned nInt (0), nBnd (0), nCageRegInt (0), nCageRegBnd (0), nCommonBnd (0); for (unsigned i = 0; i < nnurbs; i++) { @@ -127,7 +127,7 @@ GlobalOptimizationTDM::assemble (ParameterTDM params) { // determine number of rows of matrix m_ncols = 0; - unsigned nnurbs = static_cast (m_nurbs.size ()); + auto nnurbs = static_cast (m_nurbs.size ()); unsigned nInt (0), nBnd (0), nCageRegInt (0), nCageRegBnd (0), nCommonBnd (0), nCommonPar (0); for (unsigned i = 0; i < nnurbs; i++) { @@ -453,7 +453,7 @@ GlobalOptimizationTDM::assembleInteriorPoints (unsigned id, int ncps, double wei ON_NurbsSurface *nurbs = m_nurbs[id]; NurbsDataSurface *data = m_data[id]; - unsigned nInt = static_cast (m_data[id]->interior.size ()); + auto nInt = static_cast (m_data[id]->interior.size ()); // interior points should lie on surface data->interior_line_start.clear (); @@ -506,7 +506,7 @@ GlobalOptimizationTDM::assembleInteriorPointsTD (unsigned id, int ncps, double w ON_NurbsSurface *nurbs = m_nurbs[id]; NurbsDataSurface *data = m_data[id]; - unsigned nInt = static_cast (m_data[id]->interior.size ()); + auto nInt = static_cast (m_data[id]->interior.size ()); // interior points should lie on surface data->interior_line_start.clear (); @@ -560,7 +560,7 @@ GlobalOptimizationTDM::assembleBoundaryPoints (unsigned id, int ncps, double wei ON_NurbsSurface *nurbs = m_nurbs[id]; NurbsDataSurface *data = m_data[id]; - unsigned nBnd = static_cast (m_data[id]->boundary.size ()); + auto nBnd = static_cast (m_data[id]->boundary.size ()); // interior points should lie on surface data->boundary_line_start.clear (); diff --git a/surface/src/on_nurbs/nurbs_tools.cpp b/surface/src/on_nurbs/nurbs_tools.cpp index b429883ba4a..1da9b42d75b 100644 --- a/surface/src/on_nurbs/nurbs_tools.cpp +++ b/surface/src/on_nurbs/nurbs_tools.cpp @@ -57,12 +57,12 @@ NurbsTools::downsample_random (const vector_vec3d &data1, vector_vec3d &data2, u return; } - unsigned s = unsigned (data1.size ()); + auto s = static_cast(data1.size ()); data2.clear (); for (unsigned i = 0; i < size; i++) { - unsigned rnd = unsigned (s * (double (rand ()) / RAND_MAX)); + auto rnd = static_cast(s * (static_cast(rand ()) / RAND_MAX)); data2.push_back (data1[rnd]); } } @@ -73,13 +73,13 @@ NurbsTools::downsample_random (vector_vec3d &data, unsigned size) if (data.size () <= size && size > 0) return; - unsigned s = unsigned (data.size ()); + auto s = static_cast(data.size ()); vector_vec3d data_tmp; for (unsigned i = 0; i < size; i++) { - unsigned rnd = unsigned ((s - 1) * (double (rand ()) / RAND_MAX)); + auto rnd = static_cast((s - 1) * (static_cast(rand ()) / RAND_MAX)); data_tmp.push_back (data[rnd]); } @@ -168,7 +168,7 @@ NurbsTools::computeMean (const vector_vec3d &data) { Eigen::Vector3d u (0.0, 0.0, 0.0); - unsigned s = unsigned (data.size ()); + auto s = static_cast(data.size ()); double ds = 1.0 / s; for (unsigned i = 0; i < s; i++) @@ -183,7 +183,7 @@ NurbsTools::computeMean (const vector_vec2d &data) Eigen::Vector2d u (0.0, 0.0); std::size_t s = data.size (); - double ds = 1.0 / double (s); + double ds = 1.0 / static_cast(s); for (std::size_t i = 0; i < s; i++) u += (data[i] * ds); @@ -197,7 +197,7 @@ NurbsTools::computeVariance (const Eigen::Vector3d &mean, const vector_vec3d &da Eigen::Vector3d var (0.0, 0.0, 0.0); std::size_t s = data.size (); - double ds = 1.0 / double (s); + double ds = 1.0 / static_cast(s); for (std::size_t i = 0; i < s; i++) { @@ -214,7 +214,7 @@ NurbsTools::computeVariance (const Eigen::Vector2d &mean, const vector_vec2d &da Eigen::Vector2d var (0.0, 0.0); std::size_t s = data.size (); - double ds = 1.0 / double (s); + double ds = 1.0 / static_cast(s); for (std::size_t i = 0; i < s; i++) { @@ -306,7 +306,7 @@ NurbsTools::pca (const vector_vec3d &data, Eigen::Vector3d &mean, Eigen::Matrix3 mean = computeMean (data); - unsigned s = unsigned (data.size ()); + auto s = static_cast(data.size ()); Eigen::MatrixXd Q (3, s); @@ -344,7 +344,7 @@ NurbsTools::pca (const vector_vec2d &data, Eigen::Vector2d &mean, Eigen::Matrix2 mean = computeMean (data); - unsigned s = unsigned (data.size ()); + auto s = static_cast(data.size ()); Eigen::MatrixXd Q (2, s); diff --git a/surface/src/on_nurbs/sequential_fitter.cpp b/surface/src/on_nurbs/sequential_fitter.cpp index 9cdb6bf2521..6f22f6b5aa7 100644 --- a/surface/src/on_nurbs/sequential_fitter.cpp +++ b/surface/src/on_nurbs/sequential_fitter.cpp @@ -385,7 +385,7 @@ SequentialFitter::compute_boundary (const ON_NurbsSurface &nurbs) return nurbs; } - FittingSurface *fitting = new FittingSurface (&m_data, nurbs); + auto *fitting = new FittingSurface (&m_data, nurbs); this->compute_boundary (fitting); @@ -407,7 +407,7 @@ SequentialFitter::compute_interior (const ON_NurbsSurface &nurbs) printf ("[SequentialFitter::compute_interior] Warning, no interior points given: setInterior()\n"); return nurbs; } - FittingSurface *fitting = new FittingSurface (&m_data, nurbs); + auto *fitting = new FittingSurface (&m_data, nurbs); this->compute_interior (fitting); @@ -475,12 +475,12 @@ SequentialFitter::getClosestPointOnNurbs ( ON_NurbsSurface SequentialFitter::grow (float max_dist, float max_angle, unsigned min_length, unsigned max_length) { - unsigned num_bnd = unsigned (this->m_data.boundary_param.size ()); + auto num_bnd = static_cast(this->m_data.boundary_param.size ()); if (num_bnd == 0) throw std::runtime_error ("[SequentialFitter::grow] No boundary given."); - if (unsigned (this->m_data.boundary.size ()) != num_bnd) + if (static_cast(this->m_data.boundary.size ()) != num_bnd) { printf ("[SequentialFitter::grow] %zu %u\n", this->m_data.boundary.size (), num_bnd); throw std::runtime_error ("[SequentialFitter::grow] size of boundary and boundary parameters do not match."); @@ -544,14 +544,14 @@ SequentialFitter::grow (float max_dist, float max_angle, unsigned min_length, un pcl::PointXYZRGB point = m_cloud->at (this->m_boundary_indices->indices[i]); for (unsigned j = min_length; j < max_length; j++) { - int col = int (ri (0) + bni (0) * j); - int row = int (ri (1) + bni (1) * j); + int col = static_cast(ri (0) + bni (0) * j); + int row = static_cast(ri (1) + bni (1) * j); - if (row >= int (m_cloud->height) || row < 0) + if (row >= static_cast(m_cloud->height) || row < 0) { break; } - if (col >= int (m_cloud->width) || col < 0) + if (col >= static_cast(m_cloud->width) || col < 0) { break; } @@ -590,7 +590,7 @@ SequentialFitter::grow (float max_dist, float max_angle, unsigned min_length, un compute_interior (m_nurbs); double int_err (0.0); - double div_err = 1.0 / double (m_data.interior_error.size ()); + double div_err = 1.0 / static_cast(m_data.interior_error.size ()); for (const double &i : m_data.interior_error) { int_err += (i * div_err); @@ -615,7 +615,7 @@ SequentialFitter::PCL2ON (pcl::PointCloud::Ptr &pcl_cloud, con if (!std::isnan (pt.x) && !std::isnan (pt.y) && !std::isnan (pt.z)) { - on_cloud.push_back (Eigen::Vector3d (pt.x, pt.y, pt.z)); + on_cloud.emplace_back (pt.x, pt.y, pt.z); numPoints++; } diff --git a/surface/src/on_nurbs/sparse_mat.cpp b/surface/src/on_nurbs/sparse_mat.cpp index 3c429b04cea..6bf796dcd60 100644 --- a/surface/src/on_nurbs/sparse_mat.cpp +++ b/surface/src/on_nurbs/sparse_mat.cpp @@ -196,7 +196,7 @@ SparseMat::nonzeros () it_row = m_mat.begin (); while (it_row != m_mat.end ()) { - s += int (it_row->second.size ()); + s += static_cast(it_row->second.size ()); ++it_row; } diff --git a/surface/src/on_nurbs/triangulation.cpp b/surface/src/on_nurbs/triangulation.cpp index 86e31e8ddb8..3c5fb0dd99b 100644 --- a/surface/src/on_nurbs/triangulation.cpp +++ b/surface/src/on_nurbs/triangulation.cpp @@ -77,15 +77,15 @@ Triangulation::createVertices (pcl::PointCloud::Ptr &cloud, float float height, unsigned segX, unsigned segY) { pcl::PointXYZ v; - float dx = width / float (segX); - float dy = height / float (segY); + float dx = width / static_cast(segX); + float dy = height / static_cast(segY); for (unsigned j = 0; j <= segY; j++) { for (unsigned i = 0; i <= segX; i++) { - v.x = x0 + float (i) * dx; - v.y = y0 + float (j) * dy; + v.x = x0 + static_cast(i) * dx; + v.y = y0 + static_cast(j) * dy; v.z = z0; cloud->push_back (v); } @@ -181,7 +181,7 @@ Triangulation::convertSurface2PolygonMesh (const ON_NurbsSurface &nurbs, Polygon pcl::PointCloud::Ptr cloud (new pcl::PointCloud); mesh.polygons.clear (); - createVertices (cloud, float (x0), float (y0), 0.0f, float (w), float (h), resolution, resolution); + createVertices (cloud, static_cast(x0), static_cast(y0), 0.0f, static_cast(w), static_cast(h), resolution, resolution); createIndices (mesh.polygons, 0, resolution, resolution); for (auto &v : *cloud) @@ -189,9 +189,9 @@ Triangulation::convertSurface2PolygonMesh (const ON_NurbsSurface &nurbs, Polygon double point[9]; nurbs.Evaluate (v.x, v.y, 1, 3, point); - v.x = float (point[0]); - v.y = float (point[1]); - v.z = float (point[2]); + v.x = static_cast(point[0]); + v.y = static_cast(point[1]); + v.z = static_cast(point[2]); } toPCLPointCloud2 (*cloud, mesh.cloud); @@ -219,7 +219,7 @@ Triangulation::convertTrimmedSurface2PolygonMesh (const ON_NurbsSurface &nurbs, pcl::PointCloud::Ptr cloud (new pcl::PointCloud); std::vector polygons; - createVertices (cloud, float (x0), float (y0), 0.0f, float (w), float (h), resolution, resolution); + createVertices (cloud, static_cast(x0), static_cast(y0), 0.0f, static_cast(w), static_cast(h), resolution, resolution); createIndices (polygons, 0, resolution, resolution); vector_vec2d points (cloud->size (), Eigen::Vector2d ()); @@ -290,8 +290,8 @@ Triangulation::convertTrimmedSurface2PolygonMesh (const ON_NurbsSurface &nurbs, { pcl::PointXYZ &v = cloud->at (out_idx[i]); Eigen::Vector2d &pc = out_pc[i]; - v.x = float (pc (0)); - v.y = float (pc (1)); + v.x = static_cast(pc (0)); + v.y = static_cast(pc (1)); } for (auto &v : *cloud) @@ -299,9 +299,9 @@ Triangulation::convertTrimmedSurface2PolygonMesh (const ON_NurbsSurface &nurbs, double point[3]; nurbs.Evaluate (v.x, v.y, 0, 3, point); - v.x = float (point[0]); - v.y = float (point[1]); - v.z = float (point[2]); + v.x = static_cast(point[0]); + v.y = static_cast(point[1]); + v.z = static_cast(point[2]); // tu[0] = point[3]; // tu[1] = point[4]; // tu[2] = point[5]; @@ -338,7 +338,7 @@ Triangulation::convertTrimmedSurface2PolygonMesh (const ON_NurbsSurface &nurbs, pcl::PointCloud::Ptr cloud (new pcl::PointCloud); std::vector polygons; - createVertices (cloud, float (x0), float (y0), 0.0f, float (w), float (h), resolution, resolution); + createVertices (cloud, static_cast(x0), static_cast(y0), 0.0f, static_cast(w), static_cast(h), resolution, resolution); createIndices (polygons, 0, resolution, resolution); vector_vec2d points (cloud->size (), Eigen::Vector2d ()); @@ -375,8 +375,8 @@ Triangulation::convertTrimmedSurface2PolygonMesh (const ON_NurbsSurface &nurbs, params[i] = param; pt_is_in[i] = (z (2) >= 0.0); - end.push_back (Eigen::Vector3d (pc (0), pc (1), 0.0)); - start.push_back (Eigen::Vector3d (vp (0), vp (1), 0.0)); + end.emplace_back (pc (0), pc (1), 0.0); + start.emplace_back (vp (0), vp (1), 0.0); } for (const auto &poly : polygons) @@ -414,8 +414,8 @@ Triangulation::convertTrimmedSurface2PolygonMesh (const ON_NurbsSurface &nurbs, { pcl::PointXYZ &v = cloud->at (out_idx[i]); Eigen::Vector2d &pc = out_pc[i]; - v.x = float (pc (0)); - v.y = float (pc (1)); + v.x = static_cast(pc (0)); + v.y = static_cast(pc (1)); } for (auto &v : *cloud) @@ -423,9 +423,9 @@ Triangulation::convertTrimmedSurface2PolygonMesh (const ON_NurbsSurface &nurbs, double point[3]; nurbs.Evaluate (v.x, v.y, 0, 3, point); - v.x = float (point[0]); - v.y = float (point[1]); - v.z = float (point[2]); + v.x = static_cast(point[0]); + v.y = static_cast(point[1]); + v.z = static_cast(point[2]); } for (std::size_t i = 0; i < start.size (); i++) @@ -469,7 +469,7 @@ Triangulation::convertSurface2Vertices (const ON_NurbsSurface &nurbs, pcl::Point double y1 = nurbs.Knot (1, nurbs.KnotCount (1) - 1); double h = y1 - y0; - createVertices (cloud, float (x0), float (y0), 0.0f, float (w), float (h), resolution, resolution); + createVertices (cloud, static_cast(x0), static_cast(y0), 0.0f, static_cast(w), static_cast(h), resolution, resolution); createIndices (vertices, 0, resolution, resolution); for (auto &v : *cloud) @@ -564,9 +564,9 @@ Triangulation::convertCurve2PointCloud (const ON_NurbsCurve &curve, const ON_Nur double pp[3]; curve.Evaluate (xi, 0, 2, pp); surf.Evaluate (pp[0], pp[1], 0, 3, p); - pt.x = float (p[0]); - pt.y = float (p[1]); - pt.z = float (p[2]); + pt.x = static_cast(p[0]); + pt.y = static_cast(p[1]); + pt.z = static_cast(p[2]); pt.r = 255; pt.g = 0; pt.b = 0; diff --git a/visualization/include/pcl/visualization/vtk/vtkFixedXRenderWindowInteractor.h b/visualization/include/pcl/visualization/vtk/vtkFixedXRenderWindowInteractor.h index 54bac8e7396..1065991b8af 100644 --- a/visualization/include/pcl/visualization/vtk/vtkFixedXRenderWindowInteractor.h +++ b/visualization/include/pcl/visualization/vtk/vtkFixedXRenderWindowInteractor.h @@ -36,8 +36,9 @@ #include "vtkRenderingUIModule.h" // For export macro #include // Needed for X types in the public interface -namespace pcl { class vtkCallbackCommand; + +namespace pcl { class vtkXRenderWindowInteractorInternals; class VTKRENDERINGUI_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor diff --git a/visualization/include/pcl/visualization/window.h b/visualization/include/pcl/visualization/window.h index 7db1e4331ed..c393d85bdbc 100644 --- a/visualization/include/pcl/visualization/window.h +++ b/visualization/include/pcl/visualization/window.h @@ -49,7 +49,6 @@ class vtkRenderWindow; class vtkRenderWindowInteractor; class vtkCallbackCommand; class vtkRendererCollection; -class PCLVisualizerInteractorStyle; namespace pcl { @@ -57,6 +56,7 @@ namespace pcl { class MouseEvent; class KeyboardEvent; + class PCLVisualizerInteractorStyle; class PCL_EXPORTS Window {