fcl icon indicating copy to clipboard operation
fcl copied to clipboard

thread safety of collide

Open manuelli opened this issue 8 years ago • 2 comments

I am wondering about the thread safety of the collide function. In particular if I would like to construct a two BVHModel<OBBRSS> objects (call them o1 and o2). Then I want to repeatedly query whether o1 and o2 are in collision for different transforms Transform3f tf. Can these calls to collide(o1, o2, request, result) be performed in parallel? In particular is is thread safe to use the same o1 and o2 BVHModel objects for collide calls in separate threads, or do I need to make unique o1 and o2 objects for each thread?

manuelli avatar Aug 01 '17 21:08 manuelli

A kind ping to this 5 year old issue. Is there any thread-safe collision check function?

tfachmann avatar Dec 31 '22 10:12 tfachmann

I don't have a definitive answer as I have yet to play with the BVHModel. But to seed the conversation, I'll make an assertion and wait for someone to prove me wrong. :)

Hypothesis: It is probably safe.

Evidence:

If you look at the BVHShapeCollider, you'll note one of the first things it does is copy the BVHModel that is input. So, if there is any mutating of the BVHModel used in the query, it seems to happen on a temporary copy.

Counterarguments?

SeanCurtis-TRI avatar Mar 21 '23 21:03 SeanCurtis-TRI