mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-11 16:59:01 +08:00
added grow() method for Polyline; moved CLIPPER_OFFSET_SCALE to libslic3r to avoid include loops
This commit is contained in:
parent
4eb9bdceb3
commit
dde4779cbb
@ -19,7 +19,6 @@ namespace Slic3r {
|
||||
// How about 2^17=131072?
|
||||
// By the way, is the scalling needed at all? Cura runs all the computation with a fixed point precision of 1um, while Slic3r scales to 1nm,
|
||||
// further scaling by 10e5 brings us to
|
||||
constexpr float CLIPPER_OFFSET_SCALE = 100000.0;
|
||||
constexpr auto MAX_COORD = ClipperLib::hiRange / CLIPPER_OFFSET_SCALE;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "ExPolygonCollection.hpp"
|
||||
#include "Line.hpp"
|
||||
#include "Polygon.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
@ -220,6 +221,12 @@ Polyline::wkt() const
|
||||
return wkt.str();
|
||||
}
|
||||
|
||||
Polygons
|
||||
Polyline::grow(double delta, double scale, ClipperLib::JoinType joinType, double miterLimit) const
|
||||
{
|
||||
return offset(*this, delta, scale, joinType, miterLimit);
|
||||
}
|
||||
|
||||
ThickLines
|
||||
ThickPolyline::thicklines() const
|
||||
{
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "Polygon.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "clipper.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@ -32,6 +33,7 @@ class Polyline : public MultiPoint {
|
||||
void split_at(const Point &point, Polyline* p1, Polyline* p2) const;
|
||||
bool is_straight() const;
|
||||
std::string wkt() const;
|
||||
Polygons grow(double delta, double scale = CLIPPER_OFFSET_SCALE, ClipperLib::JoinType joinType = ClipperLib::jtSquare, double miterLimit = 3.0) const;
|
||||
};
|
||||
|
||||
class ThickPolyline : public Polyline {
|
||||
|
@ -81,6 +81,8 @@ constexpr coordf_t INSET_OVERLAP_TOLERANCE = 0.4;
|
||||
constexpr coordf_t EXTERNAL_INFILL_MARGIN = 3;
|
||||
constexpr coord_t SCALED_EXTERNAL_INFILL_MARGIN = scale_(EXTERNAL_INFILL_MARGIN);
|
||||
|
||||
constexpr float CLIPPER_OFFSET_SCALE = 100000.0;
|
||||
|
||||
enum Axis { X=0, Y, Z };
|
||||
|
||||
template <class T>
|
||||
|
Loading…
x
Reference in New Issue
Block a user