Skip to content

Commit c0315f3

Browse files
author
C. Andy Martin
committed
ogre helpers point_cloud: add size into bounds
Add the size of the point visual into the bounding box. For small or zero sized points this makes little difference, but for large points (such as visualizing an octomap with large compressed regions), it is important to add the bounds to keep the points visible at the very edges of the cloud.
1 parent cfb3f81 commit c0315f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/rviz/ogre_helpers/point_cloud.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ void PointCloud::addPoints(Point* points, uint32_t num_points)
480480

481481
Ogre::AxisAlignedBox aabb;
482482
aabb.setNull();
483+
Ogre::Vector3 point_size_offset(width_/2.0, height_/2.0, depth_/2.0);
483484
uint32_t current_vertex_count = 0;
484485
bounding_radius_ = 0.0f;
485486
uint32_t vertex_size = 0;
@@ -539,7 +540,8 @@ void PointCloud::addPoints(Point* points, uint32_t num_points)
539540
root->convertColourValue(p.color, &color);
540541
}
541542

542-
aabb.merge(p.position);
543+
aabb.merge(p.position + point_size_offset);
544+
aabb.merge(p.position - point_size_offset);
543545

544546
float x = p.position.x;
545547
float y = p.position.y;

0 commit comments

Comments
 (0)