Commit 7b31f1c 1 parent 9bbca6e commit 7b31f1c Copy full SHA for 7b31f1c
File tree 1 file changed +9
-4
lines changed
rviz_default_plugins/src/rviz_default_plugins/displays/pointcloud/transformers
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 29
29
30
30
31
31
#include < algorithm>
32
+ #include < array>
32
33
33
34
#include " rviz_default_plugins/displays/pointcloud/point_cloud_helpers.hpp"
34
35
@@ -75,10 +76,14 @@ bool RGB8PCTransformer::transform(
75
76
const uint32_t point_step = cloud->point_step ;
76
77
77
78
// Create a look-up table for colors
78
- float rgb_lut[256 ];
79
- for (int i = 0 ; i < 256 ; ++i) {
80
- rgb_lut[i] = static_cast <float >(i) / 255 .0f ;
81
- }
79
+ constexpr static std::array<float , 256 > rgb_lut = [](){
80
+ std::array<float , 256 > result{};
81
+ for (int i = 0 ; i < 256 ; ++i) {
82
+ result[i] = static_cast <float >(i) / 255 .0f ;
83
+ }
84
+ return result;
85
+ }();
86
+
82
87
if (rgb != -1 ) { // rgb
83
88
for (V_PointCloudPoint::iterator iter = points_out.begin (); iter != points_out.end ();
84
89
++iter, rgb_ptr += point_step)
You can’t perform that action at this time.
0 commit comments