Skip to content

Sampler Hexagonal Grid

Description

An hexagonal grid.

For a more precise description of this sampler and its performances in terms of aliasing and discrepancy, please refer to the following web bundle https://liris.cnrs.fr/ldbn/HTML_bundle/index.html.

Files

src/samplers/HexagonalGrid.cpp  
include/utk/samplers/SamplerHexagonalGrid.hpp

Usage


HexGrid sampler
Usage: ./HexagonalGrid [OPTIONS]

Options:
  -h,--help                   Print this help message and exit
  -n UINT REQUIRED            Number of points
  -d UINT                     UNUSED ! Here for compatibility with others.
  -s,--seed UINT              UNUSED ! Here for compatibility with others.
  -m UINT [1]                 Number of pointsets
  -o,--out TEXT [out.dat]     Output file (format). {i} splits outputs in multiple files and token is replaced by index.
  --silent                    Silence UTK logs
#include <utk/utils/PointsetIO.hpp>
#include <utk/utils/Pointset.hpp>
#include <utk/samplers/SamplerHexagonalGrid.hpp>

int main()
{
    utk::Pointset<double> pts;
    utk::SamplerHexagonalGrid hex;

    // Check for no errors
    if (hex.generateSamples(pts, 1024 /* Number of points, must be a squared */))
    {
        write_text_pointset("hex.dat", pts);
    }
}
import pyutk

# Number of samples must be a square
hexgrid = pyutk.HexagonalGrid()
samples = hexgrid.sample(1024)  # This is a numpy array !

Results

License

See Licence.md file.