HighMap library (C++)
|
HeightMap class, to manipulate heightmap (with contextual informations). More...
#include <heightmap.hpp>
Public Member Functions | |
Heightmap (Vec2< int > shape, Vec2< int > tiling, float overlap) | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Heightmap (Vec2< int > shape, Vec2< int > tiling, float overlap, float fill_value) | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Heightmap (Vec2< int > shape, Vec2< int > tiling) | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Heightmap (Vec2< int > shape) | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Heightmap () | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
size_t | get_ntiles () const |
Get the number of tiles. | |
int | get_tile_index (int i, int j) const |
Get the tile linear index. | |
float | get_value_bilinear (float x, float y) const |
float | get_value_nearest (float x, float y) const |
void | set_overlap (float new_overlap) |
Set the tile overlapping. | |
void | set_shape (Vec2< int > new_shape) |
Set the heightmap shape. | |
void | set_sto (Vec2< int > new_shape, Vec2< int > new_tiling, float new_overlap) |
Set the shape / tiling / overlap in one pass. | |
void | set_tiling (Vec2< int > new_tiling) |
Set the tiling setup. | |
void | from_array_interp (Array &array) |
Fill tile values by interpolating (bilinear) values from another array. | |
void | from_array_interp_bicubic (Array &array) |
Fill tile values by interpolating (bicubic) values from another array. | |
void | from_array_interp_bilinear (Array &array) |
Fill tile values by interpolating (bilinear) values from another array. | |
void | from_array_interp_nearest (Array &array) |
Fill tile values by interpolating (nearest neighbor) values from another array. | |
void | infos () |
Print some informations about the object. | |
void | inverse () |
Inverse the heightmap values (max - values). | |
float | max () |
Return the value of the greatest element in the heightmap data. | |
float | mean () |
Return the mean of the heightmap data. | |
float | min () |
Return the value of the smallest element in the heightmap data. | |
void | remap (float vmin=0.f, float vmax=1.f) |
Remap heightmap elements from a starting range to a target range. | |
void | remap (float vmin, float vmax, float from_min, float from_max) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | smooth_overlap_buffers () |
Smooth the transitions between each tiles (when overlap > 0). | |
float | sum () |
Return the sum of the heightmap data. | |
Array | to_array (Vec2< int > shape_export) |
Return the heightmap as an array. | |
Array | to_array () |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
std::vector< uint16_t > | to_grayscale_image_16bit () |
Converts the heightmap to a 16-bit grayscale representation. | |
std::vector< uint16_t > | to_grayscale_image_16bit_multithread () |
std::vector< uint8_t > | to_grayscale_image_8bit () |
std::vector< float > | unique_values () |
Returns the unique elements of the heightmap. | |
void | update_tile_parameters () |
Update tile parameters. | |
Public Attributes | |
Vec2< int > | shape |
Heightmap global shape. | |
Vec2< int > | tiling = {1, 1} |
Tiling setup (number of tiles in each direction). | |
float | overlap = 0.f |
Tile overlapping, in [0, 1[. | |
std::vector< Tile > | tiles = {} |
Tile storage. | |
HeightMap class, to manipulate heightmap (with contextual informations).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
hmap::Heightmap::Heightmap | ( | Vec2< int > | shape, |
Vec2< int > | tiling, | ||
float | overlap, | ||
float | fill_value | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
hmap::Heightmap::Heightmap | ( | Vec2< int > | shape | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
hmap::Heightmap::Heightmap | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
size_t hmap::Heightmap::get_ntiles | ( | ) | const |
Get the number of tiles.
int hmap::Heightmap::get_tile_index | ( | int | i, |
int | j | ||
) | const |
float hmap::Heightmap::get_value_bilinear | ( | float | x, |
float | y | ||
) | const |
float hmap::Heightmap::get_value_nearest | ( | float | x, |
float | y | ||
) | const |
void hmap::Heightmap::set_overlap | ( | float | new_overlap | ) |
Set the tile overlapping.
new_overlap | New overlap. |
void hmap::Heightmap::set_shape | ( | Vec2< int > | new_shape | ) |
Set the heightmap shape.
new_shape | New shape. |
Set the shape / tiling / overlap in one pass.
new_shape | New shape. |
new_tiling | New tiling. |
new_overlap | New overlap. |
void hmap::Heightmap::set_tiling | ( | Vec2< int > | new_tiling | ) |
Set the tiling setup.
new_tiling | New tiling. |
void hmap::Heightmap::from_array_interp | ( | Array & | array | ) |
Fill tile values by interpolating (bilinear) values from another array.
array | Input array. |
Example
Result
void hmap::Heightmap::from_array_interp_bicubic | ( | Array & | array | ) |
Fill tile values by interpolating (bicubic) values from another array.
array | Input array. |
void hmap::Heightmap::from_array_interp_bilinear | ( | Array & | array | ) |
Fill tile values by interpolating (bilinear) values from another array.
array | Input array. |
void hmap::Heightmap::from_array_interp_nearest | ( | Array & | array | ) |
Fill tile values by interpolating (nearest neighbor) values from another array.
array | Input array. |
void hmap::Heightmap::infos | ( | ) |
Print some informations about the object.
void hmap::Heightmap::inverse | ( | ) |
Inverse the heightmap values (max - values).
float hmap::Heightmap::max | ( | ) |
Return the value of the greatest element in the heightmap data.
float hmap::Heightmap::mean | ( | ) |
Return the mean of the heightmap data.
float hmap::Heightmap::min | ( | ) |
Return the value of the smallest element in the heightmap data.
Remap heightmap elements from a starting range to a target range.
By default the starting range is taken to be [min(), max()] of the input array.
array | Input array. |
vmin | The lower bound of the range to remap to. |
vmax | The lower bound of the range to remap to. |
from_min | The lower bound of the range to remap from. |
from_max | The upper bound of the range to remap from. |
void hmap::Heightmap::remap | ( | float | vmin, |
float | vmax, | ||
float | from_min, | ||
float | from_max | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::Heightmap::smooth_overlap_buffers | ( | ) |
Smooth the transitions between each tiles (when overlap > 0).
float hmap::Heightmap::sum | ( | ) |
Return the sum of the heightmap data.
Array hmap::Heightmap::to_array | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
std::vector< uint16_t > hmap::Heightmap::to_grayscale_image_16bit | ( | ) |
Converts the heightmap to a 16-bit grayscale representation.
std::vector<uint16_t>
containing the 16-bit grayscale image data. std::vector< uint16_t > hmap::Heightmap::to_grayscale_image_16bit_multithread | ( | ) |
std::vector< uint8_t > hmap::Heightmap::to_grayscale_image_8bit | ( | ) |
std::vector< float > hmap::Heightmap::unique_values | ( | ) |
Returns the unique elements of the heightmap.
void hmap::Heightmap::update_tile_parameters | ( | ) |
Update tile parameters.
Vec2<int> hmap::Heightmap::tiling = {1, 1} |
Tiling setup (number of tiles in each direction).