Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions pointcloud/pointcloud_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ func BoundingBoxFromPointCloudWithLabel(cloud PointCloud, label string) (spatial
// calculate extents of point cloud
meta := cloud.MetaData()
dims := r3.Vector{math.Abs(meta.MaxX - meta.MinX), math.Abs(meta.MaxY - meta.MinY), math.Abs(meta.MaxZ - meta.MinZ)}

// calculate the spatial average center of a given point cloud
n := float64(cloud.Size())
mean := r3.Vector{meta.TotalX() / n, meta.TotalY() / n, meta.TotalZ() / n}
mean := r3.Vector{dims.X / 2, dims.Y / 2, dims.Z / 2}
Copy link
Member

@bhaney bhaney Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't use dims, as that is an the absolute value of the distance between the max and min. What you are looking for is the point inbetween the max and min, which would be

center := r3.Vector{(meta.MaxX + meta.MinX)/2.0, (meta.MaxY + meta.MinY)/2.0, (meta.MaxZ + meta.MinZ)/2.0}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for example, if MaxX was -2, and MinX was -5,
dim/2 = 1.5 (half of the length of X)
center = -3.5 (the center point between -2 and -5)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just put this up for @micheal-parks to discuss with you, but happy to make that change if we think that's more accurate!


// calculate the dimensions of the bounding box formed by finding the dimensions of each axes' extrema
return spatialmath.NewBox(spatialmath.NewPoseFromPoint(mean), dims, label)
Expand Down
Loading