Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ set(engine_SRCS # Except main.cpp.
src/multiVolumes.cpp
src/path_ordering.cpp
src/PathAdapter.cpp
src/PathOrderMonotonic.cpp
src/Preheat.cpp
src/PrimeTower/PrimeTower.cpp
src/PrimeTower/PrimeTowerNormal.cpp
Expand Down Expand Up @@ -177,6 +178,7 @@ set(engine_SRCS # Except main.cpp.
src/geometry/Point3LL.cpp
src/geometry/Polygon.cpp
src/geometry/Shape.cpp
src/geometry/PointMatrix.cpp
src/geometry/PointsSet.cpp
src/geometry/SingleShape.cpp
src/geometry/PartsView.cpp
Expand Down
3 changes: 2 additions & 1 deletion include/FffGcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "FanSpeedLayerTime.h"
#include "GCodePathConfig.h"
#include "LayerPlanBuffer.h"
#include "LinesOrderingMethod.h"
#include "gcodeExport.h"
#include "utils/LayerVector.h"
#include "utils/NoCopy.h"
Expand Down Expand Up @@ -603,7 +604,7 @@ class FffGcodeWriter : public NoCopy
const AngleDegrees skin_angle,
const coord_t skin_overlap,
const Ratio skin_density,
const bool monotonic,
const LinesOrderingMethod ordering,
const bool is_roofing_flooring,
bool& added_something,
double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT) const;
Expand Down
3 changes: 2 additions & 1 deletion include/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,8 @@ class LayerPlan : public NoCopy
const coord_t exclude_distance = 0,
const coord_t wipe_dist = 0,
const Ratio flow_ratio = 1.0_r,
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT);
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
const bool interlaced = false);

