11#include <glibmm/i18n.h>
24namespace LivePathEffect {
27using namespace LPEEmbroderyStitchOrdering;
58 ordering(_(
"Ordering method"), _(
"Method used to order sub paths"),
"ordering",
OrderMethodConverter, &wr, this, order_method_no_reorder),
59 connection(_(
"Connection method"), _(
"Method to connect end points of sub paths"),
"connection",
ConnectMethodConverter, &wr, this, connect_method_line),
60 stitch_length(_(
"Stitch length"), _(
"Divide path into straight segments of given length (in user units)"),
"stitch-length", &wr, this, 10.0),
61 stitch_min_length(_(
"Minimum stitch length [%]"), _(
"Merge stitches that are shorter than this percentage of the stitch length"),
"stitch-min-length", &wr, this, 25.0),
62 stitch_pattern(_(
"Stitch pattern"), _(
"Select between different stitch patterns"),
"stitch_pattern", &wr, this, 0),
63 show_stitches(_(
"Show stitches"), _(
"Creates gaps between stitches (use only for preview, deactivate for use with embroidery machines)"),
"show-stitches", &wr, this, false),
64 show_stitch_gap(_(
"Show stitch gap"), _(
"Length of the gap between stitches when showing stitches"),
"show-stitch-gap", &wr, this, 0.5),
65 jump_if_longer(_(
"Jump if longer"), _(
"Jump connection if longer than"),
"jump-if-longer", &wr, this, 100)
128 Point start_this = info[i].GetBegRev();
134 if (!info[i - 1].connect) {
138 Point end_prev = info[i - 1].GetEndRev();
146 return 0.5 * start_this + 0.5 * end_prev;
155 Point end_this = info[i].GetEndRev();
157 if (i + 1 == info.size()) {
161 if (!info[i].connect) {
165 Point start_next = info[i + 1].GetBegRev();
173 return 0.5 * start_next + 0.5 * end_this;
201 if (path_in.
size() >= 2) {
205 std::vector<OrderingInfo> orderinginfos(path_in.
size());
207 bool connect_with_previous =
false;
215 info.
begOrig = it->initialPoint();
216 info.
endOrig = it->back().finalPoint();
262 for (std::vector<OrderingInfo>::const_iterator it = orderinginfos.begin(); it != orderinginfos.end(); ++it) {
264 unsigned iInfo = it - orderinginfos.begin();
266 unsigned iPath = it->index;
284 if (step < stitch_min_length_abs) {
291 for (
double pos = pwdomain.
min(); !last; pos = posnext, cutpos += 1.0) {
303 posnext = pos + step;
305 if (posnext >= pwdomain.
max() - stitch_min_length_abs) {
309 p2 = pwEqdist.
valueAt(posnext);
324 if (it->connect && iInfo != orderinginfos.size() - 1) {
337 for (
auto & seg : pwStitch.
segs) {
364 for (
const auto & ipv : pathv) {
365 if (connect_with_previous) {
373 connect_with_previous = it->connect;
Path - a sequence of contiguous curves.
Conversion between Bezier control points and SBasis curves.
Adaptor that creates 2D functions from 1D ones.
Range of real numbers that is never empty.
Function that interpolates linearly between two values.
size_type size() const
Get the number of paths in the vector.
void push_back(Path const &path)
Append a path at the end.
Sequence::const_iterator const_iterator
Sequence of contiguous curves, aka spline.
void append(Curve *curve)
Add a new curve to the end of the path.
Function defined as discrete pieces.
output_type valueAt(double t) const
void push_seg(const T &s)
output_type lastValue() const
Two-dimensional point that doubles as a vector.
Polynomial in symmetric power basis.
void registerParameter(Parameter *param)
ScalarParam stitch_min_length
ScalarParam stitch_pattern
EnumParam< connect_method > connection
Geom::Point GetStartPointInterpolAfterRev(std::vector< OrderingInfo > const &info, unsigned i)
@ connect_method_move_point_to
@ connect_method_move_point_from
@ connect_method_move_point_mid
@ order_method_zigzag_rev_first
@ order_method_tsp_kopt_4
@ order_method_tsp_kopt_5
@ order_method_closest_rev_first
@ order_method_no_reorder
@ order_method_tsp_kopt_2
@ order_method_tsp_kopt_3
Geom::Point GetEndPointInterpolAfterRev(std::vector< OrderingInfo > const &info, unsigned i)
ScalarParam show_stitch_gap
double GetPatternInitialStep(int pattern, int line)
LPEEmbroderyStitch(LivePathEffectObject *lpeobject)
Geom::Point GetStartPointInterpolBeforeRev(std::vector< OrderingInfo > const &info, unsigned i)
Geom::PathVector doEffect_path(Geom::PathVector const &path_in) override
Geom::Point GetEndPointInterpolBeforeRev(std::vector< OrderingInfo > const &info, unsigned i)
EnumParam< order_method > ordering
~LPEEmbroderyStitch() override
ScalarParam stitch_length
ScalarParam jump_if_longer
void param_set_digits(unsigned digits)
void param_set_range(double min, double max)
void param_make_integer(bool yes=true)
Simplified management of enumerations of svg items with UI labels.
double Coord
Floating point type used to store coordinates.
Various utility functions.
Path path_from_sbasis(D2< SBasis > const &B, double tol, bool only_cubicbeziers=false)
Make a path from a d2 sbasis.
Bezier reverse(const Bezier &a)
Angle distance(Angle const &a, Angle const &b)
PathVector path_from_piecewise(Piecewise< D2< SBasis > > const &B, double tol, bool only_cubicbeziers=false)
Make a path from a d2 sbasis.
Piecewise< D2< SBasis > > arc_length_parametrization(D2< SBasis > const &M, unsigned order=3, double tol=.01)
void OrderingOriginal(std::vector< OrderingInfo > &infos)
void OrderingClosest(std::vector< OrderingInfo > &infos, bool revfirst)
void OrderingZigZag(std::vector< OrderingInfo > &infos, bool revfirst)
void OrderingAdvanced(std::vector< OrderingInfo > &infos, int nDims)
static const Util::EnumData< LPEEmbroderyStitch::order_method > OrderMethodData[LPEEmbroderyStitch::order_method_count]
static const Util::EnumData< LPEEmbroderyStitch::connect_method > ConnectMethodData[LPEEmbroderyStitch::connect_method_count]
static const Util::EnumDataConverter< LPEEmbroderyStitch::connect_method > ConnectMethodConverter(ConnectMethodData, sizeof(ConnectMethodData)/sizeof(*ConnectMethodData))
static const Util::EnumDataConverter< LPEEmbroderyStitch::order_method > OrderMethodConverter(OrderMethodData, sizeof(OrderMethodData)/sizeof(*OrderMethodData))
Helper class to stream background task notifications as a series of messages.
Piecewise function class.
two-dimensional geometric operators.
Conversion between SBasis and Bezier basis polynomials.
Polynomial in symmetric power basis (S-basis)
Simplified management of enumerations of svg items with UI labels.