Concepts#
ovspatialquery answers spatial questions about objects that move or change in space: what a ray hits, what a moving shape touches first, what overlaps a region, and which objects started or stopped touching. Any program that updates objects over time can use it, such as a physics simulation, an animation system, a robot controller, or an editor.
One part of your program publishes the objects whenever they change. Other parts, such as sensors, controllers, and tools, query what was published, each at the rate it needs. None of them keeps its own scene-query structure synchronized with the changes.
The following figure shows how the pieces fit together:
Terms#
The following terms appear throughout this guide, in the order the figure introduces them:
The root object. It owns everything created through it and holds the budgets: live operations, CPU jobs, and host and device memory. A program usually has one.
One set of objects that is published together, on its own clock. It reads from one source: an ovstage stage through a filter, or arrays your program supplies. Objects that update at different rates belong in different populations.
A version is one immutable published state of a population, labeled with its source's ordinal. The head is the newest version, and older ones stay selectable while they are retained.
A stable subset of one population. It shares every version and all acceleration data of its population and copies nothing.
Each object has 128 category bits, captured with each publication. A query accepts an object when query_bits and the object's bits share a set bit.
What a query reads: one population or view, at the head or at one retained ordinal. Pair operations read two targets.
Asynchronous work you started: a registration, a publication, a batch launch, or a pair advance. It keeps what it uses alive until you destroy it.
Reusable setup for many queries of one kind, with result storage reserved in advance, on the CPU or one CUDA device.
All bounding-box contacts between two targets at one instant, or the pairs that entered or exited between accepted reporter endpoints.
Guarantees#
ovspatialquery makes four guarantees that the rest of this guide builds on:
Publication is atomic. A publication becomes the new head in one step or changes nothing. Readers never see a half-updated world.
Every query names its version. It reads the head or one exact retained ordinal. Two readers can read different versions of one population at the same time without a copy.
Every result states its precision. A hit is either a bounding-box candidate or an exact surface contact, by tag and by field name.
Limits are explicit. You set the budgets, and work that would exceed one fails with a status instead of growing. CUDA work never falls back to the CPU. Destroying something still in use returns
BUSYinstead of waiting.
In This Section#
Each page links names to the API reference, where the C headers and the Python package state the full contract. The section has the following pages: