mirror of
https://gitlab.com/Trygve/contour-creator.git
synced 2024-12-22 05:40:18 +00:00
added some comments
This commit is contained in:
parent
77467594bd
commit
ab96f9477e
@ -90,4 +90,6 @@ void HeightMap::blur(float standard_deviation)
|
|||||||
free(this->data);
|
free(this->data);
|
||||||
this->data = blurred;
|
this->data = blurred;
|
||||||
blurred = nullptr;
|
blurred = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void::
|
12
src/main.cpp
12
src/main.cpp
@ -42,7 +42,7 @@ std::vector<Point> produce_cellmap(HeightMap* heightmap, float z)
|
|||||||
std::vector<std::vector<Point>> vector_cellmap(HeightMap* heightmap, int interval)
|
std::vector<std::vector<Point>> vector_cellmap(HeightMap* heightmap, int interval)
|
||||||
{
|
{
|
||||||
int num_contours = (heightmap->max - heightmap->min)/interval;
|
int num_contours = (heightmap->max - heightmap->min)/interval;
|
||||||
std::vector<std::vector<Point>> vector_contours;
|
std::vector<std::vector<Point>> vector_contours; // initiating a vector of contours
|
||||||
omp_set_num_threads(12);
|
omp_set_num_threads(12);
|
||||||
|
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
@ -52,13 +52,12 @@ std::vector<std::vector<Point>> vector_cellmap(HeightMap* heightmap, int interva
|
|||||||
for (int i = 1; i <= num_contours; i++)
|
for (int i = 1; i <= num_contours; i++)
|
||||||
{
|
{
|
||||||
auto points = produce_cellmap(heightmap, heightmap->min + interval*i);
|
auto points = produce_cellmap(heightmap, heightmap->min + interval*i);
|
||||||
|
|
||||||
|
|
||||||
for (int j = 0; j < points.size(); j++){
|
for (int j = 0; j < points.size(); j++){ //looping through all the points.
|
||||||
Point current = points[j];
|
Point current = points[j]; // assigning an instance of Point class to a point.
|
||||||
//std::cout << points_allocated << " " << points.size() << "\n";
|
//std::cout << points_allocated << " " << points.size() << "\n";
|
||||||
for (int k = 0; k < points.size(); k++){
|
for (int k = 0; k < points.size(); k++){ // looping through all other points.
|
||||||
Point candidate = points[k];
|
Point candidate = points[k];
|
||||||
if (candidate.next != nullptr) {
|
if (candidate.next != nullptr) {
|
||||||
if (candidate.x +1 == current.x) {
|
if (candidate.x +1 == current.x) {
|
||||||
current.next = &candidate;
|
current.next = &candidate;
|
||||||
@ -80,7 +79,6 @@ std::vector<std::vector<Point>> vector_cellmap(HeightMap* heightmap, int interva
|
|||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
|
|
||||||
vector_contours.insert(vector_contours.end(), vec_private.begin(), vec_private.end());
|
vector_contours.insert(vector_contours.end(), vec_private.begin(), vec_private.end());
|
||||||
|
|
||||||
}
|
}
|
||||||
return vector_contours;
|
return vector_contours;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user