Sampler Lloyd 3D
Description
This sampler is a wrapper around the
geogram
library for an efficient implementation of periodic and non-periodic
Delaunay triangulation in 3D. The Lloyd_3dd
sampler is a standard
implementation of Lloyd’s relaxation algorithm.
Files
src/samplers/Lloyd.cpp
include/utk/samplers/Lloyd.hpp
externals/Lloyd/*
Usage
Lloyd sampler
Usage: ./samplers/Lloyd [OPTIONS]
Options:
-h,--help Print this help message and exit
-n UINT REQUIRED Number of points
-s,--seed UINT Seed (unspecified means 'random')
-m UINT [1] Number of pointsets
-o,--out TEXT [out.dat] Output file
--steps [100] Number of steps to perform
--toroidal [0] When set, use toroidal version.
--silent Silence UTK logs
#include <utk/utils/PointsetIO.hpp>
#include <utk/utils/Pointset.hpp>
#include <utk/samplers/SamplerLloyd.hpp>
int main()
{
utk::Pointset<double> pts;
utk::SamplerLloyd lloyd(100 /* nbSteps */, true /* True for toroidal */ );
lloyd.setRandomSeed(/* empty means random, can also pass a number */);
// Check for no errors
if (lloyd.generateSamples(pts, 1024 /* Number of points, must be a squared */))
{
write_text_pointset("lloyd.dat", pts);
}
}
import pyutk
lloyd = pyutk.Lloyd()
samples = lloyd.sample(1024) # This is a numpy array !
Results
License
See Licence.md file.