Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
lpe-rough-hatches.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
7/*
8 * Authors:
9 * JF Barraud.
10 *
11 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
12 *
13 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
14 */
15
16#include "lpe-rough-hatches.h"
17
18#include <glibmm/i18n.h>
19#include <2geom/sbasis-math.h>
21
22#include "object/sp-item.h"
23
24namespace Inkscape {
25namespace LivePathEffect {
26
27using namespace Geom;
28
29//------------------------------------------------
30// Some goodies to navigate through curve's levels.
31//------------------------------------------------
32struct LevelCrossing{
33 Point pt;
34 double t;
35 bool sign;
36 bool used;
37 std::pair<unsigned,unsigned> next_on_curve;
38 std::pair<unsigned,unsigned> prev_on_curve;
39};
40struct LevelCrossingOrder {
41 bool operator()(LevelCrossing a, LevelCrossing b) {
42 return ( a.pt[Y] < b.pt[Y] );// a.pt[X] == b.pt[X] since we are supposed to be on the same level...
43 //return ( a.pt[X] < b.pt[X] || ( a.pt[X] == b.pt[X] && a.pt[Y] < b.pt[Y] ) );
44 }
45};
46struct LevelCrossingInfo{
47 double t;
48 unsigned level;
49 unsigned idx;
50};
51struct LevelCrossingInfoOrder {
52 bool operator()(LevelCrossingInfo a, LevelCrossingInfo b) {
53 return a.t < b.t;
54 }
55};
56
57typedef std::vector<LevelCrossing> LevelCrossings;
58
59static std::vector<double>
61 std::vector<double> result;
62 if (f.size()==0) return result;
63 result.push_back(f.cuts[0]);
64 Point prev_pt = f.segs[0].at1();
65 //double old_t = f.cuts[0];
66 for(unsigned i=1; i<f.size(); i++){
67 if ( f.segs[i].at0()!=prev_pt){
68 result.push_back(f.cuts[i]);
69 //old_t = f.cuts[i];
70 //assert(f.segs[i-1].at1()==f.valueAt(old_t));
71 }
72 prev_pt = f.segs[i].at1();
73 }
74 result.push_back(f.cuts.back());
75 //assert(f.segs.back().at1()==f.valueAt(old_t));
76 return result;
77}
78
79class LevelsCrossings: public std::vector<LevelCrossings>{
80public:
81 LevelsCrossings():std::vector<LevelCrossings>(){};
82 LevelsCrossings(std::vector<std::vector<double> > const &times,
83 Piecewise<D2<SBasis> > const &f,
84 Piecewise<SBasis> const &dx){
85
86 for (const auto & time : times){
88 for (double j : time){
89 LevelCrossing lc;
90 lc.pt = f.valueAt(j);
91 lc.t = j;
92 lc.sign = ( dx.valueAt(j)>0 );
93 lc.used = false;
94 lcs.push_back(lc);
95 }
96 std::sort(lcs.begin(), lcs.end(), LevelCrossingOrder());
97 push_back(lcs);
98 }
99 //Now create time ordering.
100 std::vector<LevelCrossingInfo>temp;
101 for (unsigned i=0; i<size(); i++){
102 for (unsigned j=0; j<(*this)[i].size(); j++){
103 LevelCrossingInfo elem;
104 elem.t = (*this)[i][j].t;
105 elem.level = i;
106 elem.idx = j;
107 temp.push_back(elem);
108 }
109 }
110 std::sort(temp.begin(),temp.end(),LevelCrossingInfoOrder());
111 std::vector<double> jumps = discontinuities(f);
112 unsigned jump_idx = 0;
113 unsigned first_in_comp = 0;
114 for (unsigned i=0; i<temp.size(); i++){
115 unsigned lvl = temp[i].level, idx = temp[i].idx;
116 if ( i == temp.size()-1 || temp[i+1].t > jumps[jump_idx+1]){
117 std::pair<unsigned,unsigned>next_data(temp[first_in_comp].level,temp[first_in_comp].idx);
118 (*this)[lvl][idx].next_on_curve = next_data;
119 first_in_comp = i+1;
120 jump_idx += 1;
121 }else{
122 std::pair<unsigned,unsigned> next_data(temp[i+1].level,temp[i+1].idx);
123 (*this)[lvl][idx].next_on_curve = next_data;
124 }
125 }
126
127 for (unsigned i=0; i<size(); i++){
128 for (unsigned j=0; j<(*this)[i].size(); j++){
129 std::pair<unsigned,unsigned> next = (*this)[i][j].next_on_curve;
130 (*this)[next.first][next.second].prev_on_curve = std::pair<unsigned,unsigned>(i,j);
131 }
132 }
133 }
134
135 void findFirstUnused(unsigned &level, unsigned &idx){
136 level = size();
137 idx = 0;
138 for (unsigned i=0; i<size(); i++){
139 for (unsigned j=0; j<(*this)[i].size(); j++){
140 if (!(*this)[i][j].used){
141 level = i;
142 idx = j;
143 return;
144 }
145 }
146 }
147 }
148 //set indexes to point to the next point in the "snake walk"
149 //follow_level's meaning:
150 // 0=yes upward
151 // 1=no, last move was upward,
152 // 2=yes downward
153 // 3=no, last move was downward.
154 void step(unsigned &level, unsigned &idx, int &direction){
155 if ( direction % 2 == 0 ){
156 if (direction == 0) {
157 if ( idx >= (*this)[level].size()-1 || (*this)[level][idx+1].used ) {
158 level = size();
159 return;
160 }
161 idx += 1;
162 }else{
163 if ( idx <= 0 || (*this)[level][idx-1].used ) {
164 level = size();
165 return;
166 }
167 idx -= 1;
168 }
169 direction += 1;
170 return;
171 }
172 //double t = (*this)[level][idx].t;
173 double sign = ((*this)[level][idx].sign ? 1 : -1);
174 //---double next_t = t;
175 //level += 1;
176 direction = (direction + 1)%4;
177 if (level == size()){
178 return;
179 }
180
181 std::pair<unsigned,unsigned> next;
182 if ( sign > 0 ){
183 next = (*this)[level][idx].next_on_curve;
184 }else{
185 next = (*this)[level][idx].prev_on_curve;
186 }
187
188 if ( level+1 != next.first || (*this)[next.first][next.second].used ) {
189 level = size();
190 return;
191 }
192 level = next.first;
193 idx = next.second;
194 return;
195 }
196};
197
198//-------------------------------------------------------
199// Bend a path...
200//-------------------------------------------------------
201
204 ff[X] += compose(bending, ff[Y]);
205 return sectionize(ff);
206}
207
208//--------------------------------------------------------
209// The RoughHatches lpe.
210//--------------------------------------------------------
212 Effect(lpeobject),
213 hatch_dist(0),
214 dist_rdm(_("Randomness"), _("Global variation of distance between hatches, in %."), "dist_rdm", &wr, this, 75),
215 growth(_("Growth"), _("Growth of distance between hatches."), "growth", &wr, this, 0.),
216//FIXME: top/bottom names are inverted in the UI/svg and in the code!!
217//FIXME2: This needs to be fixed in code not a in tooltips
218 scale_tf(_("Smooth: Bottom ←"), _("Set smoothness/sharpness of path when reaching a 'bottom' half-turn. 0=sharp, 1=default"), "scale_bf", &wr, this, 1.),
219 scale_tb(_("Smooth: Bottom →"), _("Set smoothness/sharpness of path when leaving a 'bottom' half-turn. 0=sharp, 1=default"), "scale_bb", &wr, this, 1.),
220 scale_bf(_("Smooth: Top ←"), _("Set smoothness/sharpness of path when reaching a 'top' half-turn. 0=sharp, 1=default"), "scale_tf", &wr, this, 1.),
221 scale_bb(_("Smooth: Top →"), _("Set smoothness/sharpness of path when leaving a 'top' half-turn. 0=sharp, 1=default"), "scale_tb", &wr, this, 1.),
222 top_edge_variation(_("↑↓ Random: Bottom"), _("Randomly moves 'bottom' half-turns up and down to produce magnitude variations."), "bottom_edge_variation", &wr, this, 0),
223 bot_edge_variation(_("↑↓ Random: Top"), _("Randomly moves 'top' half-turns up and down to produce magnitude variations."), "top_edge_variation", &wr, this, 0),
224 top_tgt_variation(_("←→ Random: Bottom"), _("Add direction randomness by moving 'bottom' half-turns tangentially to the boundary."), "bottom_tgt_variation", &wr, this, 0),
225 bot_tgt_variation(_("←→ Random: Top"), _("Add direction randomness by randomly moving 'top' half-turns tangentially to the boundary."), "top_tgt_variation", &wr, this, 0),
226 top_smth_variation(_("Rand. Smooth: Bottom"), _("Randomness of 'bottom' half-turns' smoothness"), "top_smth_variation", &wr, this, 0),
227 bot_smth_variation(_("Rand. Smooth: Top"), _("Randomness of 'top' half-turns' smoothness"), "bottom_smth_variation", &wr, this, 0),
228//
229 fat_output(_("Vary stroke width"), _("Simulate a stroke of varying width"), "fat_output", &wr, this, true),
230 do_bend(_("Bend hatches"), _("Add a global bending to the hatches (slower)"), "do_bend", &wr, this, true),
231 stroke_width_top(_("↓ Width"), _("Width at 'bottom' half-turns"), "stroke_width_top", &wr, this, 1.),
232 stroke_width_bot(_("↑ Width"), _("Width at 'top' half-turns"), "stroke_width_bottom", &wr, this, 1.),
233//
234 front_thickness(_("← Width"), _("Width of line from 'top' to 'bottom'"), "front_thickness", &wr, this, 1.),
235 back_thickness(_("→ Width"), _("Width of line from 'bottom' to 'top'"), "back_thickness", &wr, this, .25),
236
237 direction(_("Hatches width and dir"), _("Defines hatches frequency and direction"), "direction", &wr, this, Geom::Point(50,0)),
238//
239 bender(_("Global bending"), _("Relative position to a reference point defines global bending direction and amount"), "bender", &wr, this, Geom::Point(-5,0))
240{
261
262 //hatch_dist.param_set_range(0.1, Geom::infinity());
263 growth.param_set_range(0, std::numeric_limits<double>::max());
265 stroke_width_top.param_set_range(0, std::numeric_limits<double>::max());
266 stroke_width_bot.param_set_range(0, std::numeric_limits<double>::max());
267 front_thickness.param_set_range(0, std::numeric_limits<double>::max());
268 back_thickness.param_set_range(0, std::numeric_limits<double>::max());
269
270 // hide the widgets for direction and bender vectorparams
273 // give distinguishing colors to direction and bender on-canvas params
274 direction.set_oncanvas_color(0x00ff7d00);
275 bender.set_oncanvas_color(0xffffb500);
276
278 show_orig_path = true;
279}
280
282
284{
285 lpeversion.param_setValue("1.2", true);
286}
287
290
291 //std::cout<<"doEffect_pwd2:\n";
292
294
295 Piecewise<D2<SBasis> > transformed_pwd2_in = pwd2_in;
296 Point start = pwd2_in.segs.front().at0();
297 Point end = pwd2_in.segs.back().at1();
298 if (end != start ){
299 transformed_pwd2_in.push_cut( transformed_pwd2_in.cuts.back() + 1 );
300 D2<SBasis> stitch( SBasis( 1, Linear(end[X],start[X]) ), SBasis( 1, Linear(end[Y],start[Y]) ) );
301 transformed_pwd2_in.push_seg( stitch );
302 }
303 Point transformed_org = direction.getOrigin();
304 Piecewise<SBasis> tilter;//used to bend the hatches
305 Affine bend_mat;//used to bend the hatches
306
307 if (do_bend.get_value()){
308 Point bend_dir = -rot90(unit_vector(bender.getVector()));
309 double bend_amount = L2(bender.getVector());
310 bend_mat = Affine(-bend_dir[Y], bend_dir[X], bend_dir[X], bend_dir[Y],0,0);
311 transformed_pwd2_in = transformed_pwd2_in * bend_mat;
312 tilter = Piecewise<SBasis>(shift(Linear(-bend_amount),1));
313 OptRect bbox = bounds_exact( transformed_pwd2_in );
314 if (!(bbox)) return pwd2_in;
315 tilter.setDomain((*bbox)[Y]);
316 transformed_pwd2_in = bend(transformed_pwd2_in, tilter);
317 transformed_pwd2_in = transformed_pwd2_in * bend_mat.inverse();
318 }
320 Point hatches_dir = rot90(unit_vector(direction.getVector()));
321 Affine mat(-hatches_dir[Y], hatches_dir[X], hatches_dir[X], hatches_dir[Y],0,0);
322 transformed_pwd2_in = transformed_pwd2_in * mat;
323 transformed_org *= mat;
324
325 std::vector<std::vector<Point> > snakePoints;
326 snakePoints = linearSnake(transformed_pwd2_in, transformed_org);
327 if (!snakePoints.empty()){
328 Piecewise<D2<SBasis> >smthSnake = smoothSnake(snakePoints);
329 smthSnake = smthSnake*mat.inverse();
330 if (do_bend.get_value()){
331 smthSnake = smthSnake*bend_mat;
332 smthSnake = bend(smthSnake, -tilter);
333 smthSnake = smthSnake*bend_mat.inverse();
334 }
335 return (smthSnake);
336 }
337 return pwd2_in;
338}
339
340//------------------------------------------------
341// Generate the levels with random, growth...
342//------------------------------------------------
343std::vector<double>
344LPERoughHatches::generateLevels(Interval const &domain, double x_org){
345 std::vector<double> result;
346 int n = int((domain.min()-x_org)/hatch_dist);
347 double x = x_org + n * hatch_dist;
348 //double x = domain.min() + double(hatch_dist)/2.;
349 double step = double(hatch_dist);
350 double scale = 1+(hatch_dist*growth/domain.extent());
351 while (x < domain.max()){
352 result.push_back(x);
353 double rdm = 1;
354 if (dist_rdm.get_value() != 0)
355 rdm = 1.+ double((2*dist_rdm - dist_rdm.get_value()))/100.;
356 x+= step*rdm;
357 step*=scale;//(1.+double(growth));
358 }
359 return result;
360}
361
362
363//-------------------------------------------------------
364// Walk through the intersections to create linear hatches
365//-------------------------------------------------------
366std::vector<std::vector<Point> >
368
369 //std::cout<<"linearSnake:\n";
370 std::vector<std::vector<Point> > result;
372 //Remark: derivative is computed twice in the 2 lines below!!
374 OptInterval range = bounds_exact(x);
375
376 if (!range) return result;
377 std::vector<double> levels = generateLevels(*range, org[X]);
378 std::vector<std::vector<double> > times;
379 times = multi_roots(x,levels);
380//TODO: fix multi_roots!!!*****************************************
381//remove doubles :-(
382 std::vector<std::vector<double> > cleaned_times(levels.size(),std::vector<double>());
383 for (unsigned i=0; i<times.size(); i++){
384 if ( times[i].size()>0 ){
385 double last_t = times[i][0]-1;//ugly hack!!
386 for (unsigned j=0; j<times[i].size(); j++){
387 if (times[i][j]-last_t >0.000001){
388 last_t = times[i][j];
389 cleaned_times[i].push_back(last_t);
390 }
391 }
392 }
393 }
394 times = cleaned_times;
395//*******************************************************************
396
397 LevelsCrossings lscs(times,f,dx);
398
399 unsigned i,j;
400 lscs.findFirstUnused(i,j);
401
402 std::vector<Point> result_component;
403 int n = int((range->min()-org[X])/hatch_dist);
404
405 while ( i < lscs.size() ){
406 int dir = 0;
407 //switch orientation of first segment according to starting point.
408 if ((static_cast<long long>(i) % 2 == n % 2) && ((j + 1) < lscs[i].size()) && !lscs[i][j].used){
409 j += 1;
410 dir = 2;
411 }
412
413 while ( i < lscs.size() ){
414 result_component.push_back(lscs[i][j].pt);
415 lscs[i][j].used = true;
416 lscs.step(i,j, dir);
417 }
418 result.push_back(result_component);
419 result_component = std::vector<Point>();
420 lscs.findFirstUnused(i,j);
421 }
422 return result;
423}
424
425//-------------------------------------------------------
426// Smooth the linear hatches according to params...
427//-------------------------------------------------------
429LPERoughHatches::smoothSnake(std::vector<std::vector<Point> > const &linearSnake){
430
432 for (const auto & comp : linearSnake){
433 if (comp.size()>=2){
434 Point last_pt = comp[0];
435 //Point last_top = linearSnake[comp][0];
436 //Point last_bot = linearSnake[comp][0];
437 Point last_hdle = comp[0];
438 Point last_top_hdle = comp[0];
439 Point last_bot_hdle = comp[0];
440 Geom::Path res_comp(last_pt);
441 Geom::Path res_comp_top(last_pt);
442 Geom::Path res_comp_bot(last_pt);
443 unsigned i=1;
444 //bool is_top = true;//Inversion here; due to downward y?
445 bool is_top = ( comp[0][Y] < comp[1][Y] );
446
447 while( i+1<comp.size() ){
448 Point pt0 = comp[i];
449 Point pt1 = comp[i+1];
450 Point new_pt = (pt0+pt1)/2;
451 double scale_in = (is_top ? scale_tf : scale_bf );
452 double scale_out = (is_top ? scale_tb : scale_bb );
453 if (is_top){
454 if (top_edge_variation.get_value() != 0)
455 new_pt[Y] += double(top_edge_variation)-top_edge_variation.get_value()/2.;
456 if (top_tgt_variation.get_value() != 0)
457 new_pt[X] += double(top_tgt_variation)-top_tgt_variation.get_value()/2.;
458 if (top_smth_variation.get_value() != 0) {
459 scale_in*=(100.-double(top_smth_variation))/100.;
460 scale_out*=(100.-double(top_smth_variation))/100.;
461 }
462 }else{
463 if (bot_edge_variation.get_value() != 0)
464 new_pt[Y] += double(bot_edge_variation)-bot_edge_variation.get_value()/2.;
465 if (bot_tgt_variation.get_value() != 0)
466 new_pt[X] += double(bot_tgt_variation)-bot_tgt_variation.get_value()/2.;
467 if (bot_smth_variation.get_value() != 0) {
468 scale_in*=(100.-double(bot_smth_variation))/100.;
469 scale_out*=(100.-double(bot_smth_variation))/100.;
470 }
471 }
472 Point new_hdle_in = new_pt + (pt0-pt1) * (scale_in /2.);
473 Point new_hdle_out = new_pt - (pt0-pt1) * (scale_out/2.);
474
475 if ( fat_output.get_value() ){
476 //double scaled_width = double((is_top ? stroke_width_top : stroke_width_bot))/(pt1[X]-pt0[X]);
477 //double scaled_width = 1./(pt1[X]-pt0[X]);
478 //Point hdle_offset = (pt1-pt0)*scaled_width;
479 Point inside = new_pt;
480 Point inside_hdle_in;
481 Point inside_hdle_out;
482 inside[Y]+= double((is_top ? -stroke_width_top : stroke_width_bot));
483 inside_hdle_in = inside + (new_hdle_in -new_pt);// + hdle_offset * double((is_top ? front_thickness : back_thickness));
484 inside_hdle_out = inside + (new_hdle_out-new_pt);// - hdle_offset * double((is_top ? back_thickness : front_thickness));
485
486 inside_hdle_in += (pt1-pt0)/2*( double((is_top ? front_thickness : back_thickness)) / (pt1[X]-pt0[X]) );
487 inside_hdle_out -= (pt1-pt0)/2*( double((is_top ? back_thickness : front_thickness)) / (pt1[X]-pt0[X]) );
488
489 new_hdle_in -= (pt1-pt0)/2*( double((is_top ? front_thickness : back_thickness)) / (pt1[X]-pt0[X]) );
490 new_hdle_out += (pt1-pt0)/2*( double((is_top ? back_thickness : front_thickness)) / (pt1[X]-pt0[X]) );
491 //TODO: find a good way to handle limit cases (small smoothness, large stroke).
492 //if (inside_hdle_in[X] > inside[X]) inside_hdle_in = inside;
493 //if (inside_hdle_out[X] < inside[X]) inside_hdle_out = inside;
494
495 if (is_top){
496 res_comp_top.appendNew<CubicBezier>(last_top_hdle,new_hdle_in,new_pt);
497 res_comp_bot.appendNew<CubicBezier>(last_bot_hdle,inside_hdle_in,inside);
498 last_top_hdle = new_hdle_out;
499 last_bot_hdle = inside_hdle_out;
500 }else{
501 res_comp_top.appendNew<CubicBezier>(last_top_hdle,inside_hdle_in,inside);
502 res_comp_bot.appendNew<CubicBezier>(last_bot_hdle,new_hdle_in,new_pt);
503 last_top_hdle = inside_hdle_out;
504 last_bot_hdle = new_hdle_out;
505 }
506 }else{
507 res_comp.appendNew<CubicBezier>(last_hdle,new_hdle_in,new_pt);
508 }
509
510 last_hdle = new_hdle_out;
511 i+=2;
512 is_top = !is_top;
513 }
514 if ( i<comp.size() ){
515 if ( fat_output.get_value() ){
516 res_comp_top.appendNew<CubicBezier>(last_top_hdle,comp[i],comp[i]);
517 res_comp_bot.appendNew<CubicBezier>(last_bot_hdle,comp[i],comp[i]);
518 }else{
519 res_comp.appendNew<CubicBezier>(last_hdle,comp[i],comp[i]);
520 }
521 }
522 if ( fat_output.get_value() ){
523 res_comp = res_comp_bot;
524 res_comp.setStitching(true);
525 res_comp.append(res_comp_top.reversed());
526 }
527 result.concat(res_comp.toPwSb());
528 }
529 }
530 return result;
531}
532
533void
547
548
549void
551{
553
555 Geom::Point origin(0.,0.);
556 Geom::Point vector(50.,0.);
557 if (bbox) {
558 origin = bbox->midpoint();
559 vector = Geom::Point((*bbox)[X].extent()/4, 0.);
560 top_edge_variation.param_set_value( (*bbox)[Y].extent()/10, 0 );
561 bot_edge_variation.param_set_value( (*bbox)[Y].extent()/10, 0 );
564 }
565 //direction.set_and_write_new_values(origin, vector);
566 //bender.param_set_and_write_new_value( origin + Geom::Point(5,0) );
569 hatch_dist = Geom::L2(vector)/2;
570}
571
572
573} //namespace LivePathEffect
574} /* namespace Inkscape */
575
576/*
577 Local Variables:
578 mode:c++
579 c-file-style:"stroustrup"
580 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
581 indent-tabs-mode:nil
582 fill-column:99
583 End:
584*/
585// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
pair< double, double > Point
Definition parser.cpp:7
double scale
Definition aa.cpp:228
Point origin
Definition aa.cpp:227
Conversion between Bezier control points and SBasis curves.
3x3 matrix representing an affine transformation.
Definition affine.h:70
Affine inverse() const
Compute the inverse matrix.
Definition affine.cpp:388
Bezier curve with compile-time specified order.
Adaptor that creates 2D functions from 1D ones.
Definition d2.h:55
constexpr C extent() const
constexpr C min() const
constexpr C max() const
Range of real numbers that is never empty.
Definition interval.h:59
Function that interpolates linearly between two values.
Definition linear.h:55
Range of real numbers that can be empty.
Definition interval.h:199
Axis-aligned rectangle that can be empty.
Definition rect.h:203
Sequence of contiguous curves, aka spline.
Definition path.h:353
void setStitching(bool x)
Enable or disable the throwing of exceptions when stitching discontinuities.
Definition path.h:827
Piecewise< D2< SBasis > > toPwSb() const
Definition path.cpp:388
void append(Curve *curve)
Add a new curve to the end of the path.
Definition path.h:750
Path reversed() const
Obtain a reversed version of the current path.
Definition path.cpp:866
void appendNew(Args &&... args)
Append a new curve to the path.
Definition path.h:804
Function defined as discrete pieces.
Definition piecewise.h:71
output_type valueAt(double t) const
Definition piecewise.h:102
void push_seg(const T &s)
Definition piecewise.h:157
void push_cut(double c)
Definition piecewise.h:152
std::vector< double > cuts
Definition piecewise.h:75
void setDomain(Interval dom)
Definition piecewise.h:218
Two-dimensional point that doubles as a vector.
Definition point.h:66
Polynomial in symmetric power basis.
Definition sbasis.h:70
void registerParameter(Parameter *param)
Definition effect.cpp:1710
virtual void resetDefaults(SPItem const *item)
Sets all parameters to their default values and writes them to SVG.
Definition effect.cpp:2014
void param_setValue(Glib::ustring newvalue, bool write=false)
Definition hidden.cpp:71
void resetDefaults(SPItem const *item) override
Sets all parameters to their default values and writes them to SVG.
void doBeforeEffect(SPLPEItem const *item) override
Is performed each time before the effect is updated.
std::vector< double > generateLevels(Geom::Interval const &domain, double x_org)
LPERoughHatches(LivePathEffectObject *lpeobject)
void doOnApply(SPLPEItem const *lpeitem) override
Is performed a single time when the effect is freshly applied to a path.
Geom::Piecewise< Geom::D2< Geom::SBasis > > doEffect_pwd2(Geom::Piecewise< Geom::D2< Geom::SBasis > > const &pwd2_in) override
std::vector< std::vector< Geom::Point > > linearSnake(Geom::Piecewise< Geom::D2< Geom::SBasis > > const &f, Geom::Point const &org)
Geom::Piecewise< Geom::D2< Geom::SBasis > > smoothSnake(std::vector< std::vector< Geom::Point > > const &linearSnake)
void param_set_value(gdouble val, long newseed)
Definition random.cpp:105
void param_set_range(gdouble min, gdouble max)
Definition random.cpp:129
void param_set_range(double min, double max)
Geom::Point getVector() const
Definition vector.h:41
void set_oncanvas_color(guint32 color)
Definition vector.cpp:148
void set_and_write_new_values(Geom::Point const &new_origin, Geom::Point const &new_vector)
Definition vector.cpp:124
Geom::Point getOrigin() const
Definition vector.h:42
Base class for visual SVG elements.
Definition sp-item.h:109
Geom::OptRect geometricBounds(Geom::Affine const &transform=Geom::identity()) const
Get item's geometric bounding box in this item's coordinate system.
Definition sp-item.cpp:927
Css & result
@ Y
Definition coord.h:48
@ X
Definition coord.h:48
std::vector< LevelCrossing > LevelCrossings
Definition hatches.cpp:32
std::vector< Point > linearSnake(Piecewise< D2< SBasis > > const &f, double dy, double growth, double rdmness)
Definition hatches.cpp:164
SPItem * item
Fills an area with rough hatches.
Geom::Point start
Geom::Point end
Various utility functions.
Definition affine.h:22
D2< Piecewise< SBasis > > make_cuts_independent(Piecewise< D2< SBasis > > const &a)
Definition d2-sbasis.cpp:75
OptInterval bounds_exact(Bezier const &b)
Definition bezier.cpp:310
static float sign(double number)
Returns +1 for positive numbers, -1 for negative numbers, and 0 otherwise.
Piecewise< D2< SBasis > > sectionize(D2< Piecewise< SBasis > > const &a)
Definition d2-sbasis.cpp:65
SBasisOf< T > shift(SBasisOf< T > const &a, int sh)
Definition sbasis-of.h:435
D2< T > compose(D2< T > const &a, T const &b)
Definition d2.h:405
Bezier derivative(Bezier const &a)
Definition bezier.cpp:282
std::vector< std::vector< double > > multi_roots(SBasis const &f, std::vector< double > const &levels, double htol=1e-7, double vtol=1e-7, double a=0, double b=1)
SBasis L2(D2< SBasis > const &a, unsigned k)
Definition d2-sbasis.cpp:42
Point unit_vector(Point const &a)
D2< T > rot90(D2< T > const &a)
Definition d2.h:397
static Piecewise< D2< SBasis > > bend(Piecewise< D2< SBasis > > const &f, Piecewise< SBasis > bending)
std::vector< LevelCrossing > LevelCrossings
static std::vector< double > discontinuities(Piecewise< D2< SBasis > > const &f)
Helper class to stream background task notifications as a series of messages.
STL namespace.
bool used
some std functions to work with (pw)s-basis
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.