ncollide icon indicating copy to clipboard operation
ncollide copied to clipboard

Add a "take_point" method to AABB and BoundingSphere.

Open sebcrozet opened this issue 6 years ago • 6 comments

This method would grow the AABB or BoundingSphere so it contains the given point.

sebcrozet avatar Apr 30 '19 14:04 sebcrozet

Would expand_to perhaps be a better name?

Ralith avatar Apr 30 '19 14:04 Ralith

A few questions:

  1. Should this become a member of the BoundingVolume trait.
  2. What about naming it engulf, or enclose? I think enclose may be the better of the two.
  3. I see some bonds have &mut and & variants eg merge and merged. Do we want &mut and & variants for this method?

Plotnus avatar May 14 '19 00:05 Plotnus

What about naming it engulf, or enclose? I think enclose may be the better of the two.

I like both of these as well, though of the two I think engulf does a better job of evoking the expansion of the existing bounds

Ralith avatar May 14 '19 00:05 Ralith

@Plotnus :

  1. Yes
  2. Among both engulf seems the most appropriate as @Ralith said.
  3. Yes.

Overall, I think expand_to and engulf are two good choices. Though I'd like to have point appear on the method name too for explicitness. So in the end I'd choose engulf_point and engulf_point_mut.

sebcrozet avatar May 14 '19 07:05 sebcrozet

What blocked me on this was implementing the functions for SpatializedNormalCone. I'm unfamiliar with that bounding volume or how we'd adjust it based on points.

Plotnus avatar May 25 '19 21:05 Plotnus

@Plotnus The SpacializedNormalCone combines an AABB that bounds points with a circular cone that bounds vectors. So adding a point to it amounts to calling self.aabb.engulf_point(pt).

sebcrozet avatar May 25 '19 21:05 sebcrozet