|
MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
|
A regular subdivision of an AABB2D into a cell count per axis. More...
#include <Lattice.hpp>
Collaboration diagram for MayaFlux::Kinesis::Lattice2D:Public Member Functions | |
| glm::uvec2 | cell_at (const glm::vec2 &p) const noexcept |
| Cell containing a position, clamped to the lattice. | |
| glm::vec2 | cell_center (const glm::uvec2 &c) const noexcept |
| Position of a cell's centre. | |
| size_t | cell_count () const noexcept |
| Total cell count. | |
| glm::vec2 | cell_size () const noexcept |
| Edge length of one cell along each axis. | |
| size_t | corner_count () const noexcept |
| Corner count, one greater than the cell count on each axis. | |
| glm::vec2 | corner_position (const glm::uvec2 &c) const noexcept |
| Position of a lattice corner. | |
| bool | in_bounds (const glm::uvec2 &c) const noexcept |
| Whether a cell coordinate lies inside the lattice. | |
| size_t | index (const glm::uvec2 &c) const noexcept |
| Linear index of a cell, x-major. | |
| Lattice2D | resampled (const glm::uvec2 &res) const noexcept |
| A lattice over the same bounds at a different resolution. | |
Static Public Member Functions | |
| static Lattice2D | ndc_quadrants () noexcept |
| Quadrant lattice over NDC space, resolution {2, 2}. | |
Public Attributes | |
| AABB2D | bounds { .min = glm::vec2(-1.0F), .max = glm::vec2(1.0F) } |
| Continuous extent subdivided. | |
| glm::uvec2 | resolution { 1U } |
| Cell count per axis. Zero on either axis is invalid. | |
A regular subdivision of an AABB2D into a cell count per axis.
2D sibling of Lattice3D. Pairs the continuous extent AABB2D describes with a discrete resolution: quadrant subdivision is resolution {2, 2}, an NDC-space grid for hit testing or occupancy is any other resolution. Everything else is derived: cell size, cell centre, corner position, linear index.
Indexing is x-major, y outermost, matching Lattice3D's convention with the z axis simply absent rather than fixed at 1: a 2D lattice is a distinct type from a 3D lattice with unit depth, not a special case of it, since callers working purely in 2D should never need to reason about a z coordinate that does not exist for their problem.
Definition at line 125 of file Lattice.hpp.