Skip to content

Commit

Permalink
removing debug code as its executing in production
Browse files Browse the repository at this point in the history
Also this code contains svg generation, which is majorly used in debugging application
  • Loading branch information
saumyaj3 committed Apr 26, 2024
1 parent 237ea24 commit 5d4a4f0
Showing 1 changed file with 0 additions and 51 deletions.
51 changes: 0 additions & 51 deletions src/utils/polygonUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@
#include "utils/linearAlg2D.h"

#ifdef DEBUG
#include <filesystem>

#include <spdlog/spdlog.h>

#include "utils/AABB.h"
#include "utils/SVG.h"
#endif

namespace fs = std::filesystem;

namespace cura
{

Expand Down Expand Up @@ -693,51 +687,6 @@ ClosestPolygonPoint PolygonUtils::ensureInsideOrOutside(
bool overall_is_inside = polygons.inside(overall_inside.location_);
if (overall_is_inside != (preferred_dist_inside > 0))
{
#ifdef DEBUG
static bool has_run = false;
if (! has_run)
{
fs::path const debug_file_name = fs::temp_directory_path() / "debug.html";
try
{
int offset_performed = offset / 2;
AABB aabb(polygons);
aabb.expand(std::abs(preferred_dist_inside) * 2);
SVG svg(debug_file_name.string(), aabb);
svg.writeComment("Original polygon in black");
svg.writePolygons(polygons, SVG::Color::BLACK);
for (auto poly : polygons)
{
for (auto point : poly)
{
svg.writePoint(point, true, 2);
}
}
std::stringstream ss;
svg.writeComment("Reference polygon in yellow");
svg.writePolygon(closest_poly, SVG::Color::YELLOW);
ss << "Offsetted polygon in blue with offset " << offset_performed;
svg.writeComment(ss.str());
svg.writePolygons(insetted, SVG::Color::BLUE);
for (auto poly : insetted)
{
for (auto point : poly)
{
svg.writePoint(point, true, 2);
}
}
svg.writeComment("From location");
svg.writePoint(from, true, 5, SVG::Color::GREEN);
svg.writeComment("Location computed to be inside the black polygon");
svg.writePoint(inside.location_, true, 5, SVG::Color::RED);
}
catch (...)
{
}
spdlog::error("Clipper::offset failed. See generated {}! Black is original Blue is offsetted polygon", debug_file_name.string());
has_run = true;
}
#endif
return ClosestPolygonPoint();
}
inside = overall_inside;
Expand Down

0 comments on commit 5d4a4f0

Please sign in to comment.