HighMap library (C++)
Loading...
Searching...
No Matches
grid_mapping.hpp File Reference

Canonical index <-> UV <-> tile coordinate mapping helpers. More...

Go to the source code of this file.

Namespaces

namespace  hmap

Enumerations

enum class  hmap::GridRegistration { hmap::CellCenter , hmap::CellCorner , hmap::Node }
 Grid registration policy for mapping discrete indices to [0, 1]. More...

Functions

float hmap::index_to_uv (int i, int n, GridRegistration reg=GridRegistration::CellCenter)
 Maps a discrete index i in [0, n) to a UV coordinate in [0, 1].
float hmap::uv_to_continuous_index (float u, int n, GridRegistration reg=GridRegistration::CellCenter)
 Maps a UV coordinate in [0, 1] to a continuous index in [0, n - 1].
UvRect hmap::tile_uv_rect (const glm::ivec2 &global_offset, const glm::ivec2 &tile_shape_with_halo, const glm::ivec2 &global_shape, const UvRect &domain_uv=UvRect::unit())
 Computes the exact UV rectangle of a tile (including halo) within a domain of global_shape.

Detailed Description

Canonical index <-> UV <-> tile coordinate mapping helpers.

Author
Otto Link (otto..nosp@m.link.nosp@m..bv@g.nosp@m.mail.nosp@m..com)