diff options
author | worktycho <work.tycho@gmail.com> | 2013-12-09 18:51:12 +0100 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2013-12-09 18:51:12 +0100 |
commit | 843605d59ebc128be0a578dc6f45ef8c05da6e79 (patch) | |
tree | 3ffebc6ba27baf7a9e1d4bc51501ffeea9b14226 /src/VoronoiMap.h | |
parent | merged makefile changes (diff) | |
parent | Fix Undefined behavior at Bindings/LuaWindow line 32 (diff) | |
download | cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.gz cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.bz2 cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.lz cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.xz cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.zst cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.zip |
Diffstat (limited to 'src/VoronoiMap.h')
-rw-r--r-- | src/VoronoiMap.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/VoronoiMap.h b/src/VoronoiMap.h new file mode 100644 index 000000000..bcd37f9cf --- /dev/null +++ b/src/VoronoiMap.h @@ -0,0 +1,45 @@ + +// VoronoiMap.h + +// Declares the cVoronoiMap class that implements a Voronoi algorithm over a noise to produce a map + + + + + +#pragma once + +#include "Noise.h" + + + + + +class cVoronoiMap +{ +public: + cVoronoiMap(int a_Seed, int a_CellSize = 128); + + /// Sets the cell size used for generating the Voronoi seeds + void SetCellSize(int a_CellSize); + + /// Returns the value in the cell into which the specified point lies + int GetValueAt(int a_X, int a_Y); + + /// Returns the value in the cell into which the specified point lies, and the distance to the nearest Voronoi seed + int GetValueAt(int a_X, int a_Y, int & a_MinDistance); + + /// Returns the value in the cell into which the specified point lies, and the distances to the 2 nearest Voronoi seeds + int GetValueAt(int a_X, int a_Y, int & a_MinDistance1, int & a_MinDistance2); + +protected: + /// The noise used for generating Voronoi seeds + cNoise m_Noise; + + /// Size of the Voronoi cells (avg X/Y distance between the seeds) + int m_CellSize; +} ; + + + + |