From db164d8341a6dca5cab6fdc4576234bc656ac6f7 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sun, 12 Nov 2017 18:10:11 +0100 Subject: Base refactor --- src/live_effects/lpe-powerstroke.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 51c8451a5..7c060a965 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -563,13 +563,19 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) Geom::PathVector path_out; if (path_in.empty()) { - return path_out; + return path_in; } Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers(path_in); Geom::Piecewise > pwd2_in = pathv[0].toPwSb(); + if (!pwd2_in.size()) { + return path_in; + } Piecewise > der = derivative(pwd2_in); + if (!der.size()) { + return path_in; + } Piecewise > n = unitVector(der,0.0001); - if (!n.size() || !pwd2_in.size() || !n.size()) { + if (!n.size()) { return path_in; } n = rot90(n); @@ -639,10 +645,8 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) } LineJoinType jointype = static_cast(linejoin_type.get_value()); - - Piecewise > pwd2_out = compose(pwd2_in,x) + y*compose(n,x); + Piecewise > pwd2_out = compose(pwd2_in,x) + y*compose(n,x); Piecewise > mirrorpath = reverse( compose(pwd2_in,x) - y*compose(n,x)); - Geom::Path fixed_path = path_from_piecewise_fix_cusps( pwd2_out, y, jointype, miter_limit, LPE_CONVERSION_TOLERANCE); Geom::Path fixed_mirrorpath = path_from_piecewise_fix_cusps( mirrorpath, reverse(y), jointype, miter_limit, LPE_CONVERSION_TOLERANCE); if (pathv[0].closed()) { -- cgit v1.2.3