summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJF Barraud <jf.barraud@gmail.com>2008-03-16 18:24:29 +0000
committerjfbarraud <jfbarraud@users.sourceforge.net>2008-03-16 18:24:29 +0000
commitfbeca518cc712066959af8c3b4589ec289c9cde6 (patch)
tree6e242ba2247f6f8ba537ac0507534d6fe947b57e /src
parentlpe-sketch: fixed a bug about construction lines being all stacked on a singl... (diff)
downloadinkscape-fbeca518cc712066959af8c3b4589ec289c9cde6.tar.gz
inkscape-fbeca518cc712066959af8c3b4589ec289c9cde6.zip
lpe-sketch: deal with empty input. fix bug #201735.
(bzr r5105)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-sketch.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp
index fcdbfefc0..79f4d67f9 100644
--- a/src/live_effects/lpe-sketch.cpp
+++ b/src/live_effects/lpe-sketch.cpp
@@ -196,6 +196,10 @@ Geom::Piecewise<Geom::D2<Geom::SBasis> >
LPESketch::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
{
using namespace Geom;
+ //If the input path is empty, do nothing.
+ //Note: this happens when duplicating a 3d box... dunno why.
+ if (pwd2_in.size()==0) return pwd2_in;
+
Piecewise<D2<SBasis> > output;
@@ -245,14 +249,12 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
while (!done){
// if the start point is already too far... do nothing. (this should not happen!)
- assert (s0>=0);//this should not happen!!
if (!closed && s1>piece_total_length - ends_tolerance.get_value()*strokelength) break;
if ( closed && s0>piece_total_length + s0_initial) break;
std::vector<double> times;
times = roots(piecelength-s0);
- if (times.size()==0) break;//we should not be there.
- t0 = times[0];
+ t0 = times.at(0);//there should be one and only one solution!!
// pick a new end point (s1 = s0 + strokelength).
s1 = s0 + strokelength*(1-strokelength_rdm);
@@ -300,8 +302,7 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
double s = total_length * ( i + tgtlength_rdm ) / (nbtangents+1.);
std::vector<double> times;
times = roots(pathlength-s);
- assert(times.size()>0);//there should be one and only one solution!
- double t = times[0];
+ double t = times.at(0);//there should be one and only one solution!
Point m_t = m(t), v_t = v(t), a_t = a(t);
//Compute tgt length according to curvature (not exceeding tgtlength) so that
// dist to origninal curve ~ 4 * (parallel_offset+tremble_size).