MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / is_overlapping

Function is_overlapping

modules/benchmarks-cpp/src/circles.cpp:60–67  ·  view source on GitHub ↗

Check if two entities are overlapping based on their positions and masses

Source from the content-addressed store, hash-verified

58
59// Check if two entities are overlapping based on their positions and masses
60inline bool is_overlapping(const Entity& entity1, const Entity& entity2) {
61 float entity1_radius = mass_to_radius(entity1.mass);
62 float entity2_radius = mass_to_radius(entity2.mass);
63 float dx = entity1.position.x - entity2.position.x;
64 float dy = entity1.position.y - entity2.position.y;
65 float distance = std::sqrt(dx * dx + dy * dy);
66 return distance < std::max(entity1_radius, entity2_radius);
67}
68
69// =============================================================================
70// CIRCLES BENCHMARK - BULK INSERT OPERATIONS

Callers 1

SPACETIMEDB_REDUCERFunction · 0.70

Calls 1

mass_to_radiusFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…