From ab96f9477e7508c0f88422bcb4ab6fd7ca850079 Mon Sep 17 00:00:00 2001 From: esther Date: Tue, 7 May 2024 10:48:48 +0200 Subject: [PATCH] added some comments --- src/HeightMap.cpp | 4 +++- src/main.cpp | 12 +++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/HeightMap.cpp b/src/HeightMap.cpp index 017a0a4..2e788af 100644 --- a/src/HeightMap.cpp +++ b/src/HeightMap.cpp @@ -90,4 +90,6 @@ void HeightMap::blur(float standard_deviation) free(this->data); this->data = blurred; blurred = nullptr; -} \ No newline at end of file +} + +void:: \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 8da17d0..511f163 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,7 +42,7 @@ std::vector produce_cellmap(HeightMap* heightmap, float z) std::vector> vector_cellmap(HeightMap* heightmap, int interval) { int num_contours = (heightmap->max - heightmap->min)/interval; - std::vector> vector_contours; + std::vector> vector_contours; // initiating a vector of contours omp_set_num_threads(12); #pragma omp parallel @@ -52,13 +52,12 @@ std::vector> vector_cellmap(HeightMap* heightmap, int interva for (int i = 1; i <= num_contours; i++) { auto points = produce_cellmap(heightmap, heightmap->min + interval*i); - - for (int j = 0; j < points.size(); j++){ - Point current = points[j]; + for (int j = 0; j < points.size(); j++){ //looping through all the points. + Point current = points[j]; // assigning an instance of Point class to a point. //std::cout << points_allocated << " " << points.size() << "\n"; - for (int k = 0; k < points.size(); k++){ - Point candidate = points[k]; + for (int k = 0; k < points.size(); k++){ // looping through all other points. + Point candidate = points[k]; if (candidate.next != nullptr) { if (candidate.x +1 == current.x) { current.next = &candidate; @@ -80,7 +79,6 @@ std::vector> vector_cellmap(HeightMap* heightmap, int interva #pragma omp critical vector_contours.insert(vector_contours.end(), vec_private.begin(), vec_private.end()); - } return vector_contours; }