/*!
* Add a spiralized slice of wall that is interpolated in X/Y between \p last_wall and \p wall.
Expand Down
20 changes: 20 additions & 0 deletions include/LinesOrderingMethod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2025 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher

#ifndef LINES_ORDERING_METHOD_H
#define LINES_ORDERING_METHOD_H


namespace cura
{

enum class LinesOrderingMethod
{
Basic, // Lines are ordered by shortest distance
Monotonic, // Lines are ordered so that they will always form a continuous print along a direction
Interlaced, // Similar to monotonic, but with 2 passes so that adjacent lines will not be printed just after each other
};

} // namespace cura

#endif
390 changes: 27 additions & 363 deletions include/PathOrderMonotonic.h

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions include/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
#ifndef BRIDGE_H
#define BRIDGE_H

#include <optional>

namespace cura
{

class Shape;
class Settings;
class SliceMeshStorage;
class SliceDataStorage;
class SupportLayer;
class AngleDegrees;

/*!
* \brief Computes the angle that lines have to take to bridge a certain shape
* best.
*
* If the area should not be bridged, an angle of -1 is returned.
* \param settings The settings container to get settings from.
* \param mesh The mesh being processed.
* \param skin_outline The shape to fill with lines.
* \param storage The slice data storage where to find objects that the bridge
* could rest on in previous layers.
Expand All @@ -27,8 +30,8 @@ class SupportLayer;
* \param supported_regions Pre-computed regions that the support layer would
* support.
*/
double bridgeAngle(
const Settings& settings,
std::optional<AngleDegrees> bridgeAngle(
const SliceMeshStorage& mesh,
const Shape& skin_outline,
const SliceDataStorage& storage,
const unsigned layer_nr,
Expand Down
15 changes: 15 additions & 0 deletions include/geometry/Point2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ class Point2D
return Point2D(x_ * scale, y_ * scale);
}

Point2D operator-(const Point2D& other) const
{
return Point2D(x_ - other.x_, y_ - other.y_);
}

Point2D operator+(const Point2D& other) const
{
return Point2D(x_ + other.x_, y_ + other.y_);
}

Point2D operator-() const
{
return Point2D(-x_, -y_);
}

static double dot(const Point2D& p0, const Point2D& p1)
{
return p0.x_ * p1.x_ + p0.y_ * p1.y_;
Expand Down
69 changes: 17 additions & 52 deletions include/geometry/PointMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,41 @@
#define GEOMETRY_POINT_MATRIX_H

#include <array>
#include <numbers>

#include "geometry/Point2LL.h"


namespace cura
{

class AngleDegrees;
class AngleRadians;

class PointMatrix
{
public:
std::array<double, 4> matrix{ 1, 0, 0, 1 };

PointMatrix() noexcept = default;

explicit PointMatrix(double rotation)
{
rotation = rotation / 180 * std::numbers::pi;
matrix.at(0) = std::cos(rotation);
matrix.at(1) = -std::sin(rotation);
matrix.at(2) = -matrix.at(1);
matrix.at(3) = matrix.at(0);
}

explicit PointMatrix(const Point2LL& p)
{
matrix.at(0) = static_cast<double>(p.X);
matrix.at(1) = static_cast<double>(p.Y);
double f = std::sqrt((matrix.at(0) * matrix.at(0)) + (matrix.at(1) * matrix.at(1)));
matrix.at(0) /= f;
matrix.at(1) /= f;
matrix.at(2) = -matrix.at(1);
matrix.at(3) = matrix.at(0);
}

static PointMatrix scale(double s)
{
PointMatrix ret;
ret.matrix.at(0) = s;
ret.matrix.at(3) = s;
return ret;
}

[[nodiscard]] Point2LL apply(const Point2LL& p) const
{
const auto x = static_cast<double>(p.X);
const auto y = static_cast<double>(p.Y);
return { std::llrint(x * matrix.at(0) + y * matrix.at(1)), std::llrint(x * matrix.at(2) + y * matrix.at(3)) };
}
explicit PointMatrix(double rotation);

explicit PointMatrix(const AngleDegrees& rotation);

explicit PointMatrix(const AngleRadians& rotation);

explicit PointMatrix(const Point2LL& p);

static PointMatrix scale(double s);

[[nodiscard]] Point2LL apply(const Point2LL& p) const;

/*!
* \warning only works on a rotation matrix! Output is incorrect for other types of matrix
*/
[[nodiscard]] Point2LL unapply(const Point2LL& p) const
{
const auto x = static_cast<double>(p.X);
const auto y = static_cast<double>(p.Y);
return { std::llrint(x * matrix.at(0) + y * matrix.at(2)), std::llrint(x * matrix.at(1) + y * matrix.at(3)) };
}

[[nodiscard]] PointMatrix inverse() const
{
PointMatrix ret;
double det = matrix.at(0) * matrix.at(3) - matrix.at(1) * matrix.at(2);
ret.matrix.at(0) = matrix.at(3) / det;
ret.matrix.at(1) = -matrix.at(1) / det;
ret.matrix.at(2) = -matrix.at(2) / det;
ret.matrix.at(3) = matrix.at(0) / det;
return ret;
}
[[nodiscard]] Point2LL unapply(const Point2LL& p) const;

[[nodiscard]] PointMatrix inverse() const;
};

} // namespace cura
Expand Down
5 changes: 5 additions & 0 deletions include/infill.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ class Infill
const SliceMeshStorage* mesh = nullptr,
const Shape& prevent_small_exposed_to_air = Shape());

coord_t getLineDistance() const
{
return line_distance_;
}

/*!
* Generate the wall toolpaths of an infill area. It will return the inner contour and set the inner-contour.
* This function is called within the generate() function but can also be called stand-alone
Expand Down
11 changes: 4 additions & 7 deletions include/utils/HalfEdgeGraph.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
//Copyright (c) 2020 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
// Copyright (c) 2020 Ultimaker B.V.
// CuraEngine is released under the terms of the AGPLv3 or higher.

#ifndef UTILS_HALF_EDGE_GRAPH_H
#define UTILS_HALF_EDGE_GRAPH_H


#include <list>
#include <cassert>


#include <list>

#include "HalfEdge.h"
#include "HalfEdgeNode.h"
#include "SVG.h"

namespace cura
{
using namespace cura;
using namespace cura;

template<class node_data_t, class edge_data_t, class derived_node_t, class derived_edge_t> // types of data contained in nodes and edges
class HalfEdgeGraph
Expand Down
Loading
Loading