Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
24 changes: 13 additions & 11 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -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='.*'
8 changes: 8 additions & 0 deletions common/include/pcl/common/fft/.clang-tidy
Original file line number Diff line number Diff line change
@@ -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: ''
8 changes: 8 additions & 0 deletions common/src/fft/.clang-tidy
Original file line number Diff line number Diff line change
@@ -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: ''
6 changes: 3 additions & 3 deletions examples/surface/example_nurbs_fitting_closed_curve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(cp.x);
p.y = static_cast<float>(cp.y);
p.z = static_cast<float>(cp.z);
cps->push_back (p);
}
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> handler (cps, 255 * r, 255 * g, 255 * b);
Expand Down
6 changes: 3 additions & 3 deletions examples/surface/example_nurbs_fitting_closed_curve3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(cp.x);
p.y = static_cast<float>(cp.y);
p.z = static_cast<float>(cp.z);
cps->push_back (p);
}
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> handler (cps, 255 * r, 255 * g, 255 * b);
Expand Down
6 changes: 3 additions & 3 deletions examples/surface/example_nurbs_fitting_curve2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(cp.x);
p.y = static_cast<float>(cp.y);
p.z = static_cast<float>(cp.z);
cps->push_back (p);
}
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> handler (cps, 255 * r, 255 * g, 255 * b);
Expand Down
6 changes: 3 additions & 3 deletions examples/surface/example_nurbs_fitting_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(pnt[0]);
p2.y = static_cast<float>(pnt[1]);
p2.z = static_cast<float>(pnt[2]);

p2.r = 255;
p2.g = 0;
Expand Down
16 changes: 14 additions & 2 deletions examples/surface/example_nurbs_viewer_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const ON_NurbsSurface*>(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";
Expand All @@ -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<const ON_NurbsCurve*>(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);
Expand Down
12 changes: 6 additions & 6 deletions examples/surface/test_nurbs_fitting_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ CreateCylinderPoints (pcl::PointCloud<Point>::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<double>(rand ()) / RAND_MAX;
double dh = h * (static_cast<double>(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<float>(r * std::cos (da));
p.y = static_cast<float>(r * sin (da));
p.z = static_cast<float>(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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/ppfrgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename PointInT, typename PointNT, typename PointOutT>
Expand Down
12 changes: 5 additions & 7 deletions outofcore/include/pcl/outofcore/impl/lru_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class LRUCache

using KeyIndex = std::list<KeyT>;
using KeyIndexIterator = typename KeyIndex::iterator;

using Cache = std::map<KeyT, std::pair<CacheItemT, typename KeyIndex::iterator> >;
using CacheIterator = typename Cache::iterator;

LRUCache (std::size_t c) :
capacity_ (c)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions recognition/include/pcl/recognition/3rdparty/.clang-tidy
Original file line number Diff line number Diff line change
@@ -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: ''
8 changes: 8 additions & 0 deletions surface/include/pcl/surface/3rdparty/.clang-tidy
Original file line number Diff line number Diff line change
@@ -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: ''
9 changes: 3 additions & 6 deletions surface/include/pcl/surface/on_nurbs/fitting_curve_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions surface/include/pcl/surface/on_nurbs/fitting_curve_2d_apdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions surface/include/pcl/surface/on_nurbs/fitting_curve_2d_pdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions surface/include/pcl/surface/on_nurbs/fitting_surface_im.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions surface/include/pcl/surface/on_nurbs/nurbs_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ namespace pcl
{

// http://eigen.tuxfamily.org/dox-devel/TopicStlContainers.html
typedef std::vector<Eigen::Vector2i, Eigen::aligned_allocator<Eigen::Vector2i> > vector_vec2i;
typedef std::vector<Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d> > vector_vec2d;
typedef std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > vector_vec3d;
using vector_vec2i = std::vector<Eigen::Vector2i, Eigen::aligned_allocator<Eigen::Vector2i>>;
using vector_vec2d = std::vector<Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d>>;
using vector_vec3d = std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d>>;

/** \brief Data structure for NURBS surface fitting
* (FittingSurface, FittingSurfaceTDM, FittingCylinder, GlobalOptimization, GlobalOptimizationTDM) */
Expand Down
7 changes: 2 additions & 5 deletions surface/include/pcl/surface/on_nurbs/nurbs_solve.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions surface/src/3rdparty/.clang-tidy
Original file line number Diff line number Diff line change
@@ -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: ''
Loading