Merge branch 'master' into fs_svg_SPE-1517

This commit is contained in:
Filip Sykala - NTB T15p 2023-09-26 15:06:56 +02:00
commit 2aafec0576
7 changed files with 11 additions and 11 deletions

View File

@ -94,7 +94,7 @@ void fill_distances(const Polygon &poly, std::vector<double> &distances)
double dist = 0.;
auto lrange = line_range(poly);
for (const Line &l : lrange) {
for (const Line l : lrange) {
dist += l.length();
distances.emplace_back(dist);
}

View File

@ -132,7 +132,7 @@ Polygon ifp_convex_convex(const Polygon &fixed, const Polygon &movable)
// the zero area polygon formed by the edge. The union of all these sub-nfps
// will contain a hole that is the actual ifp.
auto lrange = line_range(fixed);
for (const Line &l : lrange) { // Older mac compilers generate warnging if line_range is called in-place
for (const Line l : lrange) { // Older mac compilers generate warnging if line_range is called in-place
Polygon fixed = {l.a, l.b};
subnfps.emplace_back(nfp_convex_convex_legacy(fixed, movable));
}

View File

@ -29,7 +29,7 @@ static void RGBtoHSV(float r, float g, float b, float& h, float& s, float& v)
h = 60.0f * (std::fmod(((g - b) / delta), 6.0f));
else if (max_comp == g)
h = 60.0f * (((b - r) / delta) + 2.0f);
else if (max_comp == b)
else // max_comp == b
h = 60.0f * (((r - g) / delta) + 4.0f);
s = (max_comp > 0.0f) ? delta / max_comp : 0.0f;

View File

@ -50,27 +50,27 @@ std::vector<ExtendedPoint> estimate_points_properties(const POINTS
float max_line_length = -1.0f)
{
bool looped = input_points.front() == input_points.back();
std::function<int(int,size_t)> get_prev_index = [](int idx, size_t count) {
std::function<size_t(size_t,size_t)> get_prev_index = [](size_t idx, size_t count) {
if (idx > 0) {
return idx - 1;
} else
return idx;
};
if (looped) {
get_prev_index = [](int idx, size_t count) {
get_prev_index = [](size_t idx, size_t count) {
if (idx == 0)
idx = count;
return --idx;
};
};
std::function<int(int,size_t)> get_next_index = [](int idx, size_t size) {
std::function<size_t(size_t,size_t)> get_next_index = [](size_t idx, size_t size) {
if (idx + 1 < size) {
return idx + 1;
} else
return idx;
};
if (looped) {
get_next_index = [](int idx, size_t count) {
get_next_index = [](size_t idx, size_t count) {
if (++idx == count)
idx = 0;
return idx;
@ -186,7 +186,7 @@ std::vector<ExtendedPoint> estimate_points_properties(const POINTS
float accumulated_distance = 0;
std::vector<float> distances_for_curvature(points.size());
for (int point_idx = 0; point_idx < int(points.size()); ++point_idx) {
for (size_t point_idx = 0; point_idx < points.size(); ++point_idx) {
const ExtendedPoint &a = points[point_idx];
const ExtendedPoint &b = points[get_prev_index(point_idx, points.size())];

View File

@ -81,7 +81,7 @@ static inline void validate_range(const MultiPoint &mp)
validate_range(mp.points);
}
static inline void validate_range(const Polygons &polygons)
[[maybe_unused]] static inline void validate_range(const Polygons &polygons)
{
for (const Polygon &p : polygons)
validate_range(p);

View File

@ -154,7 +154,7 @@ TextLines select_closest_contour(const std::vector<Polygons> &line_contours) {
std::vector<Linef> linesf = to_linesf(expolygons);
AABBTreeIndirect::Tree2d tree = AABBTreeLines::build_aabb_tree_over_indexed_lines(linesf);
size_t line_idx;
size_t line_idx = 0;
Vec2d hit_point;
// double distance =
AABBTreeLines::squared_distance_to_indexed_lines(linesf, tree, zero, line_idx, hit_point);

View File

@ -72,7 +72,7 @@ TEST_CASE("Moments calculation for rotated axis.", "[SupportSpotsGenerator]") {
Integrals integrals{{polygon}};
std::mt19937 generator{std::random_device{}()};
std::uniform_real_distribution<float> angle_distribution{0, 2*M_PI};
std::uniform_real_distribution<float> angle_distribution{0.f, float(2*M_PI)};
// Meassured counterclockwise from (1, 0)
const float angle = angle_distribution(generator);