MCPcopy Create free account
hub / github.com/ElectroZybr/LatticeLab / processCircle

Method processCircle

App/interaction/picking/PickingSystem.cpp:81–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void PickingSystem::processCircle(glm::ivec2 center, float radius, bool cumulative) {
82 if (radius <= 0.0f) {
83 return;
84 }
85 if (!cumulative) {
86 clearSelection();
87 }
88
89 BaseRenderer* rend = renderer->get();
90 const float radiusSqr = radius * radius;
91 for (size_t i = 0; i < atomStorage->size(); ++i) {
92 const glm::vec3 worldPos = displayAtomPos(i);
93 const glm::ivec2 atomScreen{rend->camera.worldToScreen(worldPos)};
94 const glm::vec2 diff = glm::vec2(atomScreen - center);
95 if ((diff.x * diff.x + diff.y * diff.y) <= radiusSqr) {
96 selectedAtomIds.insert(atomStorage->atomId(i));
97 }
98 }
99}
100
101bool PickingSystem::pickAtom(glm::ivec2 screenPos, float tolerance, AtomHit& hit) const {
102 BaseRenderer* rend = renderer->get();

Callers 1

applyBrushAtMethod · 0.80

Calls 4

atomIdMethod · 0.80
getMethod · 0.45
sizeMethod · 0.45
worldToScreenMethod · 0.45

Tested by

no test coverage detected