Suggestion about btOverlappingPairCache iteration.

donggas90
Posts: 17
Joined: Tue May 19, 2015 10:01 am

Suggestion about btOverlappingPairCache iteration.

Post by donggas90 »

I have a suggestion about btOverlappingPairCache iteration.
Currently Bullet using getOverlappingPairArrayPtr() and getNumOverlappingPairs() to iterate overlapping pairs.
I think, it's not a good idea.
Because if get array by pointer, PairCache must use flat memory or copy to that from another array which is not flat.
Thus PairCache forcibly cannot use some data structures such as LinkedList what has fast add & remove operation.
It's very inefficient.
My suggestion is that change iteration of pairs to the Iterator oriented.
If use Iterator, we need not keep stride of pair array.
It means PairCache must not use flat array and we can extend pair's structure, too.
In other words, we can use any of data structure and element type, Array, LinkedList, Queue, Stack whatever we want.
Additionally, btBroadphasePairArray& getOverlappingPairArray() is non-scense as well.