From 264c0341ed9958649968effeba205ad512a41e85 Mon Sep 17 00:00:00 2001 From: Trygve Date: Tue, 7 May 2024 21:03:47 +0200 Subject: [PATCH] =?UTF-8?q?FINALLY=20FOUND=20THE=20LAST=20ERROR=20IN=20THE?= =?UTF-8?q?=20LOOKUPTABLE=20=F0=9F=98=8E=EF=B8=8F=F0=9F=A5=B3=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2a195d7..591d141 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -176,7 +176,7 @@ constexpr std::tuple marching_squares_lookup(int case 7: return {0, 0.5, 0.5, 1}; case 8: - return {0.5, 0.5, 0, 0.5}; + return {0.5, 1, 0, 0.5}; }; @@ -250,7 +250,7 @@ void write_output_file(std::vector> all_points, const char *f if ((points[k].x - points[k-1].x) < 0) left_to_right = false; bool top_to_bottom = true; - if ((points[k].y - points[k-1].y) < 0) + if ((points[k].y - points[k-1].y) <= 0) left_to_right = false; @@ -263,12 +263,12 @@ void write_output_file(std::vector> all_points, const char *f if (left_to_right or !top_to_bottom) { - geometry->setPoint(geometry->getNumPoints(),x + (x1/6) ,y + (y1/6)); - geometry->setPoint(geometry->getNumPoints(),x + (x2/6) ,y + (y2/6)); + geometry->setPoint(geometry->getNumPoints(),x + (x1/4) ,y + (y1/4)); + geometry->setPoint(geometry->getNumPoints(),x + (x2/4) ,y + (y2/4)); } else { - geometry->setPoint(geometry->getNumPoints(),x + (x2/6) ,y + (y2/6)); - geometry->setPoint(geometry->getNumPoints(),x + (x1/6) ,y + (y1/6)); + geometry->setPoint(geometry->getNumPoints(),x + (x2/4) ,y + (y2/4)); + geometry->setPoint(geometry->getNumPoints(),x + (x1/4) ,y + (y1/4)); } } @@ -324,8 +324,8 @@ int main(int argc, const char* argv[]) map.statistics(); std::string steepness_output_file; - if (cmdl({"--steepness"}, "steepness.tif") >> steepness_output_file) - map.calculate_steepness(output_file.c_str()); + //if (cmdl({"--steepness"}, "steepness.tif") >> steepness_output_file) + // map.calculate_steepness(output_file.c_str()); auto lines = create_lines(&map, interval); write_output_file(lines, output_file.c_str(), &map);