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

◆ reach()

std::pair< glm::vec3, float > MayaFlux::Nexus::Hull::reach ( ) const
overrideprotectedvirtual

The centre of the bounds as drawn, and the distance to their farthest corner.

Reimplemented from MayaFlux::Nexus::Expanse.

Definition at line 44 of file Hull.cpp.

45{
46 if (!m_buf || !m_local) {
47 return Expanse::reach();
48 }
49
50 const glm::mat4 drawn = read_placement(m_buf);
51 const glm::vec3 center = glm::vec3(drawn * glm::vec4(m_local->center(), 1.0F));
52
53 float radius = 0.0F;
54 for (int corner = 0; corner < 8; ++corner) {
55 const glm::vec3 local {
56 (corner & 1) != 0 ? m_local->max.x : m_local->min.x,
57 (corner & 2) != 0 ? m_local->max.y : m_local->min.y,
58 (corner & 4) != 0 ? m_local->max.z : m_local->min.z,
59 };
60 radius = std::max(radius, glm::length(glm::vec3(drawn * glm::vec4(local, 1.0F)) - center));
61 }
62 return { center, radius };
63}
float radius
glm::ivec3 min
glm::ivec3 max
virtual std::pair< glm::vec3, float > reach() const
Where the region is centred and how far it reaches, for perceptions.
Definition Expanse.hpp:314
std::optional< Kinesis::AABB3D > m_local
Definition Hull.hpp:63
std::shared_ptr< Buffers::VKBuffer > m_buf
Definition Hull.hpp:61
glm::mat4 read_placement(const std::shared_ptr< Buffers::VKBuffer > &buf)
Where a buffer is drawn: the geometry transform of its primary render processor.
Definition Survey.cpp:303

References m_buf, m_local, radius, MayaFlux::Nexus::Expanse::reach(), and MayaFlux::Nexus::read_placement().

+ Here is the call graph for this function: