Create a proxy in the tree as a leaf node. We return the index of the node instead of a pointer so that we can grow the node pool.
(aabb B2AABB, userData interface{})
| 264 | // of the node instead of a pointer so that we can grow |
| 265 | // the node pool. |
| 266 | func (tree *B2DynamicTree) CreateProxy(aabb B2AABB, userData interface{}) int { |
| 267 | |
| 268 | proxyId := tree.AllocateNode() |
| 269 | |
| 270 | // Fatten the aabb. |
| 271 | r := MakeB2Vec2(B2_aabbExtension, B2_aabbExtension) |
| 272 | tree.M_nodes[proxyId].Aabb.LowerBound = B2Vec2Sub(aabb.LowerBound, r) |
| 273 | tree.M_nodes[proxyId].Aabb.UpperBound = B2Vec2Add(aabb.UpperBound, r) |
| 274 | tree.M_nodes[proxyId].UserData = userData |
| 275 | tree.M_nodes[proxyId].Height = 0 |
| 276 | |
| 277 | tree.InsertLeaf(proxyId) |
| 278 | |
| 279 | return proxyId |
| 280 | } |
| 281 | |
| 282 | func (tree *B2DynamicTree) DestroyProxy(proxyId int) { |
| 283 | B2Assert(0 <= proxyId && proxyId < tree.M_nodeCapacity) |
nothing calls this directly
no test coverage detected