segments.cpp
Go to the documentation of this file.
1 #include "segments.h"
2 
3 namespace visionx
4 {
5 
6  void tools::detail::addSegmentIndex(std::map<uint32_t, pcl::PointIndices>& segmentIndices,
7  uint32_t label, std::size_t index)
8  {
9  // With [] operator, std::map default-constructs a value if it is not already
10  // present, which is exactly what we need here (i.e. no need to explicitly check
11  // key presence).
12  segmentIndices[label].indices.push_back(static_cast<int>(index));
13  }
14 
15  void tools::detail::addSegmentIndex(std::map<uint32_t, pcl::PointIndices::Ptr>& segmentIndices,
16  uint32_t label, std::size_t index)
17  {
18  auto it = segmentIndices.find(label);
19  if (it == segmentIndices.end())
20  {
21  it = segmentIndices.emplace(label, new pcl::PointIndices).first;
22  }
23  it->second->indices.push_back(static_cast<int>(index));
24  }
25 
26 }
27 
28 
29 
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
index
uint8_t index
Definition: EtherCATFrame.h:59
visionx::tools::detail::addSegmentIndex
void addSegmentIndex(std::map< uint32_t, pcl::PointIndices > &segmentIndices, uint32_t label, std::size_t index)
Definition: segments.cpp:6
segments.h