../src/slic3r/GUI/TextLines.cpp:27:24: warning: ‘const Slic3r::Polygon* {anonymous}::largest(const Polygons&)’ defined but not used [-Wunused-function]
../src/slic3r/GUI/TextLines.cpp:74:10: warning: variable ‘calc_norm’ set but not used [-Wunused-but-set-variable]
This commit is contained in:
Filip Sykala - NTB T15p 2023-08-14 13:51:00 +02:00
parent 6ab3963d83
commit 0cda6ddc17

View File

@ -24,27 +24,6 @@ using namespace Slic3r::Emboss;
using namespace Slic3r::GUI;
namespace {
const Slic3r::Polygon *largest(const Slic3r::Polygons &polygons)
{
if (polygons.empty())
return nullptr;
if (polygons.size() == 1)
return &polygons.front();
// compare polygon to find largest
size_t biggest_size = 0;
const Slic3r::Polygon *result = nullptr;
for (const Slic3r::Polygon &polygon : polygons) {
Point s = polygon.bounding_box().size();
size_t size = s.x() * s.y();
if (size <= biggest_size)
continue;
biggest_size = size;
result = &polygon;
}
return result;
}
// Be careful it is not water tide and contain self intersections
// It is only for visualization purposes
indexed_triangle_set its_create_torus(const Slic3r::Polygon &polygon, float radius, size_t steps = 20)
@ -70,12 +49,6 @@ indexed_triangle_set its_create_torus(const Slic3r::Polygon &polygon, float radi
line_norm[i] = calc_line_norm(points_d[i], points_d[i + 1]);
line_norm.back() = calc_line_norm(points_d.back(), points_d.front());
// calculate normals for each point
auto calc_norm = [](const Vec2f &prev, const Vec2f &next) -> Vec2f {
Vec2f dir = prev + next;
return Vec2f(-dir.x(), dir.y());
};
// precalculate sinus and cosinus
double angle_step = 2 * M_PI / steps;
std::vector<std::pair<double, float>> sin_cos;