MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ hit_test() [2/2]

std::optional< uint32_t > MayaFlux::Portal::Forma::Layer::hit_test ( glm::vec2  ndc) const

Return the topmost interactive, visible element containing ndc.

Traverses back-to-front. An element passes if:

  1. bounds_hint is absent OR bounds_hint.contains(ndc) is true.
  2. contains is absent OR contains(ndc) is true. An element with neither set never hits.
Parameters
ndcPoint in NDC space (x, y in [-1, +1]).
Returns
Element id, or nullopt if no element hit.

Definition at line 117 of file Layer.cpp.

118{
119 for (const auto& m_element : std::views::reverse(m_elements)) {
120 if (test_element(m_element, ndc))
121 return m_element.id;
122 }
123 return std::nullopt;
124}
std::vector< Element > m_elements
Definition Layer.hpp:280
static bool test_element(const Element &el, glm::vec2 ndc) noexcept
Definition Layer.cpp:219
void reverse(std::vector< double > &data)
Reverse time order of single-channel data (in-place)
Definition Yantra.cpp:614

References m_elements, and test_element().

Referenced by hit_test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: