Skip to content

Commit

Permalink
Make BVH update a copy op
Browse files Browse the repository at this point in the history
  • Loading branch information
minkezhang committed Jan 26, 2023
1 parent 85b882d commit ae86632
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bvh/bvh.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ func (t *T) Update(x id.ID, aabb hyperrectangle.R) error {
return fmt.Errorf("cannot update node %v: %v", x, err)
}
} else {
t.data[x] = aabb
// As with the Insert call, we do not have any guarantees the
// AABB will not be mutated after the update call, so we must
// ensure this is true by making a copy of the input.
t.data[x].M().Copy(aabb)
}

return nil
Expand Down

0 comments on commit ae86632

Please sign in to comment.