~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/live_effects/lpe-sketch.cpp

  • Committer: Ted Gould
  • Date: 2008-11-21 05:24:08 UTC
  • Revision ID: ted@canonical.com-20081121052408-tilucis2pjrrpzxx
MergeĀ fromĀ fe-moved

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#define INKSCAPE_LPE_SKETCH_CPP
2
 
/** \file
3
 
 * LPE <sketch> implementation
 
1
/** @file
 
2
 * @brief LPE sketch effect implementation
4
3
 */
5
 
/*
6
 
 * Authors:
7
 
 *   Johan Engelen
8
 
*
9
 
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
 
4
/* Authors:
 
5
 *   Jean-Francois Barraud <jf.barraud@gmail.com>
 
6
 *   Johan Engelen <j.b.c.engelen@utwente.nl>
 
7
 *
 
8
 * Copyright (C) 2007 Authors
10
9
 *
11
10
 * Released under GNU GPL, read the file 'COPYING' for more information
12
11
 */
189
188
 
190
189
    //----- Approximated Strokes.
191
190
    std::vector<Piecewise<D2<SBasis> > > pieces_in = split_at_discontinuities (pwd2_in);
192
 
 
 
191
    
193
192
    //work separately on each component.
194
193
    for (unsigned pieceidx = 0; pieceidx < pieces_in.size(); pieceidx++){
195
194
 
247
246
                t1 = times[0];
248
247
                
249
248
                //pick a rdm perturbation, and collect the perturbed piece into output.
250
 
                Piecewise<D2<SBasis> > pwperturb = computePerturbation(s0,s1);
 
249
                Piecewise<D2<SBasis> > pwperturb = computePerturbation(s0-0.01,s1+0.01);
251
250
                pwperturb = compose(pwperturb,portion(piecelength,t0,t1));
 
251
 
252
252
                output.concat(portion(piece,t0,t1)+pwperturb);
253
 
                
 
253
 
254
254
                //step points: s0 = s1 - overlap.
255
255
                //TODO: make sure this has to end?
256
256
                s0 = s1 - strokeoverlap*(1-strokeoverlap_rdm)*(s1-s0);
258
258
        }
259
259
    }
260
260
 
261
 
 
262
261
    //----- Construction lines.
263
262
    //TODO: choose places according to curvature?.
264
263
 
268
267
    Piecewise<D2<SBasis> > m = pwd2_in;
269
268
    Piecewise<D2<SBasis> > v = derivative(pwd2_in);
270
269
    Piecewise<D2<SBasis> > a = derivative(v);
 
270
 
271
271
    for (unsigned i=0; i<nbtangents; i++){
 
272
 
272
273
        // pick a point where to draw a tangent (s = dist from start along path).
273
274
        double s = total_length * ( i + tgtlength_rdm ) / (nbtangents+1.);
274
275
        std::vector<double> times;  
290
291
        }
291
292
        output.concat(Piecewise<D2<SBasis> >(tgt));
292
293
    }
 
294
    
293
295
    return output;
294
296
}
295
297
 
319
321
  fill-column:99
320
322
  End:
321
323
*/
322
 
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
 
324
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :