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

◆ cell_at()

glm::uvec2 MayaFlux::Kinesis::Lattice2D::cell_at ( const glm::vec2 &  p) const
inlinenoexcept

Cell containing a position, clamped to the lattice.

Parameters
pPosition. Points outside bounds clamp to the edge cell.

Definition at line 187 of file Lattice.hpp.

188 {
189 const glm::vec2 local = (p - bounds.min) / cell_size();
190 const glm::vec2 clamped = glm::clamp(
191 glm::floor(local), glm::vec2(0.0F), glm::vec2(resolution) - 1.0F);
192 return glm::uvec2(clamped);
193 }
AABB2D bounds
Continuous extent subdivided.
Definition Lattice.hpp:127
glm::uvec2 resolution
Cell count per axis. Zero on either axis is invalid.
Definition Lattice.hpp:126
glm::vec2 cell_size() const noexcept
Edge length of one cell along each axis.
Definition Lattice.hpp:130

References bounds, cell_size(), MayaFlux::Kinesis::AABB2D::min, and resolution.

+ Here is the call graph for this function: