52 [[nodiscard]]
size_t index(
const glm::uvec3& c)
const noexcept
61 [[nodiscard]]
bool in_bounds(
const glm::uvec3& c)
const noexcept
70 [[nodiscard]] glm::vec3
cell_center(
const glm::uvec3& c)
const noexcept
88 [[nodiscard]] glm::uvec3
cell_at(
const glm::vec3& p)
const noexcept
91 const glm::vec3 clamped = glm::clamp(
92 glm::floor(local), glm::vec3(0.0F), glm::vec3(
resolution) - 1.0F);
93 return glm::uvec3(clamped);
151 [[nodiscard]]
size_t index(
const glm::uvec2& c)
const noexcept
153 return static_cast<size_t>(c.y) *
resolution.x + c.x;
160 [[nodiscard]]
bool in_bounds(
const glm::uvec2& c)
const noexcept
169 [[nodiscard]] glm::vec2
cell_center(
const glm::uvec2& c)
const noexcept
187 [[nodiscard]] glm::uvec2
cell_at(
const glm::vec2& p)
const noexcept
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);
213 return { .
resolution = { 2U, 2U }, .bounds = { .min = glm::vec2(-1.0F), .max = glm::vec2(1.0F) } };
float height() const noexcept
float width() const noexcept
Axis-aligned bounding rectangle in a 2D coordinate space.
glm::vec3 extent() const noexcept
Axis-aligned bounding box in 3D world space.
glm::uvec2 cell_at(const glm::vec2 &p) const noexcept
Cell containing a position, clamped to the lattice.
size_t cell_count() const noexcept
Total cell count.
size_t corner_count() const noexcept
Corner count, one greater than the cell count on each axis.
Lattice2D resampled(const glm::uvec2 &res) const noexcept
A lattice over the same bounds at a different resolution.
AABB2D bounds
Continuous extent subdivided.
glm::uvec2 resolution
Cell count per axis. Zero on either axis is invalid.
glm::vec2 cell_center(const glm::uvec2 &c) const noexcept
Position of a cell's centre.
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.
static Lattice2D ndc_quadrants() noexcept
Quadrant lattice over NDC space, resolution {2, 2}.
glm::vec2 cell_size() const noexcept
Edge length of one cell along each axis.
glm::vec2 corner_position(const glm::uvec2 &c) const noexcept
Position of a lattice corner.
A regular subdivision of an AABB2D into a cell count per axis.
size_t index(const glm::uvec3 &c) const noexcept
Linear index of a cell, x-major.
glm::vec3 cell_size() const noexcept
Edge length of one cell along each axis.
Lattice3D resampled(const glm::uvec3 &res) const noexcept
A lattice over the same bounds at a different resolution.
AABB3D bounds
Continuous extent subdivided.
size_t cell_count() const noexcept
Total cell count.
glm::uvec3 resolution
Cell count per axis. Zero on any axis is invalid.
bool in_bounds(const glm::uvec3 &c) const noexcept
Whether a cell coordinate lies inside the lattice.
glm::vec3 corner_position(const glm::uvec3 &c) const noexcept
World position of a lattice corner.
glm::vec3 cell_center(const glm::uvec3 &c) const noexcept
World position of a cell's centre.
size_t corner_count() const noexcept
Corner count, one greater than the cell count on each axis.
glm::uvec3 cell_at(const glm::vec3 &p) const noexcept
Cell containing a world position, clamped to the lattice.
A regular subdivision of an AABB3D into a cell count per axis.