FINALLY FOUND THE LAST ERROR IN THE LOOKUPTABLE 😎🥳

This commit is contained in:
Trygve 2024-05-07 21:03:47 +02:00
parent b4b89c2282
commit 264c0341ed

View File

@ -176,7 +176,7 @@ constexpr std::tuple<double, double, double, double> marching_squares_lookup(int
case 7: case 7:
return {0, 0.5, 0.5, 1}; return {0, 0.5, 0.5, 1};
case 8: 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<std::vector<Point>> all_points, const char *f
if ((points[k].x - points[k-1].x) < 0) if ((points[k].x - points[k-1].x) < 0)
left_to_right = false; left_to_right = false;
bool top_to_bottom = true; 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; left_to_right = false;
@ -263,12 +263,12 @@ void write_output_file(std::vector<std::vector<Point>> all_points, const char *f
if (left_to_right or !top_to_bottom) if (left_to_right or !top_to_bottom)
{ {
geometry->setPoint(geometry->getNumPoints(),x + (x1/6) ,y + (y1/6)); geometry->setPoint(geometry->getNumPoints(),x + (x1/4) ,y + (y1/4));
geometry->setPoint(geometry->getNumPoints(),x + (x2/6) ,y + (y2/6)); geometry->setPoint(geometry->getNumPoints(),x + (x2/4) ,y + (y2/4));
} }
else { else {
geometry->setPoint(geometry->getNumPoints(),x + (x2/6) ,y + (y2/6)); geometry->setPoint(geometry->getNumPoints(),x + (x2/4) ,y + (y2/4));
geometry->setPoint(geometry->getNumPoints(),x + (x1/6) ,y + (y1/6)); geometry->setPoint(geometry->getNumPoints(),x + (x1/4) ,y + (y1/4));
} }
} }
@ -324,8 +324,8 @@ int main(int argc, const char* argv[])
map.statistics(); map.statistics();
std::string steepness_output_file; std::string steepness_output_file;
if (cmdl({"--steepness"}, "steepness.tif") >> steepness_output_file) //if (cmdl({"--steepness"}, "steepness.tif") >> steepness_output_file)
map.calculate_steepness(output_file.c_str()); // map.calculate_steepness(output_file.c_str());
auto lines = create_lines(&map, interval); auto lines = create_lines(&map, interval);
write_output_file(lines, output_file.c_str(), &map); write_output_file(lines, output_file.c_str(), &map);