From 7dd55502d9df28b2f6261b902fd96dd67a9129a1 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Sun, 11 May 2014 15:57:13 +0200 Subject: [PATCH] fix #762 --- src/rviz/default_plugin/point_cloud_common.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/rviz/default_plugin/point_cloud_common.cpp b/src/rviz/default_plugin/point_cloud_common.cpp index 51d5eacad2..e8aed3e43b 100644 --- a/src/rviz/default_plugin/point_cloud_common.cpp +++ b/src/rviz/default_plugin/point_cloud_common.cpp @@ -817,7 +817,10 @@ bool PointCloudCommon::transformCloud(const CloudInfoPtr& cloud_info, bool updat transform.makeTransform( cloud_info->position_, Ogre::Vector3(1,1,1), cloud_info->orientation_ ); V_PointCloudPoint& cloud_points = cloud_info->transformed_points_; - cloud_points.clear(); + PointCloud::Point default_pt; + default_pt.color = Ogre::ColourValue(1, 1, 1); + default_pt.position = Ogre::Vector3::ZERO; + cloud_points.resize(size, default_pt); size_t size = cloud_info->message_->width * cloud_info->message_->height; cloud_points.resize(size); @@ -847,17 +850,8 @@ bool PointCloudCommon::transformCloud(const CloudInfoPtr& cloud_info, bool updat return false; } - bool res = xyz_trans->transform(cloud_info->message_, PointCloudTransformer::Support_XYZ, transform, cloud_points); - res &= color_trans->transform(cloud_info->message_, PointCloudTransformer::Support_Color, transform, cloud_points); - // In case there was a problem, assign a default value - if (!res) - { - PointCloud::Point default_pt; - default_pt.color = Ogre::ColourValue(1, 1, 1); - default_pt.position = Ogre::Vector3::ZERO; - cloud_points.clear(); - cloud_points.resize(size, default_pt); - } + xyz_trans->transform(cloud_info->message_, PointCloudTransformer::Support_XYZ, transform, cloud_points); + color_trans->transform(cloud_info->message_, PointCloudTransformer::Support_Color, transform, cloud_points); } for (V_PointCloudPoint::iterator cloud_point = cloud_points.begin(); cloud_point != cloud_points.end(); ++cloud_point)