Skip to content

Commit

Permalink
ogre helpers point_cloud: add size into bounds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
C. Andy Martin committed Jul 1, 2021
1 parent cfb3f81 commit c0315f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rviz/ogre_helpers/point_cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ void PointCloud::addPoints(Point* points, uint32_t num_points)

Ogre::AxisAlignedBox aabb;
aabb.setNull();
Ogre::Vector3 point_size_offset(width_/2.0, height_/2.0, depth_/2.0);
uint32_t current_vertex_count = 0;
bounding_radius_ = 0.0f;
uint32_t vertex_size = 0;
Expand Down Expand Up @@ -539,7 +540,8 @@ void PointCloud::addPoints(Point* points, uint32_t num_points)
root->convertColourValue(p.color, &color);
}

aabb.merge(p.position);
aabb.merge(p.position + point_size_offset);
aabb.merge(p.position - point_size_offset);

float x = p.position.x;
float y = p.position.y;
Expand Down

0 comments on commit c0315f3

Please sign in to comment.