diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2010-07-30 22:52:27 +0000 |
|---|---|---|
| committer | Johan Engelen <goejendaagh@zonnet.nl> | 2010-07-30 22:52:27 +0000 |
| commit | 59f56e0c14005e4c386a162a5ce66398b710a82f (patch) | |
| tree | 301608285958e91d3454933743629ffcdaa4c18c /src/live_effects/lpe-powerstroke.cpp | |
| parent | Translations. Simplified Chinese translation update by Liu Xiaoqin. (diff) | |
| download | inkscape-59f56e0c14005e4c386a162a5ce66398b710a82f.tar.gz inkscape-59f56e0c14005e4c386a162a5ce66398b710a82f.zip | |
powerstroke: redefine meaning of offset point parameter values. now knots move with path
(bzr r9672)
Diffstat (limited to 'src/live_effects/lpe-powerstroke.cpp')
| -rw-r--r-- | src/live_effects/lpe-powerstroke.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index addddd06f..68cdac115 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -133,6 +133,8 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : { show_orig_path = true; + /// @todo offset_points are initialized with empty path, is that bug-save? + registerParameter( dynamic_cast<Parameter *>(&offset_points) ); registerParameter( dynamic_cast<Parameter *>(&sort_points) ); } @@ -147,10 +149,10 @@ void LPEPowerStroke::doOnApply(SPLPEItem *lpeitem) { std::vector<Geom::Point> points; - points.push_back( *(SP_SHAPE(lpeitem)->curve->first_point()) ); - Geom::Path const *path = SP_SHAPE(lpeitem)->curve->first_path(); - points.push_back( path->pointAt(path->size()/2) ); - points.push_back( *(SP_SHAPE(lpeitem)->curve->last_point()) ); + Geom::Path::size_type size = SP_SHAPE(lpeitem)->curve->get_pathvector().front().size_open(); + points.push_back( Geom::Point(0,0) ); + points.push_back( Geom::Point(0.5*size,0) ); + points.push_back( Geom::Point(size,0) ); offset_points.param_set_and_write_new_value(points); } @@ -165,15 +167,15 @@ LPEPowerStroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & { using namespace Geom; + offset_points.set_pwd2(pwd2_in); + // perhaps use std::list instead of std::vector? std::vector<Geom::Point> ts(offset_points.data().size() + 2); // first and last point coincide with input path (for now at least) ts.front() = Point(pwd2_in.domain().min(),0); ts.back() = Point(pwd2_in.domain().max(),0); for (unsigned int i = 0; i < offset_points.data().size(); ++i) { - double t = nearest_point(offset_points.data().at(i), pwd2_in); - double offset = L2(pwd2_in.valueAt(t) - offset_points.data().at(i)); - ts.at(i+1) = Geom::Point(t, offset); + ts.at(i+1) = offset_points.data().at(i); } if (sort_points) { @@ -192,7 +194,8 @@ LPEPowerStroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & Piecewise<SBasis> y = Piecewise<SBasis>(patternd2[1]); Piecewise<D2<SBasis> > der = unitVector(derivative(pwd2_in)); - Piecewise<D2<SBasis> > n = rot90(der); + Piecewise<D2<SBasis> > n = rot90(der); + offset_points.set_pwd2_normal(n); // output = pwd2_in + n * offset; // append_half_circle(output, pwd2_in.lastValue(), n.lastValue() * offset); |
