Skip to content

Commit

Permalink
PointCloud: Fix calculation of bounding radius
Browse files Browse the repository at this point in the history
Radius should be max length of all point vectors, not squared length.
  • Loading branch information
rhaschke committed Aug 21, 2021
1 parent a885152 commit 7ecd6a7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/rviz/ogre_helpers/point_cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const Ogre::AxisAlignedBox& PointCloud::getBoundingBox() const

float PointCloud::getBoundingRadius() const
{
return bounding_radius_;
return Ogre::Math::Sqrt(bounding_radius_); // we actually computed the squared radius
}

void PointCloud::getWorldTransforms(Ogre::Matrix4* xform) const
Expand Down Expand Up @@ -481,7 +481,6 @@ void PointCloud::addPoints(Point* points, uint32_t num_points)
Ogre::AxisAlignedBox aabb;
aabb.setNull();
uint32_t current_vertex_count = 0;
bounding_radius_ = 0.0f;
uint32_t vertex_size = 0;
uint32_t buffer_size = 0;
for (uint32_t current_point = 0; current_point < num_points; ++current_point)
Expand Down

0 comments on commit 7ecd6a7

Please sign in to comment.