Skip to content

Commit

Permalink
Merge pull request #1813 from Chungzuwalla/issue1802
Browse files Browse the repository at this point in the history
Fixed bug incorrectly copying adjacent points in fromPCLPointCloud2()
  • Loading branch information
jspricke authored Feb 9, 2017
2 parents eea6059 + a65b706 commit 6fb1b65
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions common/include/pcl/conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,14 @@ namespace pcl
cloud.points.resize (num_points);
uint8_t* cloud_data = reinterpret_cast<uint8_t*>(&cloud.points[0]);

// Check if we can copy adjacent points in a single memcpy
// Check if we can copy adjacent points in a single memcpy. We can do so if there
// is exactly one field to copy and it is the same size as the source and destination
// point types.
if (field_map.size() == 1 &&
field_map[0].serialized_offset == 0 &&
field_map[0].struct_offset == 0 &&
msg.point_step == sizeof(PointT))
field_map[0].size == msg.point_step &&
field_map[0].size == sizeof(PointT))
{
uint32_t cloud_row_step = static_cast<uint32_t> (sizeof (PointT) * cloud.width);
const uint8_t* msg_data = &msg.data[0];
Expand Down

0 comments on commit 6fb1b65

Please sign in to comment.