From 3523e4cb85e650785ba5e7ef57d0f8a68dec09fa Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Feb 20 2019 19:33:20 +0000 Subject: 3.6.3 --- diff --git a/CuraEngine-lulzbot-3.2.32-gyroid-infill.patch b/CuraEngine-lulzbot-3.2.32-gyroid-infill.patch deleted file mode 100644 index b344184..0000000 --- a/CuraEngine-lulzbot-3.2.32-gyroid-infill.patch +++ /dev/null @@ -1,611 +0,0 @@ -diff -up CuraEngine-lulzbot-3.2.32/CMakeLists.txt.gyroid CuraEngine-lulzbot-3.2.32/CMakeLists.txt ---- CuraEngine-lulzbot-3.2.32/CMakeLists.txt.gyroid 2018-11-30 10:40:31.253643093 -0500 -+++ CuraEngine-lulzbot-3.2.32/CMakeLists.txt 2018-11-30 10:40:48.204268284 -0500 -@@ -103,6 +103,7 @@ set(engine_SRCS # Except main.cpp. - src/infill/SpaghettiInfill.cpp - src/infill/SpaghettiInfillPathGenerator.cpp - src/infill/SubDivCube.cpp -+ src/infill/GyroidInfill.cpp - - src/pathPlanning/Comb.cpp - src/pathPlanning/GCodePath.cpp -diff -up CuraEngine-lulzbot-3.2.32/src/FffGcodeWriter.cpp.gyroid CuraEngine-lulzbot-3.2.32/src/FffGcodeWriter.cpp ---- CuraEngine-lulzbot-3.2.32/src/FffGcodeWriter.cpp.gyroid 2018-11-30 10:41:00.124004709 -0500 -+++ CuraEngine-lulzbot-3.2.32/src/FffGcodeWriter.cpp 2018-11-30 10:46:39.553577358 -0500 -@@ -814,6 +814,8 @@ LayerPlan& FffGcodeWriter::processLayer( - const unsigned int support_bottom_extruder_nr = getSettingAsIndex("support_bottom_extruder_nr"); - const unsigned int support_infill_extruder_nr = (layer_nr <= 0)? getSettingAsIndex("support_extruder_nr_layer_0") : getSettingAsIndex("support_infill_extruder_nr"); - -+ bool disable_path_optimisation = false; -+ - for (unsigned int extruder_nr : extruder_order) - { - if (include_helper_parts -@@ -838,6 +840,9 @@ LayerPlan& FffGcodeWriter::processLayer( - { - addMeshLayerToGCode(storage, mesh, extruder_nr, mesh_config, gcode_layer); - } -+ -+ // path optimization is currently broken when using gyroid infill -+ disable_path_optimisation = disable_path_optimisation || getSettingAsFillMethod("infill_pattern") == EFillMethod::GYROID; - } - } - // ensure we print the prime tower with this extruder, because the next layer begins with this extruder! -diff -up CuraEngine-lulzbot-3.2.32/src/infill.cpp.gyroid CuraEngine-lulzbot-3.2.32/src/infill.cpp ---- CuraEngine-lulzbot-3.2.32/src/infill.cpp.gyroid 2018-11-30 10:46:47.998390322 -0500 -+++ CuraEngine-lulzbot-3.2.32/src/infill.cpp 2018-11-30 10:48:43.899796298 -0500 -@@ -3,6 +3,7 @@ - #include "functional" - #include "utils/polygonUtils.h" - #include "utils/logoutput.h" -+#include "infill/GyroidInfill.h" - - #define SQRT2MUL(x) ((30547*(x))/21600) - #define OCTSLEN(x) ((43200*(x))/73747) -@@ -88,6 +89,9 @@ void Infill::generate(Polygons& result_p - } - generateCrossInfill(*cross_fill_pattern, result_polygons, result_lines); - break; -+ case EFillMethod::GYROID: -+ generateGyroidInfill(result_lines); -+ break; - default: - logError("Fill pattern has unknown value.\n"); - break; -@@ -205,6 +209,11 @@ void Infill::generateTroctInfill(Polygon - } - } - -+void Infill::generateGyroidInfill(Polygons& result_lines) -+{ -+ GyroidInfill::generateTotalGyroidInfill(result_lines, zig_zaggify, outline_offset, infill_line_width, line_distance, in_outline, z); -+} -+ - void Infill::generateConcentricInfill(Polygons& result, int inset_value) - { - Polygons first_concentric_wall = in_outline.offset(outline_offset - line_distance + infill_line_width / 2); // - infill_line_width / 2 cause generateConcentricInfill expects [outline] to be the outer most polygon instead of the outer outline -diff -up CuraEngine-lulzbot-3.2.32/src/infill/GyroidInfill.cpp.gyroid CuraEngine-lulzbot-3.2.32/src/infill/GyroidInfill.cpp ---- CuraEngine-lulzbot-3.2.32/src/infill/GyroidInfill.cpp.gyroid 2018-11-30 10:50:27.483468919 -0500 -+++ CuraEngine-lulzbot-3.2.32/src/infill/GyroidInfill.cpp 2018-11-30 10:50:08.321896306 -0500 -@@ -0,0 +1,409 @@ -+/* -+ * To change this license header, choose License Headers in Project Properties. -+ * To change this template file, choose Tools | Templates -+ * and open the template in the editor. -+ */ -+ -+/* -+ * File: GyroidInfill.cpp -+ * Author: asasin -+ * -+ * Created on October 1, 2018, 11:59 AM -+ */ -+ -+#include "GyroidInfill.h" -+ -+namespace cura { -+ -+GyroidInfill::GyroidInfill() { -+} -+ -+GyroidInfill::~GyroidInfill() { -+} -+ -+void GyroidInfill::generateTotalGyroidInfill(Polygons& result_lines, bool zig_zaggify, coord_t outline_offset, coord_t infill_line_width, coord_t line_distance, const Polygons& in_outline, coord_t z) -+{ -+ // generate infill based on the gyroid equation: sin_x * cos_y + sin_y * cos_z + sin_z * cos_x = 0 -+ // kudos to the author of the Slic3r implementation equation code, the equation code here is based on that -+ -+ if (zig_zaggify) -+ { -+ outline_offset -= infill_line_width / 2; // the infill line zig zag connections must lie next to the border, not on it -+ } -+ -+ const Polygons outline = in_outline.offset(outline_offset); -+ const AABB aabb(outline); -+ -+ int pitch = line_distance * 2.41; // this produces similar density to the "line" infill pattern -+ int num_steps = 4; -+ int step = pitch / num_steps; -+ while (step > 500 && num_steps < 16) -+ { -+ num_steps *= 2; -+ step = pitch / num_steps; -+ } -+ pitch = step * num_steps; // recalculate to avoid precision errors -+ const double z_rads = 2 * M_PI * z / pitch; -+ const double cos_z = std::cos(z_rads); -+ const double sin_z = std::sin(z_rads); -+ std::vector odd_line_coords; -+ std::vector even_line_coords; -+ Polygons result; -+ std::vector chains[2]; // [start_points[], end_points[]] -+ std::vector connected_to[2]; // [chain_indices[], chain_indices[]] -+ std::vector line_numbers; // which row/column line a chain is part of -+ if (std::abs(sin_z) <= std::abs(cos_z)) -+ { -+ // "vertical" lines -+ const double phase_offset = ((cos_z < 0) ? M_PI : 0) + M_PI; -+ for (coord_t y = 0; y < pitch; y += step) -+ { -+ const double y_rads = 2 * M_PI * y / pitch; -+ const double a = cos_z; -+ const double b = std::sin(y_rads + phase_offset); -+ const double odd_c = sin_z * std::cos(y_rads + phase_offset); -+ const double even_c = sin_z * std::cos(y_rads + phase_offset + M_PI); -+ const double h = std::sqrt(a * a + b * b); -+ const double odd_x_rads = ((h != 0) ? std::asin(odd_c / h) + std::asin(b / h) : 0) - M_PI/2; -+ const double even_x_rads = ((h != 0) ? std::asin(even_c / h) + std::asin(b / h) : 0) - M_PI/2; -+ odd_line_coords.push_back(odd_x_rads / M_PI * pitch); -+ even_line_coords.push_back(even_x_rads / M_PI * pitch); -+ } -+ const unsigned num_coords = odd_line_coords.size(); -+ unsigned num_columns = 0; -+ for (coord_t x = (std::floor(aabb.min.X / pitch) - 2.25) * pitch; x <= aabb.max.X + pitch/2; x += pitch/2) -+ { -+ bool is_first_point = true; -+ Point last; -+ bool last_inside = false; -+ unsigned chain_end_index = 0; -+ Point chain_end[2]; -+ for (coord_t y = (std::floor(aabb.min.Y / pitch) - 1) * pitch; y <= aabb.max.Y + pitch; y += pitch) -+ { -+ for (unsigned i = 0; i < num_coords; ++i) -+ { -+ Point current(x + ((num_columns & 1) ? odd_line_coords[i] : even_line_coords[i])/2 + pitch, y + (coord_t)(i * step)); -+ bool current_inside = outline.inside(current, true); -+ if (!is_first_point) -+ { -+ if (last_inside && current_inside) -+ { -+ // line doesn't hit the boundary, add the whole line -+ result.addLine(last, current); -+ } -+ else if (last_inside != current_inside) -+ { -+ // line hits the boundary, add the part that's inside the boundary -+ Polygons line; -+ line.addLine(last, current); -+ line = outline.intersectionPolyLines(line); -+ if (line.size() > 0) -+ { -+ // some of the line is inside the boundary -+ result.addLine(line[0][0], line[0][1]); -+ if (zig_zaggify) -+ { -+ chain_end[chain_end_index] = line[0][(line[0][0] != last && line[0][0] != current) ? 0 : 1]; -+ if (++chain_end_index == 2) -+ { -+ chains[0].push_back(chain_end[0]); -+ chains[1].push_back(chain_end[1]); -+ chain_end_index = 0; -+ connected_to[0].push_back(std::numeric_limits::max()); -+ connected_to[1].push_back(std::numeric_limits::max()); -+ line_numbers.push_back(num_columns); -+ } -+ } -+ } -+ else -+ { -+ // none of the line is inside the boundary so the point that's actually on the boundary -+ // is the chain end -+ if (zig_zaggify) -+ { -+ chain_end[chain_end_index] = (last_inside) ? last : current; -+ if (++chain_end_index == 2) -+ { -+ chains[0].push_back(chain_end[0]); -+ chains[1].push_back(chain_end[1]); -+ chain_end_index = 0; -+ connected_to[0].push_back(std::numeric_limits::max()); -+ connected_to[1].push_back(std::numeric_limits::max()); -+ line_numbers.push_back(num_columns); -+ } -+ } -+ } -+ } -+ } -+ last = current; -+ last_inside = current_inside; -+ is_first_point = false; -+ } -+ } -+ ++num_columns; -+ } -+ } -+ else -+ { -+ // "horizontal" lines -+ const double phase_offset = (sin_z < 0) ? M_PI : 0; -+ for (coord_t x = 0; x < pitch; x += step) -+ { -+ const double x_rads = 2 * M_PI * x / pitch; -+ const double a = sin_z; -+ const double b = std::cos(x_rads + phase_offset); -+ const double odd_c = cos_z * std::sin(x_rads + phase_offset + M_PI); -+ const double even_c = cos_z * std::sin(x_rads + phase_offset); -+ const double h = std::sqrt(a * a + b * b); -+ const double odd_y_rads = ((h != 0) ? std::asin(odd_c / h) + std::asin(b / h) : 0) + M_PI/2; -+ const double even_y_rads = ((h != 0) ? std::asin(even_c / h) + std::asin(b / h) : 0) + M_PI/2; -+ odd_line_coords.push_back(odd_y_rads / M_PI * pitch); -+ even_line_coords.push_back(even_y_rads / M_PI * pitch); -+ } -+ const unsigned num_coords = odd_line_coords.size(); -+ unsigned num_rows = 0; -+ for (coord_t y = (std::floor(aabb.min.Y / pitch) - 1) * pitch; y <= aabb.max.Y + pitch/2; y += pitch/2) -+ { -+ bool is_first_point = true; -+ Point last; -+ bool last_inside = false; -+ unsigned chain_end_index = 0; -+ Point chain_end[2]; -+ for (coord_t x = (std::floor(aabb.min.X / pitch) - 1) * pitch; x <= aabb.max.X + pitch; x += pitch) -+ { -+ for (unsigned i = 0; i < num_coords; ++i) -+ { -+ Point current(x + (coord_t)(i * step), y + ((num_rows & 1) ? odd_line_coords[i] : even_line_coords[i])/2); -+ bool current_inside = outline.inside(current, true); -+ if (!is_first_point) -+ { -+ if (last_inside && current_inside) -+ { -+ // line doesn't hit the boundary, add the whole line -+ result.addLine(last, current); -+ } -+ else if (last_inside != current_inside) -+ { -+ // line hits the boundary, add the part that's inside the boundary -+ Polygons line; -+ line.addLine(last, current); -+ line = outline.intersectionPolyLines(line); -+ if (line.size() > 0) -+ { -+ // some of the line is inside the boundary -+ result.addLine(line[0][0], line[0][1]); -+ if (zig_zaggify) -+ { -+ chain_end[chain_end_index] = line[0][(line[0][0] != last && line[0][0] != current) ? 0 : 1]; -+ if (++chain_end_index == 2) -+ { -+ chains[0].push_back(chain_end[0]); -+ chains[1].push_back(chain_end[1]); -+ chain_end_index = 0; -+ connected_to[0].push_back(std::numeric_limits::max()); -+ connected_to[1].push_back(std::numeric_limits::max()); -+ line_numbers.push_back(num_rows); -+ } -+ } -+ } -+ else -+ { -+ // none of the line is inside the boundary so the point that's actually on the boundary -+ // is the chain end -+ if (zig_zaggify) -+ { -+ chain_end[chain_end_index] = (last_inside) ? last : current; -+ if (++chain_end_index == 2) -+ { -+ chains[0].push_back(chain_end[0]); -+ chains[1].push_back(chain_end[1]); -+ chain_end_index = 0; -+ connected_to[0].push_back(std::numeric_limits::max()); -+ connected_to[1].push_back(std::numeric_limits::max()); -+ line_numbers.push_back(num_rows); -+ } -+ } -+ } -+ } -+ } -+ last = current; -+ last_inside = current_inside; -+ is_first_point = false; -+ } -+ } -+ ++num_rows; -+ } -+ } -+ -+ if (zig_zaggify && chains[0].size() > 0) -+ { -+ // zig-zaggification consists of joining alternate chain ends to make a chain of chains -+ // the basic algorithm is that we follow the infill area boundary and as we progress we are either drawing a connector or not -+ // whenever we come across the end of a chain we toggle the connector drawing state -+ // things are made more complicated by the fact that we want to avoid generating loops and so we need to keep track -+ // of the indentity of the first chain in a connected sequence -+ -+ int chain_ends_remaining = chains[0].size() * 2; -+ -+ for (ConstPolygonRef outline_poly : outline) -+ { -+ std::vector connector_points; // the points that make up a connector line -+ -+ // we need to remember the first chain processed and the path to it from the first outline point -+ // so that later we can possibly connect to it from the last chain processed -+ unsigned first_chain_chain_index = std::numeric_limits::max(); -+ std::vector path_to_first_chain; -+ -+ bool drawing = false; // true when a connector line is being (potentially) created -+ -+ // keep track of the chain+point that a connector line started at -+ unsigned connector_start_chain_index = std::numeric_limits::max(); -+ unsigned connector_start_point_index = std::numeric_limits::max(); -+ -+ // go round all of the region's outline and find the chain ends that meet it -+ // quit the loop early if we have seen all the chain ends and are not currently drawing a connector -+ for (unsigned outline_point_index = 0; (chain_ends_remaining > 0 || drawing) && outline_point_index < outline_poly.size(); ++outline_point_index) -+ { -+ Point op0 = outline_poly[outline_point_index]; -+ Point op1 = outline_poly[(outline_point_index + 1) % outline_poly.size()]; -+ Point cur_point = op0; -+ std::vector points_on_outline_chain_index; -+ std::vector points_on_outline_point_index; -+ // collect the chain ends that meet this segment of the outline -+ for (unsigned chain_index = 0; chain_index < chains[0].size(); ++chain_index) -+ { -+ for (unsigned point_index = 0; point_index < 2; ++point_index) -+ { -+ if (LinearAlg2D::getDist2FromLineSegment(op0, chains[point_index][chain_index], op1) < 10) -+ { -+ points_on_outline_point_index.push_back(point_index); -+ points_on_outline_chain_index.push_back(chain_index); -+ } -+ } -+ } -+ -+ if (first_chain_chain_index == std::numeric_limits::max()) -+ { -+ // include the outline point in the path to the first chain -+ path_to_first_chain.push_back(op0); -+ } -+ -+ if (drawing) -+ { -+ // include the start point of this outline segment in the connector -+ connector_points.push_back(op0); -+ } -+ -+ // iterate through each of the chain ends that meet the current outline segment -+ while (points_on_outline_chain_index.size() > 0) -+ { -+ // find the nearest chain end to the current point -+ unsigned nearest_point_index = 0; -+ float nearest_point_dist2 = std::numeric_limits::infinity(); -+ for (unsigned pi = 0; pi < points_on_outline_chain_index.size(); ++pi) -+ { -+ float dist2 = vSize2f(chains[points_on_outline_point_index[pi]][points_on_outline_chain_index[pi]] - cur_point); -+ if (dist2 < nearest_point_dist2) -+ { -+ nearest_point_dist2 = dist2; -+ nearest_point_index = pi; -+ } -+ } -+ const unsigned point_index = points_on_outline_point_index[nearest_point_index]; -+ const unsigned chain_index = points_on_outline_chain_index[nearest_point_index]; -+ // make the chain end the current point and add it to the connector line -+ cur_point = chains[point_index][chain_index]; -+ connector_points.push_back(cur_point); -+ -+ if (first_chain_chain_index == std::numeric_limits::max()) -+ { -+ // this is the first chain to be processed, remember it -+ first_chain_chain_index = chain_index; -+ path_to_first_chain.push_back(cur_point); -+ } -+ -+ if (drawing) -+ { -+ // add the connector line segments but only if -+ // 1 - the start/end points are not the opposite ends of the same chain -+ // 2 - the other end of the current chain is not connected to the chain the connector line is coming from -+ -+ if (chain_index != connector_start_chain_index && connected_to[(point_index + 1) % 2][chain_index] != connector_start_chain_index) -+ { -+ for (unsigned pi = 1; pi < connector_points.size(); ++pi) -+ { -+ result.addLine(connector_points[pi - 1], connector_points[pi]); -+ } -+ drawing = false; -+ connector_points.clear(); -+ // remember the connection -+ connected_to[point_index][chain_index] = connector_start_chain_index; -+ connected_to[connector_start_point_index][connector_start_chain_index] = chain_index; -+ } -+ else -+ { -+ // start a new connector from the current location -+ connector_points.clear(); -+ connector_points.push_back(cur_point); -+ -+ // remember the chain+point that the connector started from -+ connector_start_chain_index = chain_index; -+ connector_start_point_index = point_index; -+ } -+ } -+ else -+ { -+ // we have just jumped a gap so now we want to start drawing again -+ drawing = true; -+ -+ // if this connector is the first to be created or we are not connecting chains from the same row/column, -+ // remember the chain+point that this connector is starting from -+ if (connector_start_chain_index == std::numeric_limits::max() || line_numbers[chain_index] != line_numbers[connector_start_chain_index]) -+ { -+ connector_start_chain_index = chain_index; -+ connector_start_point_index = point_index; -+ } -+ } -+ -+ // done with this chain end -+ points_on_outline_chain_index.erase(points_on_outline_chain_index.begin() + nearest_point_index); -+ points_on_outline_point_index.erase(points_on_outline_point_index.begin() + nearest_point_index); -+ -+ // decrement total amount of work to do -+ --chain_ends_remaining; -+ } -+ } -+ -+ // we have now visited all the points in the outline, if a connector was (potentially) being drawn -+ // check whether the first chain is already connected to the last chain and, if not, draw the -+ // connector between -+ if (drawing && first_chain_chain_index != std::numeric_limits::max() -+ && first_chain_chain_index != connector_start_chain_index -+ && connected_to[0][first_chain_chain_index] != connector_start_chain_index -+ && connected_to[1][first_chain_chain_index] != connector_start_chain_index) -+ { -+ // output the connector line segments from the last chain to the first point in the outline -+ connector_points.push_back(outline_poly[0]); -+ for (unsigned pi = 1; pi < connector_points.size(); ++pi) -+ { -+ result.addLine(connector_points[pi - 1], connector_points[pi]); -+ } -+ // output the connector line segments from the first point in the outline to the first chain -+ for (unsigned pi = 1; pi < path_to_first_chain.size(); ++pi) -+ { -+ result.addLine(path_to_first_chain[pi - 1], path_to_first_chain[pi]); -+ } -+ } -+ -+ if (chain_ends_remaining < 1) -+ { -+ break; -+ } -+ } -+ } -+ -+ result_lines = result; -+ -+} -+ -+} // namespace cura -\ No newline at end of file -diff -up CuraEngine-lulzbot-3.2.32/src/infill/GyroidInfill.h.gyroid CuraEngine-lulzbot-3.2.32/src/infill/GyroidInfill.h ---- CuraEngine-lulzbot-3.2.32/src/infill/GyroidInfill.h.gyroid 2018-11-30 10:51:57.970453059 -0500 -+++ CuraEngine-lulzbot-3.2.32/src/infill/GyroidInfill.h 2018-11-30 10:51:50.564618014 -0500 -@@ -0,0 +1,25 @@ -+//Copyright (c) 2018 Ultimaker B.V. -+//CuraEngine is released under the terms of the AGPLv3 or higher. -+ -+#include "../utils/polygon.h" -+#include "../utils/AABB.h" -+#include "../utils/linearAlg2D.h" -+ -+namespace cura -+{ -+ -+class GyroidInfill -+{ -+public: -+ GyroidInfill(); -+ -+ ~GyroidInfill(); -+ -+ static void generateTotalGyroidInfill(Polygons& result_lines, bool zig_zaggify, coord_t outline_offset, coord_t infill_line_width, coord_t line_distance, const Polygons& in_outline, coord_t z); -+ -+private: -+ -+}; -+ -+} // namespace cura -+ -diff -up CuraEngine-lulzbot-3.2.32/src/infill.h.gyroid CuraEngine-lulzbot-3.2.32/src/infill.h ---- CuraEngine-lulzbot-3.2.32/src/infill.h.gyroid 2018-11-30 10:48:51.922613413 -0500 -+++ CuraEngine-lulzbot-3.2.32/src/infill.h 2018-11-30 10:49:33.303680513 -0500 -@@ -106,6 +106,12 @@ public: - private: - void generateTroctInfill(Polygons& result, double rotation); - /*! -+ * Generate gyroid infill -+ * \param result (output) The resulting polygons -+ */ -+ void generateGyroidInfill(Polygons& result); -+ -+ /*! - * Generate sparse concentric infill - * - * Also adds \ref Inifll::perimeter_gaps between \ref Infill::in_outline and the first wall -diff -up CuraEngine-lulzbot-3.2.32/src/pathOrderOptimizer.cpp.gyroid CuraEngine-lulzbot-3.2.32/src/pathOrderOptimizer.cpp ---- CuraEngine-lulzbot-3.2.32/src/pathOrderOptimizer.cpp.gyroid 2018-11-30 10:52:20.653947815 -0500 -+++ CuraEngine-lulzbot-3.2.32/src/pathOrderOptimizer.cpp 2018-11-30 10:55:36.743593214 -0500 -@@ -173,8 +173,8 @@ static inline bool pointsAreCoincident(c - */ - void LineOrderOptimizer::optimize() - { -- int gridSize = 5000; // the size of the cells in the hash grid. TODO -- SparsePointGridInclusive line_bucket_grid(gridSize); -+ const int grid_size = 2000; // the size of the cells in the hash grid. TODO -+ SparsePointGridInclusive line_bucket_grid(grid_size); - bool picked[polygons.size()]; - memset(picked, false, sizeof(bool) * polygons.size());/// initialized as falses - -@@ -211,12 +211,28 @@ void LineOrderOptimizer::optimize() - int best_line_idx = -1; - float best_score = std::numeric_limits::infinity(); // distance score for the best next line - -+ const int close_point_radius = 5000; -+ - // for the first line we would prefer a line that is at the end of a sequence of connected lines (think zigzag) and - // so we only consider the closest line when looking for the second line onwards - if (order_idx > 0) - { -- /// check if single-line-polygon is close to last point -- for(unsigned int close_line_idx : line_bucket_grid.getNearbyVals(prev_point, gridSize)) -+ // first check if a line segment starts (really) close to last point -+ // this will find the next line segment in a chain -+ for(unsigned int close_line_idx : line_bucket_grid.getNearbyVals(prev_point, 10)) -+ { -+ if (picked[close_line_idx] || polygons[close_line_idx]->size() < 1) -+ { -+ continue; -+ } -+ updateBestLine(close_line_idx, best_line_idx, best_score, prev_point, incoming_perpundicular_normal); -+ } -+ } -+ -+ if (best_line_idx == -1) -+ { -+ // we didn't find a chained line segment so now look for any lines that start within close_point_radius -+ for(unsigned int close_line_idx : line_bucket_grid.getNearbyVals(prev_point, close_point_radius)) - { - if (picked[close_line_idx] || polygons[close_line_idx]->size() < 1) - { -@@ -226,7 +242,7 @@ void LineOrderOptimizer::optimize() - } - } - -- if (best_line_idx != -1 && best_score > (2 * gridSize * gridSize)) -+ if (best_line_idx != -1 && best_score > (2 * close_point_radius * close_point_radius)) - { - // we found a point that is close to prev_point as the crow flies but the score is high so it must have been - // penalised due to the part boundary clashing with the straight line path so let's forget it and find something closer -@@ -261,7 +277,7 @@ void LineOrderOptimizer::optimize() - int num_joined_lines = 0; - const Point& p = (*polygons[poly_idx])[point_idx]; - // look at each of the lines that finish close to this line to see if either of its vertices are coincident this vertex -- for (unsigned int close_line_idx : line_bucket_grid.getNearbyVals(p, gridSize)) -+ for (unsigned int close_line_idx : line_bucket_grid.getNearbyVals(p, 10)) - { - if (close_line_idx != poly_idx && (pointsAreCoincident(p, (*polygons[close_line_idx])[0]) || pointsAreCoincident(p, (*polygons[close_line_idx])[1]))) - { -diff -up CuraEngine-lulzbot-3.2.32/src/settings/settings.cpp.gyroid CuraEngine-lulzbot-3.2.32/src/settings/settings.cpp ---- CuraEngine-lulzbot-3.2.32/src/settings/settings.cpp.gyroid 2018-11-30 10:56:52.679898393 -0500 -+++ CuraEngine-lulzbot-3.2.32/src/settings/settings.cpp 2018-11-30 10:57:31.062042905 -0500 -@@ -398,6 +398,8 @@ EFillMethod SettingsBaseVirtual::getSett - return EFillMethod::CROSS; - if (value == "cross_3d") - return EFillMethod::CROSS_3D; -+ if (value == "gyroid") -+ return EFillMethod::GYROID; - return EFillMethod::NONE; - } - -diff -up CuraEngine-lulzbot-3.2.32/src/settings/settings.h.gyroid CuraEngine-lulzbot-3.2.32/src/settings/settings.h ---- CuraEngine-lulzbot-3.2.32/src/settings/settings.h.gyroid 2018-11-30 10:56:09.313866096 -0500 -+++ CuraEngine-lulzbot-3.2.32/src/settings/settings.h 2018-11-30 10:56:23.752543766 -0500 -@@ -121,6 +121,7 @@ enum class EFillMethod - TRUNCATED_OCTAHEDRON, - CROSS, - CROSS_3D, -+ GYROID, - NONE - }; - diff --git a/CuraEngine-lulzbot-3.6.3-optflags.patch b/CuraEngine-lulzbot-3.6.3-optflags.patch new file mode 100644 index 0000000..da8ce33 --- /dev/null +++ b/CuraEngine-lulzbot-3.6.3-optflags.patch @@ -0,0 +1,21 @@ +diff -up CuraEngine-lulzbot-3.6.3/CMakeLists.txt.optflags CuraEngine-lulzbot-3.6.3/CMakeLists.txt +--- CuraEngine-lulzbot-3.6.3/CMakeLists.txt.optflags 2019-02-20 13:38:08.447302974 -0500 ++++ CuraEngine-lulzbot-3.6.3/CMakeLists.txt 2019-02-20 13:39:59.738019228 -0500 +@@ -30,10 +30,14 @@ if(CMAKE_BUILD_TYPE) + string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER) + endif() + +-if(CMAKE_BUILD_TYPE_UPPER MATCHES "DEBUG") +- set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_DEBUG_INIT}) ++if(USE_DISTRO_OPTIMIZATION_FLAGS) ++ set(CMAKE_CXX_FLAGS ${CXXFLAGS}) + else() +- set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_RELEASE_INIT}) ++ if(CMAKE_BUILD_TYPE_UPPER MATCHES "DEBUG") ++ set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_DEBUG_INIT}) ++ else() ++ set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_RELEASE_INIT}) ++ endif() + endif() + + if(NOT ${CMAKE_VERSION} VERSION_LESS 3.1) diff --git a/CuraEngine-lulzbot-gcc9.patch b/CuraEngine-lulzbot-gcc9.patch index bf4966d..d880f34 100644 --- a/CuraEngine-lulzbot-gcc9.patch +++ b/CuraEngine-lulzbot-gcc9.patch @@ -1,30 +1,19 @@ -diff --git a/src/layerPart.cpp b/src/layerPart.cpp -index 0c0e16df..c3ee5940 100644 ---- a/src/layerPart.cpp -+++ b/src/layerPart.cpp -@@ -46,7 +46,7 @@ void createLayerParts(SliceMeshStorage& mesh, Slicer* slicer, bool union_layers, +diff -up CuraEngine-lulzbot-3.6.3/src/layerPart.cpp.gcc9 CuraEngine-lulzbot-3.6.3/src/layerPart.cpp +--- CuraEngine-lulzbot-3.6.3/src/layerPart.cpp.gcc9 2019-02-20 13:08:31.721576628 -0500 ++++ CuraEngine-lulzbot-3.6.3/src/layerPart.cpp 2019-02-20 13:08:49.041219881 -0500 +@@ -49,7 +49,7 @@ void createLayerParts(SliceMeshStorage& { const auto total_layers = slicer->layers.size(); assert(mesh.layers.size() == total_layers); --#pragma omp parallel for default(none) shared(mesh,slicer) firstprivate(union_layers,union_all_remove_holes) schedule(dynamic) -+#pragma omp parallel for default(none) shared(mesh,slicer,total_layers) firstprivate(union_layers,union_all_remove_holes) schedule(dynamic) +-#pragma omp parallel for default(none) shared(mesh, slicer) schedule(dynamic) ++#pragma omp parallel for default(none) shared(mesh, slicer, total_layers) schedule(dynamic) for (unsigned int layer_nr = 0; layer_nr < total_layers; layer_nr++) { SliceLayer& layer_storage = mesh.layers[layer_nr]; -diff --git a/src/support.cpp b/src/support.cpp -index 8e5d43c5..f0fe8d23 100644 ---- a/src/support.cpp -+++ b/src/support.cpp -@@ -720,7 +720,7 @@ void AreaSupport::generateOverhangAreasForMesh(SliceDataStorage& storage, SliceM - const double support_angle = mesh.getSettingInAngleRadians("support_angle"); - const double tan_angle = tan(support_angle) - 0.01; //The X/Y component of the support angle. 0.01 to make 90 degrees work too. - const coord_t max_dist_from_lower_layer = tan_angle * layer_height; //Maximum horizontal distance that can be bridged. -- #pragma omp parallel for default(none) shared(storage, mesh) schedule(dynamic) -+ #pragma omp parallel for default(none) shared(storage, mesh, max_dist_from_lower_layer) schedule(dynamic) - for (unsigned int layer_idx = 1; layer_idx < storage.print_layer_count; layer_idx++) - { - std::pair basic_and_full_overhang = computeBasicAndFullOverhang(storage, mesh, layer_idx, max_dist_from_lower_layer); -@@ -775,7 +775,7 @@ void AreaSupport::generateSupportAreasForMesh(SliceDataStorage& storage, const S +diff -up CuraEngine-lulzbot-3.6.3/src/support.cpp.gcc9 CuraEngine-lulzbot-3.6.3/src/support.cpp +--- CuraEngine-lulzbot-3.6.3/src/support.cpp.gcc9 2019-02-20 13:06:09.754553897 -0500 ++++ CuraEngine-lulzbot-3.6.3/src/support.cpp 2019-02-20 13:08:13.081961416 -0500 +@@ -854,7 +854,7 @@ void AreaSupport::generateSupportAreasFo const double tan_angle = tan(angle) - 0.01; // the XY-component of the supportAngle xy_disallowed_per_layer[0] = storage.getLayerOutlines(0, false).offset(xy_distance); // for all other layers (of non support meshes) compute the overhang area and possibly use that when calculating the support disallowed area @@ -33,12 +22,12 @@ index 8e5d43c5..f0fe8d23 100644 for (unsigned int layer_idx = 1; layer_idx < layer_count; layer_idx++) { Polygons outlines = storage.getLayerOutlines(layer_idx, false); -@@ -978,7 +978,7 @@ void AreaSupport::generateSupportAreasForMesh(SliceDataStorage& storage, const S +@@ -1054,7 +1054,7 @@ void AreaSupport::generateSupportAreasFo const int max_checking_layer_idx = std::min(static_cast(storage.support.supportLayers.size()) , static_cast(layer_count - (layer_z_distance_top - 1))); const size_t max_checking_idx_size_t = std::max(0, max_checking_layer_idx); -#pragma omp parallel for default(none) shared(support_areas, storage) schedule(dynamic) -+#pragma omp parallel for default(none) shared(support_areas, storage, layer_z_distance_top, max_checking_idx_size_t) schedule(dynamic) ++#pragma omp parallel for default(none) shared(support_areas, storage, max_checking_idx_size_t, layer_z_distance_top) schedule(dynamic) for (size_t layer_idx = 0; layer_idx < max_checking_idx_size_t; layer_idx++) { support_areas[layer_idx] = support_areas[layer_idx].difference(storage.getLayerOutlines(layer_idx + layer_z_distance_top - 1, false)); diff --git a/CuraEngine-lulzbot.spec b/CuraEngine-lulzbot.spec index 154b081..618cfa8 100644 --- a/CuraEngine-lulzbot.spec +++ b/CuraEngine-lulzbot.spec @@ -1,6 +1,6 @@ Name: CuraEngine-lulzbot -Version: 3.2.32 -Release: 4%{?dist} +Version: 3.6.3 +Release: 1%{?dist} Epoch: 1 Summary: Engine for processing 3D models into G-code instructions for 3D printers License: AGPLv3+ @@ -24,8 +24,7 @@ BuildRequires: git Patch0: CuraEngine-lulzbot-3.2.17-no-rpath.patch Patch1: CuraEngine-lulzbot-3.2.17-no-static-libstdc++.patch -Patch2: CuraEngine-lulzbot-2.6.21-system-libs.patch -Patch3: CuraEngine-lulzbot-3.2.32-gyroid-infill.patch +Patch2: CuraEngine-lulzbot-3.6.3-optflags.patch # https://github.com/Ultimaker/CuraEngine/issues/984 Patch4: CuraEngine-lulzbot-gcc9.patch @@ -53,10 +52,10 @@ rm -rf libs sed -i 's|#include |#include |' src/utils/*.h src/*.cpp # The -DCURA_ENGINE_VERSION does not work, so we sed-change the default value -sed -i 's/"DEV"/"%{version}"/' src/settings/settings.h +sed -i 's/"DEV"/"%{version}"/' src/settings/Settings.h %build -%{cmake} -DBUILD_SHARED_LIBS:BOOL=OFF -DCURA_ENGINE_VERSION:STRING=%{version} . # The lib is only intermediate +%{cmake} -DUSE_DISTRO_OPTIMIZATION_FLAGS:BOOL=ON -DUSE_SYSTEM_LIBS:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCURA_ENGINE_VERSION:STRING=%{version} . # The lib is only intermediate make %{?_smp_mflags} @@ -77,6 +76,9 @@ cp -a version.json %{buildroot}%{_datadir}/%{name}/ %{_datadir}/%{name} %changelog +* Wed Feb 20 2019 Tom Callaway - 1:3.6.3-1 +- update to 3.6.3 + * Thu Jan 31 2019 Fedora Release Engineering - 1:3.2.32-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild