| 46 | } |
| 47 | |
| 48 | void |
| 49 | cpSpacePointQuery(cpSpace *space, cpVect point, cpFloat maxDistance, cpShapeFilter filter, cpSpacePointQueryFunc func, void *data) |
| 50 | { |
| 51 | struct PointQueryContext context = {point, maxDistance, filter, func}; |
| 52 | cpBB bb = cpBBNewForCircle(point, cpfmax(maxDistance, 0.0f)); |
| 53 | |
| 54 | cpSpaceLock(space); { |
| 55 | cpSpatialIndexQuery(space->dynamicShapes, &context, bb, (cpSpatialIndexQueryFunc)NearestPointQuery, data); |
| 56 | cpSpatialIndexQuery(space->staticShapes, &context, bb, (cpSpatialIndexQueryFunc)NearestPointQuery, data); |
| 57 | } cpSpaceUnlock(space, cpTrue); |
| 58 | } |
| 59 | |
| 60 | static cpCollisionID |
| 61 | NearestPointQueryNearest(struct PointQueryContext *context, cpShape *shape, cpCollisionID id, cpPointQueryInfo *out) |
no test coverage detected