From 7ecd6a791b2b49ad4419d4f1a6161bff0878b96e Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Fri, 20 Aug 2021 19:07:10 +0200 Subject: [PATCH] PointCloud: Fix calculation of bounding radius Radius should be max length of all point vectors, not squared length. --- src/rviz/ogre_helpers/point_cloud.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rviz/ogre_helpers/point_cloud.cpp b/src/rviz/ogre_helpers/point_cloud.cpp index d1f38d2ab9..593c6f3682 100644 --- a/src/rviz/ogre_helpers/point_cloud.cpp +++ b/src/rviz/ogre_helpers/point_cloud.cpp @@ -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 @@ -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)