From ac793df2ab14a2b98504d9ea49bc4abcee828052 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 27 Nov 2013 14:26:28 +0100 Subject: Added missing files for Voronoi map generation. --- src/VoronoiMap.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/VoronoiMap.h (limited to 'src/VoronoiMap.h') 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; +} ; + + + + -- cgit v1.2.3