VoronoiGrowthSimulator
Based on Site Saturated Nucleation and Isotropic Growth
|
Represents a Voronoi diagram. More...
#include <Voronoi.hpp>
Public Member Functions | |
Voronoi (int m, int n, int p) | |
Constructs a Voronoi object with the specified dimensions and number of points. | |
void | Nucleate (long long myseed) |
Nucleates the Voronoi diagram with the specified seed. | |
void | Nucleate () |
Nucleates the Voronoi diagram with a random seed. | |
void | grow () |
Grows the Voronoi diagram. | |
void | Grow () |
Grows the Voronoi diagram. | |
void | WriteDataToCSV (std::string &filename) |
~Voronoi () | |
Destroys the Voronoi object. | |
Public Attributes | |
std::vector< int > | I |
bool | allgrown = false |
std::vector< color > | colors |
Represents a Voronoi diagram.
The Voronoi class is used to create and manipulate Voronoi diagrams. It provides methods for nucleation, growth, and color assignment.
Definition at line 26 of file Voronoi.hpp.
Voronoi::Voronoi | ( | int | m, |
int | n, | ||
int | p ) |
Constructs a Voronoi object with the specified dimensions and number of points.
Constructs a Voronoi object with the given parameters.
m | The width of the Voronoi diagram. |
n | The height of the Voronoi diagram. |
p | The number of Voronoi diagram points. |
m | The number of rows in the Voronoi diagram. |
n | The number of columns in the Voronoi diagram. |
p | The number of points in the Voronoi diagram. |
Definition at line 66 of file Voronoi.cpp.
Voronoi::~Voronoi | ( | ) |
void Voronoi::grow | ( | ) |
Grows the Voronoi diagram.
Grows the Voronoi diagram by one iteration.
This function performs one iteration of the growth process for the Voronoi diagram. It checks each cell in the diagram and determines if it should be grown based on its neighbors. The growth process continues until all cells have been grown or no more growth is possible.
Nucleate
function has been called before the first iteration of growth.I
and a
arrays to reflect the growth of the diagram.allgrown
flag to indicate if all cells have been grown.r
variable to increase the radius of growth for the next iteration.I
, a
, X
, Y
, m
, n
, p
, Grown
, Growing
, and iscomplete
variables are properly initialized. Definition at line 162 of file Voronoi.cpp.
void Voronoi::Grow | ( | ) |
Grows the Voronoi diagram.
Definition at line 448 of file Voronoi.cpp.
void Voronoi::Nucleate | ( | ) |
Nucleates the Voronoi diagram with a random seed.
Nucleates the Voronoi diagram by creating a new MTEngine object, calling the nucleate function, and then deleting the MTEngine object.
Definition at line 124 of file Voronoi.cpp.
void Voronoi::Nucleate | ( | long long | myseed | ) |
Nucleates the Voronoi diagram with the specified seed.
myseed | The seed used for nucleation. |
Nucleates the Voronoi diagram with the given seed.
myseed | The seed used for random number generation. |
Definition at line 136 of file Voronoi.cpp.
void Voronoi::WriteDataToCSV | ( | std::string & | filename | ) |
Writes the 2D data (I) to a CSV file.
filename | The name of the CSV file to write the data to. |
Definition at line 463 of file Voronoi.cpp.
bool Voronoi::allgrown = false |
Flag indicating if all points in the Voronoi diagram have grown.
Definition at line 46 of file Voronoi.hpp.
std::vector<color> Voronoi::colors |
The colors assigned to each Voronoi diagram point.
Definition at line 47 of file Voronoi.hpp.
std::vector<int> Voronoi::I |
The index of the Voronoi diagram point each pixel belongs to.
Definition at line 45 of file Voronoi.hpp.