From a7f2b2ba3f13ceb60376802f4a31e104153839e8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Feb 2015 03:00:37 +0100 Subject: At first, I was thinking "I just have to go to the selection file, and change that GSList* with a std::list, then resolve the few problems" So, i tried that. And I will continue tomorrow, and the days after, on and on. (bzr r13922.1.1) --- src/live_effects/lpe-knot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 3876aa24b..95a6b16dd 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -505,9 +505,9 @@ LPEKnot::doEffect_path (std::vector const &path_in) static void collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector &paths, std::vector &stroke_widths){ if (SP_IS_GROUP(lpeitem)) { - GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); - for ( GSList const *iter = item_list; iter; iter = iter->next ) { - SPObject *subitem = static_cast(iter->data); + SelContainer item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); + for ( SelContainer::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { + SPObject *subitem = static_cast(*iter); if (SP_IS_LPE_ITEM(subitem)) { collectPathsAndWidths(SP_LPE_ITEM(subitem), paths, stroke_widths); } -- cgit v1.2.3 From 5fd00cab14d48beaf2279a2b8f3ad5b02b76c87b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 04:25:21 +0100 Subject: Put a few std::vector (bzr r13922.1.5) --- src/live_effects/lpe-knot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 95a6b16dd..6cdf09180 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -505,8 +505,8 @@ LPEKnot::doEffect_path (std::vector const &path_in) static void collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector &paths, std::vector &stroke_widths){ if (SP_IS_GROUP(lpeitem)) { - SelContainer item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); - for ( SelContainer::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { + std::vector item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); + for ( std::vector::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { SPObject *subitem = static_cast(*iter); if (SP_IS_LPE_ITEM(subitem)) { collectPathsAndWidths(SP_LPE_ITEM(subitem), paths, stroke_widths); -- cgit v1.2.3 From 9a7fa4d1899d30ec745107823f307b2a0bf3172f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 03:10:36 +0100 Subject: corrected the casts (hopefully) (bzr r13922.1.10) --- src/live_effects/lpe-knot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 6cdf09180..7a1d391a3 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -506,7 +506,7 @@ static void collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector &paths, std::vector &stroke_widths){ if (SP_IS_GROUP(lpeitem)) { std::vector item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); - for ( std::vector::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { + for ( std::vector::const_iterator iter = item_list.begin(); iter != item_list.end(); iter++) { SPObject *subitem = static_cast(*iter); if (SP_IS_LPE_ITEM(subitem)) { collectPathsAndWidths(SP_LPE_ITEM(subitem), paths, stroke_widths); -- cgit v1.2.3 From 9bdc157f705ca61516e599cb416580283d21ec35 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 04:21:48 +0100 Subject: more cast cleanup (bzr r13922.1.11) --- src/live_effects/lpe-knot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 7a1d391a3..6ec4b969b 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -507,7 +507,7 @@ collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector &paths, if (SP_IS_GROUP(lpeitem)) { std::vector item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( std::vector::const_iterator iter = item_list.begin(); iter != item_list.end(); iter++) { - SPObject *subitem = static_cast(*iter); + SPObject *subitem = *iter; if (SP_IS_LPE_ITEM(subitem)) { collectPathsAndWidths(SP_LPE_ITEM(subitem), paths, stroke_widths); } -- cgit v1.2.3 From c883d7627a479c8c5b6a9f77b9841fa5631572ad Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Mon, 27 Apr 2015 19:39:29 -0400 Subject: 2Geom sync - initial commit (bzr r14059.2.1) --- src/live_effects/Makefile_insert | 2 - src/live_effects/effect.cpp | 94 ++++++++++------------ src/live_effects/effect.h | 8 +- src/live_effects/lpe-angle_bisector.cpp | 10 +-- src/live_effects/lpe-angle_bisector.h | 2 +- src/live_effects/lpe-attach-path.cpp | 16 ++-- src/live_effects/lpe-boolops.cpp | 79 ------------------ src/live_effects/lpe-boolops.h | 53 ------------ src/live_effects/lpe-bounding-box.cpp | 2 +- src/live_effects/lpe-bspline.cpp | 12 +-- src/live_effects/lpe-circle_3pts.cpp | 8 +- src/live_effects/lpe-circle_3pts.h | 2 +- src/live_effects/lpe-circle_with_radius.cpp | 6 +- src/live_effects/lpe-circle_with_radius.h | 2 +- src/live_effects/lpe-clone-original.cpp | 2 +- src/live_effects/lpe-constructgrid.cpp | 6 +- src/live_effects/lpe-constructgrid.h | 2 +- src/live_effects/lpe-curvestitch.cpp | 10 +-- src/live_effects/lpe-curvestitch.h | 2 +- src/live_effects/lpe-ellipse_5pts.cpp | 8 +- src/live_effects/lpe-ellipse_5pts.h | 2 +- src/live_effects/lpe-fill-between-many.cpp | 4 +- src/live_effects/lpe-fill-between-strokes.cpp | 26 +++--- src/live_effects/lpe-fillet-chamfer.cpp | 20 ++--- src/live_effects/lpe-fillet-chamfer.h | 8 +- src/live_effects/lpe-gears.cpp | 6 +- src/live_effects/lpe-gears.h | 2 +- src/live_effects/lpe-interpolate.cpp | 2 +- src/live_effects/lpe-interpolate.h | 2 +- src/live_effects/lpe-interpolate_points.h | 2 +- src/live_effects/lpe-jointype.cpp | 2 +- src/live_effects/lpe-jointype.h | 2 +- src/live_effects/lpe-knot.cpp | 18 ++--- src/live_effects/lpe-knot.h | 10 +-- src/live_effects/lpe-lattice2.cpp | 4 +- src/live_effects/lpe-line_segment.cpp | 16 ++-- src/live_effects/lpe-line_segment.h | 2 +- src/live_effects/lpe-mirror_symmetry.cpp | 10 +-- src/live_effects/lpe-mirror_symmetry.h | 2 +- src/live_effects/lpe-offset.cpp | 2 +- src/live_effects/lpe-parallel.cpp | 2 +- src/live_effects/lpe-perp_bisector.cpp | 4 +- src/live_effects/lpe-perspective-envelope.cpp | 4 +- src/live_effects/lpe-powerstroke.cpp | 28 ++++--- src/live_effects/lpe-powerstroke.h | 4 +- src/live_effects/lpe-rough-hatches.cpp | 3 +- src/live_effects/lpe-roughen.cpp | 4 +- src/live_effects/lpe-ruler.cpp | 2 +- src/live_effects/lpe-show_handles.cpp | 19 ++--- src/live_effects/lpe-show_handles.h | 2 +- src/live_effects/lpe-simplify.cpp | 15 ++-- src/live_effects/lpe-skeleton.cpp | 6 +- src/live_effects/lpe-skeleton.h | 4 +- src/live_effects/lpe-spiro.cpp | 3 +- src/live_effects/lpe-tangent_to_curve.cpp | 8 +- src/live_effects/lpe-taperstroke.cpp | 11 ++- src/live_effects/lpe-test-doEffect-stack.cpp | 6 +- src/live_effects/lpe-test-doEffect-stack.h | 2 +- src/live_effects/lpe-vonkoch.cpp | 22 ++--- src/live_effects/lpe-vonkoch.h | 2 +- .../parameter/filletchamferpointarray.cpp | 26 +++--- .../parameter/filletchamferpointarray.h | 6 +- src/live_effects/parameter/originalpatharray.h | 2 +- src/live_effects/parameter/path.cpp | 6 +- src/live_effects/parameter/path.h | 6 +- .../parameter/powerstrokepointarray.cpp | 4 +- 66 files changed, 263 insertions(+), 406 deletions(-) delete mode 100644 src/live_effects/lpe-boolops.cpp delete mode 100644 src/live_effects/lpe-boolops.h (limited to 'src/live_effects') diff --git a/src/live_effects/Makefile_insert b/src/live_effects/Makefile_insert index dace45739..c2c2ce93c 100644 --- a/src/live_effects/Makefile_insert +++ b/src/live_effects/Makefile_insert @@ -14,8 +14,6 @@ ink_common_sources += \ live_effects/lpe-patternalongpath.h \ live_effects/lpe-bendpath.cpp \ live_effects/lpe-bendpath.h \ - live_effects/lpe-boolops.cpp \ - live_effects/lpe-boolops.h \ live_effects/lpe-dynastroke.cpp \ live_effects/lpe-dynastroke.h \ live_effects/lpe-extrude.cpp \ diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1da364580..d3ca781e9 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -14,54 +14,53 @@ // include effects: #include "live_effects/lpe-patternalongpath.h" #include "live_effects/effect.h" +#include "live_effects/lpe-angle_bisector.h" +#include "live_effects/lpe-attach-path.h" #include "live_effects/lpe-bendpath.h" -#include "live_effects/lpe-sketch.h" -#include "live_effects/lpe-vonkoch.h" -#include "live_effects/lpe-knot.h" -#include "live_effects/lpe-rough-hatches.h" -#include "live_effects/lpe-dynastroke.h" -#include "live_effects/lpe-test-doEffect-stack.h" -#include "live_effects/lpe-gears.h" -#include "live_effects/lpe-curvestitch.h" +#include "live_effects/lpe-bounding-box.h" +#include "live_effects/lpe-bspline.h" +#include "live_effects/lpe-circle_3pts.h" #include "live_effects/lpe-circle_with_radius.h" -#include "live_effects/lpe-perspective_path.h" -#include "live_effects/lpe-perspective-envelope.h" -#include "live_effects/lpe-spiro.h" -#include "live_effects/lpe-lattice.h" -#include "live_effects/lpe-lattice2.h" -#include "live_effects/lpe-roughen.h" -#include "live_effects/lpe-show_handles.h" -#include "live_effects/lpe-simplify.h" -#include "live_effects/lpe-envelope.h" +#include "live_effects/lpe-clone-original.h" #include "live_effects/lpe-constructgrid.h" -#include "live_effects/lpe-perp_bisector.h" -#include "live_effects/lpe-tangent_to_curve.h" -#include "live_effects/lpe-mirror_symmetry.h" -#include "live_effects/lpe-circle_3pts.h" -#include "live_effects/lpe-angle_bisector.h" -#include "live_effects/lpe-parallel.h" #include "live_effects/lpe-copy_rotate.h" -#include "live_effects/lpe-offset.h" -#include "live_effects/lpe-ruler.h" -#include "live_effects/lpe-boolops.h" +#include "live_effects/lpe-curvestitch.h" +#include "live_effects/lpe-dynastroke.h" +#include "live_effects/lpe-ellipse_5pts.h" +#include "live_effects/lpe-envelope.h" +#include "live_effects/lpe-extrude.h" +#include "live_effects/lpe-fill-between-many.h" +#include "live_effects/lpe-fill-between-strokes.h" +#include "live_effects/lpe-fillet-chamfer.h" +#include "live_effects/lpe-gears.h" #include "live_effects/lpe-interpolate.h" #include "live_effects/lpe-interpolate_points.h" -#include "live_effects/lpe-text_label.h" -#include "live_effects/lpe-path_length.h" +#include "live_effects/lpe-jointype.h" +#include "live_effects/lpe-knot.h" +#include "live_effects/lpe-lattice2.h" +#include "live_effects/lpe-lattice.h" #include "live_effects/lpe-line_segment.h" -#include "live_effects/lpe-recursiveskeleton.h" -#include "live_effects/lpe-extrude.h" +#include "live_effects/lpe-mirror_symmetry.h" +#include "live_effects/lpe-offset.h" +#include "live_effects/lpe-parallel.h" +#include "live_effects/lpe-path_length.h" +#include "live_effects/lpe-perp_bisector.h" +#include "live_effects/lpe-perspective-envelope.h" +#include "live_effects/lpe-perspective_path.h" #include "live_effects/lpe-powerstroke.h" -#include "live_effects/lpe-clone-original.h" -#include "live_effects/lpe-bspline.h" -#include "live_effects/lpe-attach-path.h" -#include "live_effects/lpe-fill-between-strokes.h" -#include "live_effects/lpe-fill-between-many.h" -#include "live_effects/lpe-ellipse_5pts.h" -#include "live_effects/lpe-bounding-box.h" -#include "live_effects/lpe-jointype.h" +#include "live_effects/lpe-recursiveskeleton.h" +#include "live_effects/lpe-roughen.h" +#include "live_effects/lpe-rough-hatches.h" +#include "live_effects/lpe-ruler.h" +#include "live_effects/lpe-show_handles.h" +#include "live_effects/lpe-simplify.h" +#include "live_effects/lpe-sketch.h" +#include "live_effects/lpe-spiro.h" +#include "live_effects/lpe-tangent_to_curve.h" #include "live_effects/lpe-taperstroke.h" -#include "live_effects/lpe-fillet-chamfer.h" +#include "live_effects/lpe-test-doEffect-stack.h" +#include "live_effects/lpe-text_label.h" +#include "live_effects/lpe-vonkoch.h" #include "xml/node-event-vector.h" #include "sp-object.h" @@ -98,8 +97,6 @@ const Util::EnumData LPETypeData[] = { #ifdef LPE_ENABLE_TEST_EFFECTS {DOEFFECTSTACK_TEST, N_("doEffect stack test"), "doeffectstacktest"}, {ANGLE_BISECTOR, N_("Angle bisector"), "angle_bisector"}, - // TRANSLATORS: boolean operations - {BOOLOPS, N_("Boolops"), "boolops"}, {CIRCLE_WITH_RADIUS, N_("Circle (by center and radius)"), "circle_with_radius"}, {CIRCLE_3PTS, N_("Circle by 3 points"), "circle_3pts"}, {DYNASTROKE, N_("Dynamic stroke"), "dynastroke"}, @@ -243,9 +240,6 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) case RULER: neweffect = static_cast ( new LPERuler(lpeobj) ); break; - case BOOLOPS: - neweffect = static_cast ( new LPEBoolops(lpeobj) ); - break; case INTERPOLATE: neweffect = static_cast ( new LPEInterpolate(lpeobj) ); break; @@ -523,24 +517,24 @@ Effect::acceptParamPath (SPPath const*/*param_path*/) { void Effect::doEffect (SPCurve * curve) { - std::vector orig_pathv = curve->get_pathvector(); + Geom::PathVector orig_pathv = curve->get_pathvector(); - std::vector result_pathv = doEffect_path(orig_pathv); + Geom::PathVector result_pathv = doEffect_path(orig_pathv); curve->set_pathvector(result_pathv); } -std::vector -Effect::doEffect_path (std::vector const & path_in) +Geom::PathVector +Effect::doEffect_path (Geom::PathVector const & path_in) { - std::vector path_out; + Geom::PathVector path_out; if ( !concatenate_before_pwd2 ) { // default behavior for (unsigned int i=0; i < path_in.size(); i++) { Geom::Piecewise > pwd2_in = path_in[i].toPwSb(); Geom::Piecewise > pwd2_out = doEffect_pwd2(pwd2_in); - std::vector path = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE); + Geom::PathVector path = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE); // add the output path vector to the already accumulated vector: for (unsigned int j=0; j < path.size(); j++) { path_out.push_back(path[j]); diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index ac1f0b8dc..63d357481 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -129,9 +129,9 @@ protected: // of what kind of input/output parameters he desires. // the order in which they appear is the order in which they are // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling - // doEffect(std::vector ) - virtual std::vector - doEffect_path (std::vector const & path_in); + // doEffect(Geom::PathVector ) + virtual Geom::PathVector + doEffect_path (Geom::PathVector const & path_in); virtual Geom::Piecewise > doEffect_pwd2 (Geom::Piecewise > const & pwd2_in); @@ -163,7 +163,7 @@ protected: double current_zoom; std::vector selectedNodesPoints; SPCurve * sp_curve; - std::vector pathvector_before_effect; + Geom::PathVector pathvector_before_effect; private: bool provides_own_flash_paths; // if true, the standard flash path is suppressed diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp index 1acf9605f..95a81c763 100644 --- a/src/live_effects/lpe-angle_bisector.cpp +++ b/src/live_effects/lpe-angle_bisector.cpp @@ -56,8 +56,8 @@ LPEAngleBisector::~LPEAngleBisector() { } -std::vector -LPEAngleBisector::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPEAngleBisector::doEffect_path (Geom::PathVector const & path_in) { using namespace Geom; @@ -73,7 +73,7 @@ LPEAngleBisector::doEffect_path (std::vector const & path_in) Geom::Point D = ptA - dir * length_left; Geom::Point E = ptA + dir * length_right; - Piecewise > output = Piecewise >(D2(Linear(D[X], E[X]), Linear(D[Y], E[Y]))); + Piecewise > output = Piecewise >(D2(SBasis(D[X], E[X]), SBasis(D[Y], E[Y]))); return path_from_piecewise(output, LPE_CONVERSION_TOLERANCE); } @@ -103,7 +103,7 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori Geom::Point const s = snap_knot_position(p, state); - double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir); + double lambda = Geom::nearest_time(s, lpe->ptA, lpe->dir); lpe->length_left.param_set_value(-lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); @@ -116,7 +116,7 @@ KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*or Geom::Point const s = snap_knot_position(p, state); - double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir); + double lambda = Geom::nearest_time(s, lpe->ptA, lpe->dir); lpe->length_right.param_set_value(lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); diff --git a/src/live_effects/lpe-angle_bisector.h b/src/live_effects/lpe-angle_bisector.h index 95048751e..400cbf6b6 100644 --- a/src/live_effects/lpe-angle_bisector.h +++ b/src/live_effects/lpe-angle_bisector.h @@ -28,7 +28,7 @@ public: LPEAngleBisector(LivePathEffectObject *lpeobject); virtual ~LPEAngleBisector(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); friend class AB::KnotHolderEntityLeftEnd; friend class AB::KnotHolderEntityRightEnd; diff --git a/src/live_effects/lpe-attach-path.cpp b/src/live_effects/lpe-attach-path.cpp index 768c66ee2..0fcd725ce 100644 --- a/src/live_effects/lpe-attach-path.cpp +++ b/src/live_effects/lpe-attach-path.cpp @@ -64,7 +64,7 @@ void LPEAttachPath::resetDefaults(SPItem const * /*item*/) void LPEAttachPath::doEffect (SPCurve * curve) { - std::vector this_pathv = curve->get_pathvector(); + Geom::PathVector this_pathv = curve->get_pathvector(); if (sp_lpe_item && !this_pathv.empty()) { Geom::Path p = Geom::Path(this_pathv.front().initialPoint()); @@ -73,7 +73,7 @@ void LPEAttachPath::doEffect (SPCurve * curve) if (start_path.linksToPath()) { - std::vector linked_pathv = start_path.get_pathvector(); + Geom::PathVector linked_pathv = start_path.get_pathvector(); Geom::Affine linkedtransform = start_path.getObject()->getRelativeTransform(sp_lpe_item); if ( !linked_pathv.empty() ) @@ -87,7 +87,7 @@ void LPEAttachPath::doEffect (SPCurve * curve) Geom::Coord length = derivs[deriv_n].length(); if ( ! Geom::are_near(length, 0) ) { if (set_start_end) { - start_path_position.param_set_value(transformedpath.nearestPoint(start_path_curve_end.getOrigin())); + start_path_position.param_set_value(transformedpath.nearestTime(start_path_curve_end.getOrigin())); } if (start_path_position > transformedpath.size()) { @@ -95,7 +95,8 @@ void LPEAttachPath::doEffect (SPCurve * curve) } else if (start_path_position < 0) { start_path_position.param_set_value(0); } - const Geom::Curve *c = start_path_position >= transformedpath.size() ? &transformedpath.back() : &transformedpath.at_index((int)start_path_position); + Geom::Curve const *c = start_path_position >= transformedpath.size() ? + &transformedpath.back() : &transformedpath.at((int)start_path_position); std::vector derivs_2 = c->pointAndDerivatives(start_path_position >= transformedpath.size() ? 1 : (start_path_position - (int)start_path_position), 3); for (unsigned deriv_n_2 = 1; deriv_n_2 < derivs_2.size(); deriv_n_2++) { @@ -126,7 +127,7 @@ void LPEAttachPath::doEffect (SPCurve * curve) if (end_path.linksToPath()) { - std::vector linked_pathv = end_path.get_pathvector(); + Geom::PathVector linked_pathv = end_path.get_pathvector(); Geom::Affine linkedtransform = end_path.getObject()->getRelativeTransform(sp_lpe_item); if ( !linked_pathv.empty() ) @@ -141,7 +142,7 @@ void LPEAttachPath::doEffect (SPCurve * curve) Geom::Coord length = derivs[deriv_n].length(); if ( ! Geom::are_near(length, 0) ) { if (set_end_end) { - end_path_position.param_set_value(transformedpath.nearestPoint(end_path_curve_end.getOrigin())); + end_path_position.param_set_value(transformedpath.nearestTime(end_path_curve_end.getOrigin())); } if (end_path_position > transformedpath.size()) { @@ -149,7 +150,8 @@ void LPEAttachPath::doEffect (SPCurve * curve) } else if (end_path_position < 0) { end_path_position.param_set_value(0); } - const Geom::Curve *c = end_path_position >= transformedpath.size() ? &transformedpath.back() : &transformedpath.at_index((int)end_path_position); + const Geom::Curve *c = end_path_position >= transformedpath.size() ? + &transformedpath.back() : &transformedpath.at((int)end_path_position); std::vector derivs_2 = c->pointAndDerivatives(end_path_position >= transformedpath.size() ? 1 : (end_path_position - (int)end_path_position), 3); for (unsigned deriv_n_2 = 1; deriv_n_2 < derivs_2.size(); deriv_n_2++) { diff --git a/src/live_effects/lpe-boolops.cpp b/src/live_effects/lpe-boolops.cpp deleted file mode 100644 index 641cf5d50..000000000 --- a/src/live_effects/lpe-boolops.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/** \file - * LPE boolops implementation - */ -/* - * Authors: - * Johan Engelen - * - * Copyright (C) Johan Engelen 2007-2008 - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include "live_effects/lpe-boolops.h" - -#include <2geom/path.h> -#include <2geom/shape.h> - -namespace Inkscape { -namespace LivePathEffect { - -static const Util::EnumData BoolopTypeData[] = { - {Geom::BOOLOP_NULL , N_("Null"), "null"}, - {Geom::BOOLOP_INTERSECT , N_("Intersect"), "intersect"}, - {Geom::BOOLOP_SUBTRACT_A_B , N_("Subtract A-B"), "subtract_a_b"}, - {Geom::BOOLOP_IDENTITY_A , N_("Identity A"), "identity_a"}, - {Geom::BOOLOP_SUBTRACT_B_A , N_("Subtract B-A"), "subtract_b_a"}, - {Geom::BOOLOP_IDENTITY_B , N_("Identity B"), "identity_b"}, - {Geom::BOOLOP_EXCLUSION , N_("Exclusion"), "Exclusion"}, - {Geom::BOOLOP_UNION , N_("Union"), "Union"} -}; -static const Util::EnumDataConverter BoolopTypeConverter(BoolopTypeData, sizeof(BoolopTypeData)/sizeof(*BoolopTypeData)); - -LPEBoolops::LPEBoolops(LivePathEffectObject *lpeobject) : - Effect(lpeobject), - bool_path(_("2nd path:"), _("Path to which the original path will be boolop'ed."), "path_2nd", &wr, this, "M0,0 L1,0"), - boolop_type(_("Boolop type:"), _("Determines which kind of boolop will be performed."), "boolop_type", BoolopTypeConverter, &wr, this, Geom::BOOLOP_UNION) -{ - show_orig_path = true; - - registerParameter( dynamic_cast(&boolop_type) ); - registerParameter( dynamic_cast(&bool_path) ); -} - -LPEBoolops::~LPEBoolops() -{ - -} - - -Geom::PathVector -LPEBoolops::doEffect_path (Geom::PathVector const & path_in) -{ - std::vector path_out; - - Geom::Shape shape_in = Geom::sanitize(path_in); - - Geom::Shape shape_param = Geom::sanitize(bool_path.get_pathvector()); - - Geom::Shape shape_out = Geom::boolop(shape_in, shape_param, boolop_type.get_value()); - - path_out = Geom::desanitize(shape_out); - - return path_out; -} - - -} //namespace LivePathEffect -} /* namespace Inkscape */ - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/live_effects/lpe-boolops.h b/src/live_effects/lpe-boolops.h deleted file mode 100644 index 3c8dc85c4..000000000 --- a/src/live_effects/lpe-boolops.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef INKSCAPE_LPE_BOOLOPS_H -#define INKSCAPE_LPE_BOOLOPS_H - -/** \file - * LPE boolops implementation, see lpe-boolops.cpp. - */ - -/* - * Authors: - * Johan Engelen - * - * Copyright (C) Johan Engelen 2007-2008 - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include "live_effects/parameter/enum.h" -#include "live_effects/effect.h" -#include "live_effects/parameter/path.h" - -namespace Inkscape { -namespace LivePathEffect { - -class LPEBoolops : public Effect { -public: - LPEBoolops(LivePathEffectObject *lpeobject); - virtual ~LPEBoolops(); - - virtual std::vector doEffect_path (std::vector const & path_in); - -private: - PathParam bool_path; - EnumParam boolop_type; - - LPEBoolops(const LPEBoolops&); - LPEBoolops& operator=(const LPEBoolops&); -}; - -} //namespace LivePathEffect -} //namespace Inkscape - -#endif // INKSCAPE_LPE_BOOLOPS_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/live_effects/lpe-bounding-box.cpp b/src/live_effects/lpe-bounding-box.cpp index bafd5e70e..43a60d482 100644 --- a/src/live_effects/lpe-bounding-box.cpp +++ b/src/live_effects/lpe-bounding-box.cpp @@ -45,7 +45,7 @@ void LPEBoundingBox::doEffect (SPCurve * curve) p.appendNew(Geom::Point(bbox->right(), bbox->bottom())); p.appendNew(Geom::Point(bbox->left(), bbox->bottom())); p.appendNew(Geom::Point(bbox->left(), bbox->top())); - std::vector out; + Geom::PathVector out; out.push_back(p); curve->set_pathvector(out); } diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index ecbfef76a..e5389684a 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -121,12 +121,12 @@ void LPEBSpline::doEffect(SPCurve *curve) if(are_near((*cubic)[1],(*cubic)[0]) && !are_near((*cubic)[2],(*cubic)[3])) { point_at1 = sbasis_in.valueAt(DEFAULT_START_POWER); } else { - point_at1 = sbasis_in.valueAt(Geom::nearest_point((*cubic)[1], *in->first_segment())); + point_at1 = sbasis_in.valueAt(Geom::nearest_time((*cubic)[1], *in->first_segment())); } if(are_near((*cubic)[2],(*cubic)[3]) && !are_near((*cubic)[1],(*cubic)[0])) { point_at2 = sbasis_in.valueAt(DEFAULT_END_POWER); } else { - point_at2 = sbasis_in.valueAt(Geom::nearest_point((*cubic)[2], *in->first_segment())); + point_at2 = sbasis_in.valueAt(Geom::nearest_time((*cubic)[2], *in->first_segment())); } } else { point_at1 = in->first_segment()->initialPoint(); @@ -144,7 +144,7 @@ void LPEBSpline::doEffect(SPCurve *curve) if(are_near((*cubic)[1],(*cubic)[0]) && !are_near((*cubic)[2],(*cubic)[3])) { next_point_at1 = sbasis_in.valueAt(DEFAULT_START_POWER); } else { - next_point_at1 = sbasis_out.valueAt(Geom::nearest_point((*cubic)[1], *out->first_segment())); + next_point_at1 = sbasis_out.valueAt(Geom::nearest_time((*cubic)[1], *out->first_segment())); } } else { next_point_at1 = out->first_segment()->initialPoint(); @@ -161,7 +161,7 @@ void LPEBSpline::doEffect(SPCurve *curve) cubic = dynamic_cast(&*path_it->begin()); if (cubic) { line_helper->moveto(sbasis_start.valueAt( - Geom::nearest_point((*cubic)[1], *start->first_segment()))); + Geom::nearest_time((*cubic)[1], *start->first_segment()))); } else { line_helper->moveto(start->first_segment()->initialPoint()); } @@ -175,7 +175,7 @@ void LPEBSpline::doEffect(SPCurve *curve) cubic = dynamic_cast(&*curve_it1); if (cubic) { line_helper->lineto(sbasis_end.valueAt( - Geom::nearest_point((*cubic)[2], *end->first_segment()))); + Geom::nearest_time((*cubic)[2], *end->first_segment()))); } else { line_helper->lineto(end->first_segment()->finalPoint()); } @@ -233,7 +233,7 @@ LPEBSpline::drawHandle(Geom::Point p, double helper_size) Geom::Affine aff = Geom::Affine(); aff *= Geom::Scale(helper_size); pathv *= aff; - pathv += p - Geom::Point(0.5*helper_size, 0.5*helper_size); + pathv *= Geom::Translate(p - Geom::Point(0.5*helper_size, 0.5*helper_size)); hp.push_back(pathv[0]); } diff --git a/src/live_effects/lpe-circle_3pts.cpp b/src/live_effects/lpe-circle_3pts.cpp index fb7496f58..cbabb5a6c 100644 --- a/src/live_effects/lpe-circle_3pts.cpp +++ b/src/live_effects/lpe-circle_3pts.cpp @@ -30,7 +30,7 @@ LPECircle3Pts::~LPECircle3Pts() { } -static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point const &C, std::vector &path_out) { +static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point const &C, Geom::PathVector &path_out) { using namespace Geom; Point D = (A + B)/2; @@ -50,10 +50,10 @@ static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point con c.getPath(path_out); } -std::vector -LPECircle3Pts::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPECircle3Pts::doEffect_path (Geom::PathVector const & path_in) { - std::vector path_out = std::vector(); + Geom::PathVector path_out = Geom::PathVector(); // we assume that the path has >= 3 nodes Geom::Point A = path_in[0].initialPoint(); diff --git a/src/live_effects/lpe-circle_3pts.h b/src/live_effects/lpe-circle_3pts.h index 2533fe251..07c2eddb0 100644 --- a/src/live_effects/lpe-circle_3pts.h +++ b/src/live_effects/lpe-circle_3pts.h @@ -27,7 +27,7 @@ public: LPECircle3Pts(LivePathEffectObject *lpeobject); virtual ~LPECircle3Pts(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); private: LPECircle3Pts(const LPECircle3Pts&); diff --git a/src/live_effects/lpe-circle_with_radius.cpp b/src/live_effects/lpe-circle_with_radius.cpp index 8a32cd230..32d0c0bf5 100644 --- a/src/live_effects/lpe-circle_with_radius.cpp +++ b/src/live_effects/lpe-circle_with_radius.cpp @@ -40,10 +40,10 @@ LPECircleWithRadius::~LPECircleWithRadius() } -std::vector -LPECircleWithRadius::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPECircleWithRadius::doEffect_path (Geom::PathVector const & path_in) { - std::vector path_out = std::vector(); + Geom::PathVector path_out = Geom::PathVector(); Geom::Point center = path_in[0].initialPoint(); Geom::Point pt = path_in[0].finalPoint(); diff --git a/src/live_effects/lpe-circle_with_radius.h b/src/live_effects/lpe-circle_with_radius.h index 10f652771..f5bf0c414 100644 --- a/src/live_effects/lpe-circle_with_radius.h +++ b/src/live_effects/lpe-circle_with_radius.h @@ -26,7 +26,7 @@ public: virtual ~LPECircleWithRadius(); // Choose to implement one of the doEffect functions. You can delete or comment out the others. - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); private: // add the parameters for your effect here: diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp index d7cd6e19c..7541c0be2 100644 --- a/src/live_effects/lpe-clone-original.cpp +++ b/src/live_effects/lpe-clone-original.cpp @@ -28,7 +28,7 @@ LPECloneOriginal::~LPECloneOriginal() void LPECloneOriginal::doEffect (SPCurve * curve) { if ( linked_path.linksToPath() ) { - std::vector linked_pathv = linked_path.get_pathvector(); + Geom::PathVector linked_pathv = linked_path.get_pathvector(); if ( !linked_pathv.empty() ) { curve->set_pathvector(linked_pathv); } diff --git a/src/live_effects/lpe-constructgrid.cpp b/src/live_effects/lpe-constructgrid.cpp index fbf9faf56..b1e0edaac 100644 --- a/src/live_effects/lpe-constructgrid.cpp +++ b/src/live_effects/lpe-constructgrid.cpp @@ -41,8 +41,8 @@ LPEConstructGrid::~LPEConstructGrid() } -std::vector -LPEConstructGrid::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPEConstructGrid::doEffect_path (Geom::PathVector const & path_in) { // Check that the path has at least 3 nodes (i.e. 2 segments), more nodes are ignored if (path_in[0].size() >= 2) { @@ -64,7 +64,7 @@ LPEConstructGrid::doEffect_path (std::vector const & path_in) second_path.appendNew( origin + second_p*nr_x ); // use the gridpaths and set them in the correct grid - std::vector path_out; + Geom::PathVector path_out; path_out.push_back(first_path); for (int ix = 0; ix < nr_x; ix++) { path_out.push_back(path_out.back() * second_translation ); diff --git a/src/live_effects/lpe-constructgrid.h b/src/live_effects/lpe-constructgrid.h index c7e695794..49c986742 100644 --- a/src/live_effects/lpe-constructgrid.h +++ b/src/live_effects/lpe-constructgrid.h @@ -25,7 +25,7 @@ public: LPEConstructGrid(LivePathEffectObject *lpeobject); virtual ~LPEConstructGrid(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); private: ScalarParam nr_x; diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp index 854cc0734..609447f26 100644 --- a/src/live_effects/lpe-curvestitch.cpp +++ b/src/live_effects/lpe-curvestitch.cpp @@ -68,8 +68,8 @@ LPECurveStitch::~LPECurveStitch() } -std::vector -LPECurveStitch::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPECurveStitch::doEffect_path (Geom::PathVector const & path_in) { if (path_in.size() >= 2) { startpoint_edge_variation.resetRandomizer(); @@ -86,7 +86,7 @@ LPECurveStitch::doEffect_path (std::vector const & path_in) gdouble scaling = bndsStroke->max() - bndsStroke->min(); Point stroke_origin(bndsStroke->min(), (bndsStrokeY->max()+bndsStrokeY->min())/2); - std::vector path_out; + Geom::PathVector path_out; // do this for all permutations (ii,jj) if there are more than 2 paths? realllly cool! for (unsigned ii = 0 ; ii < path_in.size() - 1; ii++) @@ -127,7 +127,7 @@ LPECurveStitch::doEffect_path (std::vector const & path_in) // add stuff to one big pw > and then outside the loop convert to path? // No: this way, the separate result paths are kept separate which might come in handy some time! - std::vector result = Geom::path_from_piecewise(pwd2_out, LPE_CONVERSION_TOLERANCE); + Geom::PathVector result = Geom::path_from_piecewise(pwd2_out, LPE_CONVERSION_TOLERANCE); path_out.push_back(result[0]); } gdouble svA = startpoint_spacing_variation - startpoint_spacing_variation.get_value()/2; @@ -162,7 +162,7 @@ LPECurveStitch::resetDefaults(SPItem const* item) // calculate bounding box: (isn't there a simpler way?) Piecewise > pwd2; - std::vector temppath = sp_svg_read_pathv( item->getRepr()->attribute("inkscape:original-d")); + Geom::PathVector temppath = sp_svg_read_pathv( item->getRepr()->attribute("inkscape:original-d")); for (unsigned int i=0; i < temppath.size(); i++) { pwd2.concat( temppath[i].toPwSb() ); } diff --git a/src/live_effects/lpe-curvestitch.h b/src/live_effects/lpe-curvestitch.h index 38a11b4af..c6ea66f6c 100644 --- a/src/live_effects/lpe-curvestitch.h +++ b/src/live_effects/lpe-curvestitch.h @@ -28,7 +28,7 @@ public: LPECurveStitch(LivePathEffectObject *lpeobject); virtual ~LPECurveStitch(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); virtual void resetDefaults(SPItem const* item); diff --git a/src/live_effects/lpe-ellipse_5pts.cpp b/src/live_effects/lpe-ellipse_5pts.cpp index b0a5919fe..4c953bcda 100644 --- a/src/live_effects/lpe-ellipse_5pts.cpp +++ b/src/live_effects/lpe-ellipse_5pts.cpp @@ -67,10 +67,10 @@ static double _det5(double (*mat)[5]) return mat[4][4]; } -std::vector -LPEEllipse5Pts::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPEEllipse5Pts::doEffect_path (Geom::PathVector const & path_in) { - std::vector path_out = std::vector(); + Geom::PathVector path_out = Geom::PathVector(); if (path_in[0].size() < 4) { @@ -190,7 +190,7 @@ LPEEllipse5Pts::doEffect_path (std::vector const & path_in) p.appendNew(Geom::Point(x1,y1), Geom::Point(x2,y2), Geom::Point(x3,y3)); } - Geom::Affine aff = Geom::Scale(el.ray(Geom::X), el.ray(Geom::Y)) * Geom::Rotate(el.rot_angle()) * Geom::Translate(el.center()); + Geom::Affine aff = Geom::Scale(el.rays()) * Geom::Rotate(el.rotationAngle()) * Geom::Translate(el.center()); path_out.push_back(p * aff); diff --git a/src/live_effects/lpe-ellipse_5pts.h b/src/live_effects/lpe-ellipse_5pts.h index d3b1fccfa..691a693dc 100644 --- a/src/live_effects/lpe-ellipse_5pts.h +++ b/src/live_effects/lpe-ellipse_5pts.h @@ -26,7 +26,7 @@ public: LPEEllipse5Pts(LivePathEffectObject *lpeobject); virtual ~LPEEllipse5Pts(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); private: LPEEllipse5Pts(const LPEEllipse5Pts&); diff --git a/src/live_effects/lpe-fill-between-many.cpp b/src/live_effects/lpe-fill-between-many.cpp index 7cf354044..3e0810cfc 100644 --- a/src/live_effects/lpe-fill-between-many.cpp +++ b/src/live_effects/lpe-fill-between-many.cpp @@ -35,14 +35,14 @@ LPEFillBetweenMany::~LPEFillBetweenMany() void LPEFillBetweenMany::doEffect (SPCurve * curve) { - std::vector res_pathv; + Geom::PathVector res_pathv; SPItem * firstObj = NULL; for (std::vector::iterator iter = linked_paths._vector.begin(); iter != linked_paths._vector.end(); iter++) { SPObject *obj; if ((*iter)->ref.isAttached() && (obj = (*iter)->ref.getObject()) && SP_IS_ITEM(obj) && !(*iter)->_pathvector.empty()) { Geom::Path linked_path; if ((*iter)->reversed) { - linked_path = (*iter)->_pathvector.front().reverse(); + linked_path = (*iter)->_pathvector.front().reversed(); } else { linked_path = (*iter)->_pathvector.front(); } diff --git a/src/live_effects/lpe-fill-between-strokes.cpp b/src/live_effects/lpe-fill-between-strokes.cpp index e72979ed0..89ea80545 100644 --- a/src/live_effects/lpe-fill-between-strokes.cpp +++ b/src/live_effects/lpe-fill-between-strokes.cpp @@ -39,17 +39,17 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve) { if (curve) { if ( linked_path.linksToPath() && second_path.linksToPath() && linked_path.getObject() && second_path.getObject() ) { - std::vector linked_pathv = linked_path.get_pathvector(); - std::vector second_pathv = second_path.get_pathvector(); - std::vector result_linked_pathv; - std::vector result_second_pathv; + Geom::PathVector linked_pathv = linked_path.get_pathvector(); + Geom::PathVector second_pathv = second_path.get_pathvector(); + Geom::PathVector result_linked_pathv; + Geom::PathVector result_second_pathv; Geom::Affine second_transform = second_path.getObject()->getRelativeTransform(linked_path.getObject()); - for (std::vector::iterator iter = linked_pathv.begin(); iter != linked_pathv.end(); ++iter) + for (Geom::PathVector::iterator iter = linked_pathv.begin(); iter != linked_pathv.end(); ++iter) { result_linked_pathv.push_back((*iter)); } - for (std::vector::iterator iter = second_pathv.begin(); iter != second_pathv.end(); ++iter) + for (Geom::PathVector::iterator iter = second_pathv.begin(); iter != second_pathv.end(); ++iter) { result_second_pathv.push_back((*iter) * second_transform); } @@ -58,7 +58,7 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve) if (reverse_second.get_value()) { result_linked_pathv.front().appendNew(result_second_pathv.front().finalPoint()); - result_linked_pathv.front().append(result_second_pathv.front().reverse()); + result_linked_pathv.front().append(result_second_pathv.front().reversed()); } else { @@ -75,10 +75,10 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve) } } else if ( linked_path.linksToPath() && linked_path.getObject() ) { - std::vector linked_pathv = linked_path.get_pathvector(); - std::vector result_pathv; + Geom::PathVector linked_pathv = linked_path.get_pathvector(); + Geom::PathVector result_pathv; - for (std::vector::iterator iter = linked_pathv.begin(); iter != linked_pathv.end(); ++iter) + for (Geom::PathVector::iterator iter = linked_pathv.begin(); iter != linked_pathv.end(); ++iter) { result_pathv.push_back((*iter)); } @@ -87,10 +87,10 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve) } } else if ( second_path.linksToPath() && second_path.getObject() ) { - std::vector second_pathv = second_path.get_pathvector(); - std::vector result_pathv; + Geom::PathVector second_pathv = second_path.get_pathvector(); + Geom::PathVector result_pathv; - for (std::vector::iterator iter = second_pathv.begin(); iter != second_pathv.end(); ++iter) + for (Geom::PathVector::iterator iter = second_pathv.begin(); iter != second_pathv.end(); ++iter) { result_pathv.push_back((*iter)); } diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index c8458b8cb..c03312ce2 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -275,11 +275,11 @@ void LPEFilletChamfer::refreshKnots() } } -void LPEFilletChamfer::doUpdateFillet(std::vector const& original_pathv, double power) +void LPEFilletChamfer::doUpdateFillet(Geom::PathVector const &original_pathv, double power) { std::vector filletChamferData = fillet_chamfer_values.data(); std::vector result; - std::vector original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv); + Geom::PathVector original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv); int counter = 0; for (PathVector::const_iterator path_it = original_pathv_processed.begin(); path_it != original_pathv_processed.end(); ++path_it) { @@ -323,11 +323,11 @@ void LPEFilletChamfer::doUpdateFillet(std::vector const& original_pa fillet_chamfer_values.param_set_and_write_new_value(result); } -void LPEFilletChamfer::doChangeType(std::vector const& original_pathv, int type) +void LPEFilletChamfer::doChangeType(Geom::PathVector const &original_pathv, int type) { std::vector filletChamferData = fillet_chamfer_values.data(); std::vector result; - std::vector original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv); + Geom::PathVector original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv); int counter = 0; for (PathVector::const_iterator path_it = original_pathv_processed.begin(); path_it != original_pathv_processed.end(); ++path_it) { int pathCounter = 0; @@ -466,7 +466,7 @@ int LPEFilletChamfer::getKnotsNumber(SPCurve const *c) { int nKnots = c->nodes_in_path(); PathVector const pv = pathv_to_linear_and_cubic_beziers(c->get_pathvector()); - for (std::vector::const_iterator path_it = pv.begin(); + for (Geom::PathVector::const_iterator path_it = pv.begin(); path_it != pv.end(); ++path_it) { if (!(*path_it).closed()) { nKnots--; @@ -476,17 +476,17 @@ int LPEFilletChamfer::getKnotsNumber(SPCurve const *c) } void -LPEFilletChamfer::adjustForNewPath(std::vector const &path_in) +LPEFilletChamfer::adjustForNewPath(Geom::PathVector const &path_in) { if (!path_in.empty()) { fillet_chamfer_values.recalculate_controlpoints_for_new_pwd2(pathv_to_linear_and_cubic_beziers(path_in)[0].toPwSb()); } } -std::vector -LPEFilletChamfer::doEffect_path(std::vector const &path_in) +Geom::PathVector +LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) { - std::vector pathvector_out; + Geom::PathVector pathvector_out; Piecewise > pwd2_in = paths_to_pw(pathv_to_linear_and_cubic_beziers(path_in)); pwd2_in = remove_short_cuts(pwd2_in, .01); Piecewise > der = derivative(pwd2_in); @@ -495,7 +495,7 @@ LPEFilletChamfer::doEffect_path(std::vector const &path_in) std::vector filletChamferData = fillet_chamfer_values.data(); unsigned int counter = 0; const double K = (4.0 / 3.0) * (sqrt(2.0) - 1.0); - std::vector path_in_processed = pathv_to_linear_and_cubic_beziers(path_in); + Geom::PathVector path_in_processed = pathv_to_linear_and_cubic_beziers(path_in); for (PathVector::const_iterator path_it = path_in_processed.begin(); path_it != path_in_processed.end(); ++path_it) { if (path_it->empty()) diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h index 0d6a1ff17..6da12cce7 100644 --- a/src/live_effects/lpe-fillet-chamfer.h +++ b/src/live_effects/lpe-fillet-chamfer.h @@ -45,11 +45,11 @@ public: LPEFilletChamfer(LivePathEffectObject *lpeobject); virtual ~LPEFilletChamfer(); - virtual std::vector doEffect_path(std::vector const &path_in); + virtual Geom::PathVector doEffect_path(Geom::PathVector const &path_in); virtual void doOnApply(SPLPEItem const *lpeItem); virtual void doBeforeEffect(SPLPEItem const *lpeItem); - virtual void adjustForNewPath(std::vector const &path_in); + virtual void adjustForNewPath(Geom::PathVector const &path_in); virtual Gtk::Widget* newWidget(); int getKnotsNumber(SPCurve const *c); @@ -61,8 +61,8 @@ public: void fillet(); void inverseFillet(); void updateFillet(); - void doUpdateFillet(std::vector const& original_pathv, double power); - void doChangeType(std::vector const& original_pathv, int type); + void doUpdateFillet(Geom::PathVector const& original_pathv, double power); + void doChangeType(Geom::PathVector const& original_pathv, int type); void refreshKnots(); FilletChamferPointArrayParam fillet_chamfer_values; diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp index 003e22567..903dfd716 100644 --- a/src/live_effects/lpe-gears.cpp +++ b/src/live_effects/lpe-gears.cpp @@ -232,10 +232,10 @@ LPEGears::~LPEGears() } -std::vector -LPEGears::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPEGears::doEffect_path (Geom::PathVector const &path_in) { - std::vector path_out; + Geom::PathVector path_out; Geom::Path gearpath = path_in[0]; Geom::Path::iterator it(gearpath.begin()); diff --git a/src/live_effects/lpe-gears.h b/src/live_effects/lpe-gears.h index bd5e4c4f9..5dd6dd239 100644 --- a/src/live_effects/lpe-gears.h +++ b/src/live_effects/lpe-gears.h @@ -22,7 +22,7 @@ public: LPEGears(LivePathEffectObject *lpeobject); virtual ~LPEGears(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path(Geom::PathVector const &path_in); private: ScalarParam teeth; diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp index e41bc6f0e..b1ad07d23 100644 --- a/src/live_effects/lpe-interpolate.cpp +++ b/src/live_effects/lpe-interpolate.cpp @@ -61,7 +61,7 @@ LPEInterpolate::doEffect_path (Geom::PathVector const & path_in) return path_in; } - std::vector path_out; + Geom::PathVector path_out; Geom::Piecewise > pwd2_A = path_in[0].toPwSb(); Geom::Piecewise > pwd2_B = path_in[1].toPwSb(); diff --git a/src/live_effects/lpe-interpolate.h b/src/live_effects/lpe-interpolate.h index 679001a81..ef8043e46 100644 --- a/src/live_effects/lpe-interpolate.h +++ b/src/live_effects/lpe-interpolate.h @@ -27,7 +27,7 @@ public: LPEInterpolate(LivePathEffectObject *lpeobject); virtual ~LPEInterpolate(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); virtual void resetDefaults(SPItem const* item); private: diff --git a/src/live_effects/lpe-interpolate_points.h b/src/live_effects/lpe-interpolate_points.h index 7a3364747..eb706a320 100644 --- a/src/live_effects/lpe-interpolate_points.h +++ b/src/live_effects/lpe-interpolate_points.h @@ -25,7 +25,7 @@ public: LPEInterpolatePoints(LivePathEffectObject *lpeobject); virtual ~LPEInterpolatePoints(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); private: EnumParam interpolator_type; diff --git a/src/live_effects/lpe-jointype.cpp b/src/live_effects/lpe-jointype.cpp index 0111a0f99..893f3ab4e 100644 --- a/src/live_effects/lpe-jointype.cpp +++ b/src/live_effects/lpe-jointype.cpp @@ -150,7 +150,7 @@ void LPEJoinType::doOnRemove(SPLPEItem const* lpeitem) } } -std::vector LPEJoinType::doEffect_path(std::vector const & path_in) +Geom::PathVector LPEJoinType::doEffect_path(Geom::PathVector const & path_in) { Geom::PathVector ret; for (size_t i = 0; i < path_in.size(); ++i) { diff --git a/src/live_effects/lpe-jointype.h b/src/live_effects/lpe-jointype.h index bca0961c9..fddaeb619 100644 --- a/src/live_effects/lpe-jointype.h +++ b/src/live_effects/lpe-jointype.h @@ -24,7 +24,7 @@ public: virtual void doOnApply(SPLPEItem const* lpeitem); virtual void doOnRemove(SPLPEItem const* lpeitem); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); private: LPEJoinType(const LPEJoinType&); diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 820221abf..84e4deda7 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -155,7 +155,7 @@ findShadowedTime(Geom::Path const &patha, std::vector const &pt_and // -for each component, the time at which this crossing occurs + the order of this crossing along the component (when starting from 0). namespace LPEKnotNS {//just in case... -CrossingPoints::CrossingPoints(std::vector const &paths) : std::vector(){ +CrossingPoints::CrossingPoints(Geom::PathVector const &paths) : std::vector(){ // std::cout<<"\nCrossingPoints creation from path vector\n"; for( unsigned i=0; i -LPEKnot::doEffect_path (std::vector const &path_in) +Geom::PathVector +LPEKnot::doEffect_path (Geom::PathVector const &path_in) { using namespace Geom; - std::vector path_out; + Geom::PathVector path_out; if (gpaths.size()==0){ return path_in; @@ -486,8 +486,9 @@ LPEKnot::doEffect_path (std::vector const &path_in) ++beg_comp; --end_comp; Path first = gpaths[i0].portion(dom.back()); - //FIXME: STITCH_DISCONTINUOUS should not be necessary (?!?) - first.append(gpaths[i0].portion(dom.front()), Path::STITCH_DISCONTINUOUS); + //FIXME: stitching should not be necessary (?!?) + first.setStitching(true); + first.append(gpaths[i0].portion(dom.front())); path_out.push_back(first); } } @@ -503,7 +504,7 @@ LPEKnot::doEffect_path (std::vector const &path_in) //recursively collect gpaths and stroke widths (stolen from "sp-lpe_item.cpp"). static void -collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector &paths, std::vector &stroke_widths){ +collectPathsAndWidths (SPLPEItem const *lpeitem, Geom::PathVector &paths, std::vector &stroke_widths){ if (SP_IS_GROUP(lpeitem)) { GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( GSList const *iter = item_list; iter; iter = iter->next ) { @@ -615,8 +616,7 @@ LPEKnot::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector{ public: CrossingPoints() : std::vector() {} - CrossingPoints(Geom::CrossingSet const &cs, std::vector const &path);//for self crossings only! - CrossingPoints(std::vector const &paths); + CrossingPoints(Geom::CrossingSet const &cs, Geom::PathVector const &path);//for self crossings only! + CrossingPoints(Geom::PathVector const &paths); CrossingPoints(std::vector const &input); std::vector to_vector(); CrossingPoint get(unsigned const i, unsigned const ni); @@ -57,7 +57,7 @@ public: virtual ~LPEKnot(); virtual void doBeforeEffect (SPLPEItem const* lpeitem); - virtual std::vector doEffect_path (std::vector const & input_path); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & input_path); /* the knotholder entity classes must be declared friends */ friend class KnotHolderEntityCrossingSwitcher; @@ -65,7 +65,7 @@ public: protected: virtual void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector &hp_vec); - std::vector supplied_path; //for knotholder business + Geom::PathVector supplied_path; //for knotholder business private: void updateSwitcher(); @@ -79,7 +79,7 @@ private: LPEKnotNS::CrossingPoints crossing_points;//topology representation of the knot. - std::vector gpaths;//the collection of all the paths in the object or group. + Geom::PathVector gpaths;//the collection of all the paths in the object or group. std::vector gstroke_widths;//the collection of all the stroke widths in the object or group. //UI: please, someone, help me to improve this!! diff --git a/src/live_effects/lpe-lattice2.cpp b/src/live_effects/lpe-lattice2.cpp index abd6e7786..51453357b 100644 --- a/src/live_effects/lpe-lattice2.cpp +++ b/src/live_effects/lpe-lattice2.cpp @@ -289,7 +289,7 @@ LPELattice2::vertical(PointParam ¶m_one, PointParam ¶m_two, Geom::Line v double Y = (A[Geom::Y] + B[Geom::Y])/2; A[Geom::Y] = Y; B[Geom::Y] = Y; - Geom::Point nearest = vert.pointAt(vert.nearestPoint(A)); + Geom::Point nearest = vert.pointAt(vert.nearestTime(A)); double distance_one = Geom::distance(A,nearest); double distance_two = Geom::distance(B,nearest); double distance_middle = (distance_one + distance_two)/2; @@ -310,7 +310,7 @@ LPELattice2::horizontal(PointParam ¶m_one, PointParam ¶m_two, Geom::Line double X = (A[Geom::X] + B[Geom::X])/2; A[Geom::X] = X; B[Geom::X] = X; - Geom::Point nearest = horiz.pointAt(horiz.nearestPoint(A)); + Geom::Point nearest = horiz.pointAt(horiz.nearestTime(A)); double distance_one = Geom::distance(A,nearest); double distance_two = Geom::distance(B,nearest); double distance_middle = (distance_one + distance_two)/2; diff --git a/src/live_effects/lpe-line_segment.cpp b/src/live_effects/lpe-line_segment.cpp index 78d286143..dfd8aea8f 100644 --- a/src/live_effects/lpe-line_segment.cpp +++ b/src/live_effects/lpe-line_segment.cpp @@ -48,16 +48,16 @@ LPELineSegment::doBeforeEffect (SPLPEItem const* lpeitem) Inkscape::UI::Tools::lpetool_get_limiting_bbox_corners(lpeitem->document, bboxA, bboxB); } -std::vector -LPELineSegment::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPELineSegment::doEffect_path (Geom::PathVector const & path_in) { - std::vector output; + Geom::PathVector output; - A = initialPoint(path_in); - B = finalPoint(path_in); + A = path_in.initialPoint(); + B = path_in.finalPoint(); Geom::Rect dummyRect(bboxA, bboxB); - boost::optional intersection_segment = Geom::rect_line_intersect(dummyRect, Geom::Line(A, B)); + boost::optional intersection_segment = Geom::Line(A, B).clip(dummyRect); if (!intersection_segment) { g_print ("Possible error - no intersection with limiting bounding box.\n"); @@ -65,11 +65,11 @@ LPELineSegment::doEffect_path (std::vector const & path_in) } if (end_type == END_OPEN_INITIAL || end_type == END_OPEN_BOTH) { - A = (*intersection_segment).initialPoint(); + A = intersection_segment->initialPoint(); } if (end_type == END_OPEN_FINAL || end_type == END_OPEN_BOTH) { - B = (*intersection_segment).finalPoint(); + B = intersection_segment->finalPoint(); } Geom::Path path(A); diff --git a/src/live_effects/lpe-line_segment.h b/src/live_effects/lpe-line_segment.h index 1a57688b6..def828fe2 100644 --- a/src/live_effects/lpe-line_segment.h +++ b/src/live_effects/lpe-line_segment.h @@ -34,7 +34,7 @@ public: virtual void doBeforeEffect (SPLPEItem const* lpeitem); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); //private: EnumParam end_type; diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index 0bb67a4a2..783053df2 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -64,24 +64,24 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem const* lpeitem) Point B(bbox.left(), bbox.top()); A *= t; B *= t; - Piecewise > rline = Piecewise >(D2(Linear(A[X], B[X]), Linear(A[Y], B[Y]))); + Piecewise > rline = Piecewise >(D2(SBasis(A[X], B[X]), SBasis(A[Y], B[Y]))); reflection_line.set_new_value(rline, true); } -std::vector -LPEMirrorSymmetry::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPEMirrorSymmetry::doEffect_path (Geom::PathVector const & path_in) { // Don't allow empty path parameter: if ( reflection_line.get_pathvector().empty() ) { return path_in; } - std::vector path_out; + Geom::PathVector path_out; if (!discard_orig_path) { path_out = path_in; } - std::vector mline(reflection_line.get_pathvector()); + Geom::PathVector mline(reflection_line.get_pathvector()); Geom::Point A(mline.front().initialPoint()); Geom::Point B(mline.back().finalPoint()); diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h index a4a2b86c0..7a484a473 100644 --- a/src/live_effects/lpe-mirror_symmetry.h +++ b/src/live_effects/lpe-mirror_symmetry.h @@ -32,7 +32,7 @@ public: virtual void doBeforeEffect (SPLPEItem const* lpeitem); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); private: BoolParam discard_orig_path; diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp index ba7179476..c841a5442 100644 --- a/src/live_effects/lpe-offset.cpp +++ b/src/live_effects/lpe-offset.cpp @@ -72,7 +72,7 @@ LPEOffset::doEffect_pwd2 (Geom::Piecewise > const & pwd2_ Piecewise > output; - double t = nearest_point(offset_pt, pwd2_in); + double t = nearest_time(offset_pt, pwd2_in); Point A = pwd2_in.valueAt(t); double offset = L2(A - offset_pt); diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp index aa7405607..23cd5e2e7 100644 --- a/src/live_effects/lpe-parallel.cpp +++ b/src/live_effects/lpe-parallel.cpp @@ -91,7 +91,7 @@ LPEParallel::doEffect_pwd2 (Geom::Piecewise > const & pwd C = offset_pt - dir * length_left; D = offset_pt + dir * length_right; - output = Piecewise >(D2(Linear(C[X], D[X]), Linear(C[Y], D[Y]))); + output = Piecewise >(D2(SBasis(C[X], D[X]), SBasis(C[Y], D[Y]))); return output + dir; } diff --git a/src/live_effects/lpe-perp_bisector.cpp b/src/live_effects/lpe-perp_bisector.cpp index feed55b26..660318c57 100644 --- a/src/live_effects/lpe-perp_bisector.cpp +++ b/src/live_effects/lpe-perp_bisector.cpp @@ -67,7 +67,7 @@ KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, guint state, bool le Geom::Point const s = snap_knot_position(p, state); - double lambda = Geom::nearest_point(s, lpe->M, lpe->perp_dir); + double lambda = Geom::nearest_time(s, lpe->M, lpe->perp_dir); if (left) { lpe->C = lpe->M + lpe->perp_dir * lambda; lpe->length_left.param_set_value(lambda); @@ -146,7 +146,7 @@ LPEPerpBisector::doEffect_pwd2 (Geom::Piecewise > const & C = M + perp_dir * length_left; D = M - perp_dir * length_right; - output = Piecewise >(D2(Linear(C[X], D[X]), Linear(C[Y], D[Y]))); + output = Piecewise >(D2(SBasis(C[X], D[X]), SBasis(C[Y], D[Y]))); return output; } diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp index 08100bb2d..72c1b0e99 100644 --- a/src/live_effects/lpe-perspective-envelope.cpp +++ b/src/live_effects/lpe-perspective-envelope.cpp @@ -323,7 +323,7 @@ LPEPerspectiveEnvelope::vertical(PointParam ¶m_one, PointParam ¶m_two, G double Y = (A[Geom::Y] + B[Geom::Y])/2; A[Geom::Y] = Y; B[Geom::Y] = Y; - Geom::Point nearest = vert.pointAt(vert.nearestPoint(A)); + Geom::Point nearest = vert.pointAt(vert.nearestTime(A)); double distance_one = Geom::distance(A,nearest); double distance_two = Geom::distance(B,nearest); double distance_middle = (distance_one + distance_two)/2; @@ -344,7 +344,7 @@ LPEPerspectiveEnvelope::horizontal(PointParam ¶m_one, PointParam ¶m_two, double X = (A[Geom::X] + B[Geom::X])/2; A[Geom::X] = X; B[Geom::X] = X; - Geom::Point nearest = horiz.pointAt(horiz.nearestPoint(A)); + Geom::Point nearest = horiz.pointAt(horiz.nearestTime(A)); double distance_one = Geom::distance(A,nearest); double distance_two = Geom::distance(B,nearest); double distance_middle = (distance_one + distance_two)/2; diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 5d9d224e8..e6644c7e9 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -106,9 +106,9 @@ static int circle_circle_intersection(Circle const &circle0, Circle const &circl Point & p0, Point & p1) { Point X0 = circle0.center(); - double r0 = circle0.ray(); + double r0 = circle0.radius(); Point X1 = circle1.center(); - double r1 = circle1.ray(); + double r1 = circle1.radius(); /* dx and dy are the vertical and horizontal distances between * the circle centers. @@ -313,7 +313,7 @@ LPEPowerStroke::doOnApply(SPLPEItem const* lpeitem) Geom::Path const &path = pathv.front(); Geom::Path::size_type const size = path.size_default(); if (!path.closed()) { - points.push_back( Geom::Point(0.2,width) ); + points.push_back( Geom::Point(0.2,width) ); } points.push_back( Geom::Point(0.5*size,width) ); if (!path.closed()) { @@ -362,7 +362,7 @@ void LPEPowerStroke::doOnRemove(SPLPEItem const* lpeitem) } void -LPEPowerStroke::adjustForNewPath(std::vector const & path_in) +LPEPowerStroke::adjustForNewPath(Geom::PathVector const & path_in) { if (!path_in.empty()) { offset_points.recalculate_controlpoints_for_new_pwd2(path_in[0].toPwSb()); @@ -387,6 +387,8 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise -LPEPowerStroke::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) { using namespace Geom; - std::vector path_out; + Geom::PathVector path_out; if (path_in.empty()) { return path_out; } @@ -742,7 +744,7 @@ LPEPowerStroke::doEffect_path (std::vector const & path_in) } } - fixed_path.append(fixed_mirrorpath, Geom::Path::STITCH_DISCONTINUOUS); + fixed_path.append(fixed_mirrorpath); switch (start_linecap) { case LINECAP_ZERO_WIDTH: diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h index a773434aa..135d39274 100644 --- a/src/live_effects/lpe-powerstroke.h +++ b/src/live_effects/lpe-powerstroke.h @@ -26,13 +26,13 @@ public: virtual ~LPEPowerStroke(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); virtual void doOnApply(SPLPEItem const* lpeitem); virtual void doOnRemove(SPLPEItem const* lpeitem); // methods called by path-manipulator upon edits - void adjustForNewPath(std::vector const & path_in); + void adjustForNewPath(Geom::PathVector const & path_in); PowerStrokePointArrayParam offset_points; diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp index 455653e46..76421e0f0 100644 --- a/src/live_effects/lpe-rough-hatches.cpp +++ b/src/live_effects/lpe-rough-hatches.cpp @@ -529,7 +529,8 @@ LPERoughHatches::smoothSnake(std::vector > const &linearSnake } if ( fat_output.get_value() ){ res_comp = res_comp_bot; - res_comp.append(res_comp_top.reverse(),Geom::Path::STITCH_DISCONTINUOUS); + res_comp.setStitching(true); + res_comp.append(res_comp_top.reversed()); } result.concat(res_comp.toPwSb()); } diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp index 9d1c3152b..44ff54554 100644 --- a/src/live_effects/lpe-roughen.cpp +++ b/src/live_effects/lpe-roughen.cpp @@ -287,8 +287,8 @@ SPCurve *LPERoughen::addNodesAndJitter(const Geom::Curve *A, double t) } if (cubic) { std::pair div = cubic->subdivide(t); - std::vector seg1 = div.first.points(), - seg2 = div.second.points(); + std::vector seg1 = div.first.controlPoints(), + seg2 = div.second.controlPoints(); out->moveto(seg1[0]); out->curveto(seg1[1] + point1, seg1[2] + point2, seg1[3] + point3); out->curveto(seg2[1] + point_b1, seg2[2], seg2[3]); diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp index fd611c78d..49b5faa2e 100644 --- a/src/live_effects/lpe-ruler.cpp +++ b/src/live_effects/lpe-ruler.cpp @@ -111,7 +111,7 @@ LPERuler::ruler_mark(Geom::Point const &A, Geom::Point const &n, MarkType const break; } - Piecewise > seg(D2(Linear(C[X], D[X]), Linear(C[Y], D[Y]))); + Piecewise > seg(D2(SBasis(C[X], D[X]), SBasis(C[Y], D[Y]))); return seg; } diff --git a/src/live_effects/lpe-show_handles.cpp b/src/live_effects/lpe-show_handles.cpp index 2638f312e..0bc1c4f17 100644 --- a/src/live_effects/lpe-show_handles.cpp +++ b/src/live_effects/lpe-show_handles.cpp @@ -79,9 +79,9 @@ void LPEShowHandles::doBeforeEffect (SPLPEItem const* lpeitem) stroke_width = item->style->stroke_width.computed; } -std::vector LPEShowHandles::doEffect_path (std::vector const & path_in) +Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in) { - std::vector path_out; + Geom::PathVector path_out; Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(path_in); if(original_path) { for (unsigned int i=0; i < path_in.size(); i++) { @@ -112,14 +112,14 @@ LPEShowHandles::generateHelperPath(Geom::PathVector result) continue; } //Itreadores - Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve - Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve - Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop + Geom::Path::iterator curve_it1 = path_it->begin(); // incoming curve + Geom::Path::iterator curve_it2 = ++(path_it->begin()); // outgoing curve + Geom::Path::iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop if (path_it->closed()) { // if the path is closed, maybe we have to stop a bit earlier because the // closing line segment has zerolength. - const Geom::Curve &closingline = path_it->back_closed(); // the closing line segment is always of type + Geom::Curve const &closingline = path_it->back_closed(); // the closing line segment is always of type // Geom::LineSegment. if (are_near(closingline.initialPoint(), closingline.finalPoint())) { // closingline.isDegenerate() did not work, because it only checks for @@ -165,9 +165,7 @@ LPEShowHandles::drawNode(Geom::Point p) char const * svgd; svgd = "M 0.05,0 A 0.05,0.05 0 0 1 0,0.05 0.05,0.05 0 0 1 -0.05,0 0.05,0.05 0 0 1 0,-0.05 0.05,0.05 0 0 1 0.05,0 Z M -0.5,-0.5 0.5,-0.5 0.5,0.5 -0.5,0.5 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); - pathv *= Geom::Rotate::from_degrees(rotate_nodes); - pathv *= Geom::Scale (diameter); - pathv += p; + pathv *= Geom::Rotate::from_degrees(rotate_nodes) * Geom::Scale(diameter) * Geom::Translate(p); outline_path.push_back(pathv[0]); outline_path.push_back(pathv[1]); } @@ -181,8 +179,7 @@ LPEShowHandles::drawHandle(Geom::Point p) char const * svgd; svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); - pathv *= Geom::Scale (diameter); - pathv += p-Geom::Point(diameter * 0.35,diameter * 0.35); + pathv *= Geom::Scale (diameter) * Geom::Translate(p - Geom::Point(diameter * 0.35,diameter * 0.35)); outline_path.push_back(pathv[0]); } } diff --git a/src/live_effects/lpe-show_handles.h b/src/live_effects/lpe-show_handles.h index 77b28e77a..34390dd32 100644 --- a/src/live_effects/lpe-show_handles.h +++ b/src/live_effects/lpe-show_handles.h @@ -36,7 +36,7 @@ public: protected: - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); private: diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 7fc20ede1..265192a17 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -164,14 +164,13 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) Geom::PathVector tmp_path; Geom::CubicBezier const *cubic = NULL; for (Geom::PathVector::iterator path_it = result.begin(); path_it != result.end(); ++path_it) { - //Si está vacío... if (path_it->empty()) { continue; } - //Itreadores - Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve - Geom::Path::const_iterator curve_it2 = ++(path_it->begin());// outgoing curve - Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop + + Geom::Path::iterator curve_it1 = path_it->begin(); // incoming curve + Geom::Path::iterator curve_it2 = ++(path_it->begin());// outgoing curve + Geom::Path::iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop SPCurve *nCurve = new SPCurve(); if (path_it->closed()) { // if the path is closed, maybe we have to stop a bit earlier because the @@ -264,8 +263,7 @@ LPESimplify::drawNode(Geom::Point p) char const * svgd; svgd = "M 0.55,0.5 A 0.05,0.05 0 0 1 0.5,0.55 0.05,0.05 0 0 1 0.45,0.5 0.05,0.05 0 0 1 0.5,0.45 0.05,0.05 0 0 1 0.55,0.5 Z M 0,0 1,0 1,1 0,1 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); - pathv *= Geom::Affine(r,0,0,r,0,0); - pathv += p - Geom::Point(0.5*r,0.5*r); + pathv *= Geom::Scale(r) * Geom::Translate(p - Geom::Point(0.5*r,0.5*r)); hp.push_back(pathv[0]); hp.push_back(pathv[1]); } @@ -277,8 +275,7 @@ LPESimplify::drawHandle(Geom::Point p) char const * svgd; svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); - pathv *= Geom::Affine(r,0,0,r,0,0); - pathv += p - Geom::Point(0.35*r,0.35*r); + pathv *= Geom::Scale(r) * Geom::Translate(p - Geom::Point(0.35*r,0.35*r)); hp.push_back(pathv[0]); } diff --git a/src/live_effects/lpe-skeleton.cpp b/src/live_effects/lpe-skeleton.cpp index c61e9773f..6e4afbe9b 100644 --- a/src/live_effects/lpe-skeleton.cpp +++ b/src/live_effects/lpe-skeleton.cpp @@ -62,10 +62,10 @@ LPESkeleton::doEffect (SPCurve * curve) // spice this up to make the effect actually *do* something! } -std::vector -LPESkeleton::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPESkeleton::doEffect_path (Geom::PathVector const & path_in) { - std::vector path_out; + Geom::PathVector path_out; path_out = path_in; // spice this up to make the effect actually *do* something! diff --git a/src/live_effects/lpe-skeleton.h b/src/live_effects/lpe-skeleton.h index 124d1a4cb..3b45b6978 100644 --- a/src/live_effects/lpe-skeleton.h +++ b/src/live_effects/lpe-skeleton.h @@ -36,8 +36,8 @@ public: // Choose to implement one of the doEffect functions. You can delete or comment out the others. // virtual void doEffect (SPCurve * curve); -// virtual std::vector doEffect_path (std::vector const & path_in); - virtual Geom::Piecewise > doEffect_pwd2 (Geom::Piecewise > const & pwd2_in); +// virtual Geom::PathVector doEffect_path (Geom::PathVector const &path_in); + virtual Geom::Piecewise > doEffect_pwd2 (Geom::Piecewise > const &pwd2_in); /* the knotholder entity classes (if any) can be declared friends */ //friend class Skeleton::KnotHolderEntityMyHandle; diff --git a/src/live_effects/lpe-spiro.cpp b/src/live_effects/lpe-spiro.cpp index 8b4274ab2..eefd25c7d 100644 --- a/src/live_effects/lpe-spiro.cpp +++ b/src/live_effects/lpe-spiro.cpp @@ -10,8 +10,7 @@ #include #include <2geom/pathvector.h> #include <2geom/affine.h> -#include <2geom/bezier-curve.h> -#include <2geom/hvlinesegment.h> +#include <2geom/curves.h> #include "helper/geom-nodetype.h" #include "helper/geom-curves.h" diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp index bce4876af..978ab57fb 100644 --- a/src/live_effects/lpe-tangent_to_curve.cpp +++ b/src/live_effects/lpe-tangent_to_curve.cpp @@ -90,7 +90,7 @@ LPETangentToCurve::doEffect_pwd2 (Geom::Piecewise > const C = ptA - derivA * length_left; D = ptA + derivA * length_right; - output = Piecewise >(D2(Linear(C[X], D[X]), Linear(C[Y], D[Y]))); + output = Piecewise >(D2(SBasis(C[X], D[X]), SBasis(C[Y], D[Y]))); return output; } @@ -135,7 +135,7 @@ KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*or } Piecewise > pwd2 = paths_to_pw( lpe->pathvector_before_effect ); - double t0 = nearest_point(s, pwd2); + double t0 = nearest_time(s, pwd2); lpe->t_attach.param_set_value(t0); // FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating. @@ -149,7 +149,7 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori Geom::Point const s = snap_knot_position(p, state); - double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA); + double lambda = Geom::nearest_time(s, lpe->ptA, lpe->derivA); lpe->length_left.param_set_value(-lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); @@ -162,7 +162,7 @@ KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*or Geom::Point const s = snap_knot_position(p, state); - double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA); + double lambda = Geom::nearest_time(s, lpe->ptA, lpe->derivA); lpe->length_right.param_set_value(lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 2c74af6d6..a681ad473 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -14,7 +14,6 @@ #include "live_effects/lpe-taperstroke.h" #include <2geom/path.h> -#include <2geom/shape.h> #include <2geom/path.h> #include <2geom/circle.h> #include <2geom/sbasis-to-bezier.h> @@ -193,7 +192,7 @@ Piecewise > stretch_along(Piecewise > pwd2_in, Geom::Path Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) { Geom::Path first_cusp = return_at_first_cusp(path_in[0]); - Geom::Path last_cusp = return_at_first_cusp(path_in[0].reverse()); + Geom::Path last_cusp = return_at_first_cusp(path_in[0].reversed()); bool zeroStart = false; // [distance from start taper knot -> start of path] == 0 bool zeroEnd = false; // [distance from end taper knot -> end of path] == 0 @@ -317,7 +316,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) if (!metInMiddle) { // append the inside outline of the path (against direction) - throwaway_path = half_outline(pathv_out[1].reverse(), fabs(line_width)/2., miter_limit, static_cast(join_type.get_value())); + throwaway_path = half_outline(pathv_out[1].reversed(), fabs(line_width)/2., miter_limit, static_cast(join_type.get_value())); if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) { real_path.appendNew(throwaway_path.initialPoint()); @@ -486,7 +485,7 @@ void KnotHolderEntityAttachBegin::knot_set(Geom::Point const &p, Geom::Point con Geom::Path p_in = return_at_first_cusp(pathv[0]); pwd2.concat(p_in.toPwSb()); - double t0 = nearest_point(s, pwd2); + double t0 = nearest_time(s, pwd2); lpe->attach_start.param_set_value(t0); // FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating. @@ -511,10 +510,10 @@ void KnotHolderEntityAttachEnd::knot_set(Geom::Point const &p, Geom::Point const return; } Geom::PathVector pathv = lpe->pathvector_before_effect; - Geom::Path p_in = return_at_first_cusp(pathv[0].reverse()); + Geom::Path p_in = return_at_first_cusp(pathv[0].reversed()); Piecewise > pwd2 = p_in.toPwSb(); - double t0 = nearest_point(s, pwd2); + double t0 = nearest_time(s, pwd2); lpe->attach_end.param_set_value(t0); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); diff --git a/src/live_effects/lpe-test-doEffect-stack.cpp b/src/live_effects/lpe-test-doEffect-stack.cpp index c6787aae1..2bcd4c136 100644 --- a/src/live_effects/lpe-test-doEffect-stack.cpp +++ b/src/live_effects/lpe-test-doEffect-stack.cpp @@ -47,14 +47,14 @@ LPEdoEffectStackTest::doEffect (SPCurve * curve) } } -std::vector -LPEdoEffectStackTest::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPEdoEffectStackTest::doEffect_path (Geom::PathVector const &path_in) { if (step >= 2) { return Effect::doEffect_path(path_in); } else { // return here - std::vector path_out = path_in; + Geom::PathVector path_out = path_in; return path_out; } } diff --git a/src/live_effects/lpe-test-doEffect-stack.h b/src/live_effects/lpe-test-doEffect-stack.h index fa3ee09be..208a345c6 100644 --- a/src/live_effects/lpe-test-doEffect-stack.h +++ b/src/live_effects/lpe-test-doEffect-stack.h @@ -27,7 +27,7 @@ public: virtual ~LPEdoEffectStackTest(); virtual void doEffect (SPCurve * curve); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); virtual Geom::Piecewise > doEffect_pwd2 (Geom::Piecewise > const & pwd2_in); private: diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index b52816c87..7b424e019 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -76,12 +76,12 @@ LPEVonKoch::~LPEVonKoch() } -std::vector -LPEVonKoch::doEffect_path (std::vector const & path_in) +Geom::PathVector +LPEVonKoch::doEffect_path (Geom::PathVector const & path_in) { using namespace Geom; - std::vector generating_path = generator.get_pathvector(); + Geom::PathVector generating_path = generator.get_pathvector(); if (generating_path.empty()) { return path_in; @@ -148,15 +148,15 @@ LPEVonKoch::doEffect_path (std::vector const & path_in) } //Generate path: - std::vector pathi = path_in; - std::vector path_out = path_in; + Geom::PathVector pathi = path_in; + Geom::PathVector path_out = path_in; for (unsigned i = 0; i(); + path_out = Geom::PathVector(); complexity = 0; } for (unsigned j = 0; j const & path_in) hp_vec.push_back(refbox_as_vect); } //Draw the transformed boxes - std::vector generating_path = generator.get_pathvector(); + Geom::PathVector generating_path = generator.get_pathvector(); for (unsigned i=0;i paths = ref_path.get_pathvector(); + Geom::PathVector paths = ref_path.get_pathvector(); Geom::Point A,B; if (paths.empty()||paths.front().size()==0){ //FIXME: a path is used as ref instead of 2 points to work around path/point param incompatibility bug. @@ -258,7 +258,7 @@ LPEVonKoch::doBeforeEffect (SPLPEItem const* lpeitem) if (paths.size()!=1||paths.front().size()!=1){ Geom::Path tmp_path(A); tmp_path.appendNew(B); - std::vector tmp_pathv; + Geom::PathVector tmp_pathv; tmp_pathv.push_back(tmp_path); ref_path.set_new_value(tmp_pathv,true); } @@ -282,7 +282,7 @@ LPEVonKoch::resetDefaults(SPItem const* item) B[Geom::X] = boundingbox_X.max(); B[Geom::Y] = boundingbox_Y.middle(); - std::vector paths,refpaths; + Geom::PathVector paths,refpaths; Geom::Path path = Geom::Path(A); path.appendNew(B); @@ -298,7 +298,7 @@ LPEVonKoch::resetDefaults(SPItem const* item) //refA[Geom::Y] = boundingbox_Y.middle(); //refB[Geom::X] = boundingbox_X.max(); //refB[Geom::Y] = boundingbox_Y.middle(); - //std::vector paths; + //Geom::PathVector paths; //Geom::Path path = Geom::Path( (Point) refA); //path.appendNew( (Point) refB ); //paths.push_back(path * Affine(1./3,0,0,1./3, refA[X]*2./3, refA[Y]*2./3 + boundingbox_Y.extent()/2)); diff --git a/src/live_effects/lpe-vonkoch.h b/src/live_effects/lpe-vonkoch.h index 7dff2be52..bffbebd54 100644 --- a/src/live_effects/lpe-vonkoch.h +++ b/src/live_effects/lpe-vonkoch.h @@ -49,7 +49,7 @@ public: LPEVonKoch(LivePathEffectObject *lpeobject); virtual ~LPEVonKoch(); - virtual std::vector doEffect_path (std::vector const & path_in); + virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in); virtual void resetDefaults(SPItem const* item); diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index e9d375b93..fb6cb8e07 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -205,7 +205,7 @@ void FilletChamferPointArrayParam::recalculate_controlpoints_for_new_pwd2( //delete temp vector std::vector().swap(tmp); if (last_pathv.size() > counterPaths) { - last_pathv[counterPaths] = last_pathv[counterPaths].reverse(); + last_pathv[counterPaths] = last_pathv[counterPaths].reversed(); } } else { if (last_pathv.size() > counterPaths) { @@ -223,7 +223,7 @@ void FilletChamferPointArrayParam::recalculate_controlpoints_for_new_pwd2( } double xPos = 0; if (_vector[1][X] > 0) { - xPos = nearest_point(curve_it1->initialPoint(), pwd2_in); + xPos = nearest_time(curve_it1->initialPoint(), pwd2_in); } if (nodetype == NODE_CUSP) { result.push_back(Point(xPos, 1)); @@ -234,7 +234,7 @@ void FilletChamferPointArrayParam::recalculate_controlpoints_for_new_pwd2( double xPos = _vector[counter - offset][X]; if (_vector.size() <= (unsigned)(counter - offset)) { if (_vector[1][X] > 0) { - xPos = nearest_point(curve_it1->initialPoint(), pwd2_in); + xPos = nearest_time(curve_it1->initialPoint(), pwd2_in); } else { xPos = 0; } @@ -403,8 +403,8 @@ void FilletChamferPointArrayParam::updateCanvasIndicators() Geom::Affine aff = Geom::Affine(); aff *= Geom::Scale(helper_size); aff *= Geom::Rotate(ray1.angle() - deg_to_rad(270)); + aff *= Geom::Translate(last_pwd2[i].valueAt(Xvalue)); pathv *= aff; - pathv += last_pwd2[i].valueAt(Xvalue); hp.push_back(pathv[0]); hp.push_back(pathv[1]); i++; @@ -420,7 +420,7 @@ void FilletChamferPointArrayParam::addCanvasIndicators( double FilletChamferPointArrayParam::rad_to_len(int index, double rad) { double len = 0; - std::vector subpaths = path_from_piecewise(last_pwd2, 0.1); + Geom::PathVector subpaths = path_from_piecewise(last_pwd2, 0.1); std::pair positions = get_positions(index, subpaths); D2 A = last_pwd2[last_index(index, subpaths)]; if(positions.second != 0){ @@ -438,7 +438,7 @@ double FilletChamferPointArrayParam::rad_to_len(int index, double rad) Geom::Crossings cs = Geom::crossings(p0, p1); if(cs.size() > 0){ Point cp =p0(cs[0].ta); - double p0pt = nearest_point(cp, B); + double p0pt = nearest_time(cp, B); len = time_to_len(index,p0pt); } else { if(rad < 0){ @@ -453,7 +453,7 @@ double FilletChamferPointArrayParam::len_to_rad(int index, double len) double rad = 0; double tmp_len = _vector[index][X]; _vector[index] = Geom::Point(len,_vector[index][Y]); - std::vector subpaths = path_from_piecewise(last_pwd2, 0.1); + Geom::PathVector subpaths = path_from_piecewise(last_pwd2, 0.1); std::pair positions = get_positions(index, subpaths); Piecewise > u; u.push_cut(0); @@ -492,7 +492,7 @@ double FilletChamferPointArrayParam::len_to_rad(int index, double len) return rad * -1; } -std::vector FilletChamferPointArrayParam::get_times(int index, std::vector subpaths, bool last) +std::vector FilletChamferPointArrayParam::get_times(int index, Geom::PathVector subpaths, bool last) { const double tolerance = 0.001; const double gapHelper = 0.00001; @@ -541,7 +541,7 @@ std::vector FilletChamferPointArrayParam::get_times(int index, std::vect return out; } -std::pair FilletChamferPointArrayParam::get_positions(int index, std::vector subpaths) +std::pair FilletChamferPointArrayParam::get_positions(int index, Geom::PathVector subpaths) { int counter = -1; std::size_t first = 0; @@ -583,7 +583,7 @@ std::pair FilletChamferPointArrayParam::get_positions( return out; } -int FilletChamferPointArrayParam::last_index(int index, std::vector subpaths) +int FilletChamferPointArrayParam::last_index(int index, Geom::PathVector subpaths) { int counter = -1; bool inSubpath = false; @@ -709,9 +709,9 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_set(Point const &p, return; } Piecewise > const &pwd2 = _pparam->get_pwd2(); - double t = nearest_point(p, pwd2[_index]); + double t = nearest_time(p, pwd2[_index]); Geom::Point const s = snap_knot_position(pwd2[_index].valueAt(t), state); - t = nearest_point(s, pwd2[_index]); + t = nearest_time(s, pwd2[_index]); if (t == 1) { t = 0.9999; } @@ -803,7 +803,7 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_click(guint state) if(xModified < 0 && !_pparam->use_distance){ xModified = _pparam->len_to_rad(_index, _pparam->_vector.at(_index).x()); } - std::vector subpaths = path_from_piecewise(_pparam->last_pwd2, 0.1); + Geom::PathVector subpaths = path_from_piecewise(_pparam->last_pwd2, 0.1); std::pair positions = _pparam->get_positions(_index, subpaths); D2 A = _pparam->last_pwd2[_pparam->last_index(_index, subpaths)]; if(positions.second != 0){ diff --git a/src/live_effects/parameter/filletchamferpointarray.h b/src/live_effects/parameter/filletchamferpointarray.h index 7849d5afb..bc05ecfc4 100644 --- a/src/live_effects/parameter/filletchamferpointarray.h +++ b/src/live_effects/parameter/filletchamferpointarray.h @@ -47,9 +47,9 @@ public: virtual double len_to_rad(int index, double len); virtual double len_to_time(int index, double len); virtual double time_to_len(int index, double time); - virtual std::pair get_positions(int index, std::vector subpaths); - virtual int last_index(int index, std::vector subpaths); - std::vector get_times(int index, std::vector subpaths, bool last); + virtual std::pair get_positions(int index, Geom::PathVector subpaths); + virtual int last_index(int index, Geom::PathVector subpaths); + std::vector get_times(int index, Geom::PathVector subpaths, bool last); virtual void set_helper_size(int hs); virtual void set_use_distance(bool use_knot_distance); virtual void set_chamfer_steps(int value_chamfer_steps); diff --git a/src/live_effects/parameter/originalpatharray.h b/src/live_effects/parameter/originalpatharray.h index 6c792613f..296c0f7f7 100644 --- a/src/live_effects/parameter/originalpatharray.h +++ b/src/live_effects/parameter/originalpatharray.h @@ -40,7 +40,7 @@ public: } gchar *href; URIReference ref; - std::vector _pathvector; + Geom::PathVector _pathvector; bool reversed; sigc::connection linked_changed_connection; diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index ba95affd9..dd6b54f7c 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -77,7 +77,7 @@ PathParam::~PathParam() g_free(defvalue); } -std::vector const & +Geom::PathVector const & PathParam::get_pathvector() const { return _pathvector; @@ -255,7 +255,7 @@ PathParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/) } /* - * See comments for set_new_value(std::vector). + * See comments for set_new_value(Geom::PathVector). */ void PathParam::set_new_value (Geom::Piecewise > const & newpath, bool write_to_svg) @@ -291,7 +291,7 @@ PathParam::set_new_value (Geom::Piecewise > const & newpa * The new path data is not written to SVG. This method will emit the signal_path_changed signal. */ void -PathParam::set_new_value (std::vector const &newpath, bool write_to_svg) +PathParam::set_new_value (Geom::PathVector const &newpath, bool write_to_svg) { remove_link(); _pathvector = newpath; diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h index 112a1ea13..d2dddbe97 100644 --- a/src/live_effects/parameter/path.h +++ b/src/live_effects/parameter/path.h @@ -31,7 +31,7 @@ public: const gchar * default_value = "M0,0 L1,1"); virtual ~PathParam(); - std::vector const & get_pathvector() const; + Geom::PathVector const & get_pathvector() const; Geom::Piecewise > const & get_pwd2(); virtual Gtk::Widget * param_newWidget(); @@ -41,7 +41,7 @@ public: virtual void param_set_default(); void param_set_and_write_default(); - void set_new_value (std::vector const &newpath, bool write_to_svg); + void set_new_value (Geom::PathVector const &newpath, bool write_to_svg); void set_new_value (Geom::Piecewise > const &newpath, bool write_to_svg); virtual void param_editOncanvas(SPItem * item, SPDesktop * dt); @@ -59,7 +59,7 @@ public: void on_paste_button_click(); protected: - std::vector _pathvector; // this is primary data storage, since it is closest to SVG. + Geom::PathVector _pathvector; // this is primary data storage, since it is closest to SVG. Geom::Piecewise > _pwd2; // secondary, hence the bool must_recalculate_pwd2 bool must_recalculate_pwd2; // set when _pathvector was updated, but _pwd2 not diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp index e0c2f4c68..c61e8f9cb 100644 --- a/src/live_effects/parameter/powerstrokepointarray.cpp +++ b/src/live_effects/parameter/powerstrokepointarray.cpp @@ -79,7 +79,7 @@ PowerStrokePointArrayParam::recalculate_controlpoints_for_new_pwd2(Geom::Piecewi Geom::Point pt = _vector[i]; Geom::Point position = last_pwd2.valueAt(pt[Geom::X]) + pt[Geom::Y] * last_pwd2_normal.valueAt(pt[Geom::X]); - double t = nearest_point(position, pwd2_in); + double t = nearest_time(position, pwd2_in); double offset = dot(position - pwd2_in.valueAt(t), normal.valueAt(t)); _vector[i] = Geom::Point(t, offset); } @@ -161,7 +161,7 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom: Piecewise > const & n = _pparam->get_pwd2_normal(); Geom::Point const s = snap_knot_position(p, state); - double t = nearest_point(s, pwd2); + double t = nearest_time(s, pwd2); double offset = dot(s - pwd2.valueAt(t), n.valueAt(t)); _pparam->_vector.at(_index) = Geom::Point(t, offset); sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); -- cgit v1.2.3 From cfa7054c950050095e596edd18fedad53e7ed636 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 28 Apr 2015 19:02:19 -0400 Subject: Fix calls to Geom::cross() - sign change. (bzr r14059.2.2) --- src/live_effects/lpe-fillet-chamfer.cpp | 2 +- src/live_effects/lpe-knot.cpp | 2 +- src/live_effects/lpe-powerstroke.cpp | 4 ++-- src/live_effects/lpe-sketch.cpp | 2 +- src/live_effects/parameter/filletchamferpointarray.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index c03312ce2..fe03781d4 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -548,7 +548,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) ray2.setPoints(endArcPoint, (*cubic2)[1]); } Point handle2 = endArcPoint - Point::polar(ray2.angle(),k2); - bool ccwToggle = cross(curve_it1->finalPoint() - startArcPoint, endArcPoint - startArcPoint) < 0; + bool ccwToggle = cross(curve_it1->finalPoint() - startArcPoint, endArcPoint - startArcPoint) > 0; double angle = angle_between(ray1, ray2, ccwToggle); double handleAngle = ray1.angle() - angle; if (ccwToggle) { diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 84e4deda7..a730d7403 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -433,7 +433,7 @@ LPEKnot::doEffect_path (Geom::PathVector const &path_in) std::vector flag_j = gpaths[j][curveidx].pointAndDerivatives(t,1); - int geom_sign = ( cross(flag_i[1],flag_j[1]) > 0 ? 1 : -1); + int geom_sign = ( cross(flag_i[1], flag_j[1]) < 0 ? 1 : -1); bool i0_is_under = false; if ( crossing_points[p].sign * geom_sign > 0 ){ diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index e6644c7e9..6a823e943 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -46,9 +46,9 @@ namespace Geom { static boost::optional intersection_point( Point const & origin_a, Point const & vector_a, Point const & origin_b, Point const & vector_b) { - Coord denom = cross(vector_b, vector_a); + Coord denom = cross(vector_a, vector_b); if (!are_near(denom,0.)){ - Coord t = (cross(origin_a,vector_b) + cross(vector_b,origin_b)) / denom; + Coord t = (cross(origin_b, vector_a) + cross(origin_b, vector_b)) / denom; return origin_a + t * vector_a; } return boost::none; diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp index 551dbe16a..82d343f6e 100644 --- a/src/live_effects/lpe-sketch.cpp +++ b/src/live_effects/lpe-sketch.cpp @@ -346,7 +346,7 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise > const & pwd2_ //TODO: put this 4 as a parameter in the UI... //TODO: what if with v=0? double l = tgtlength*(1-tgtlength_rdm)/v_t.length(); - double r = std::pow(v_t.length(),3)/cross(a_t,v_t); + double r = std::pow(v_t.length(), 3) / cross(v_t, a_t); r = sqrt((2*fabs(r)-tgtscale)*tgtscale)/v_t.length(); l=(rfinalPoint() - startArcPoint, endArcPoint - startArcPoint) < 0; + bool ccwToggle = cross(A->finalPoint() - startArcPoint, endArcPoint - startArcPoint) > 0; double distanceArc = Geom::distance(startArcPoint,middle_point(startArcPoint,endArcPoint)); double angleBetween = angle_between(ray1, ray2, ccwToggle); rad = distanceArc/sin(angleBetween/2.0); -- cgit v1.2.3 From c9402117b96cbde93c13cc52f1596b723861e8ec Mon Sep 17 00:00:00 2001 From: jabiertxof Date: Wed, 29 Apr 2015 11:25:54 -0400 Subject: Fix a bug linking a path parameter to a transformed element (bzr r14071) --- src/live_effects/parameter/path.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/live_effects') diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index ba95affd9..32e82ff8c 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -427,7 +427,13 @@ PathParam::paste_param_path(const char *svgd) if (svgd && *svgd) { // remove possible link to path remove_link(); - + SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); + if (item != NULL) { + Geom::PathVector path_clipboard = sp_svg_read_pathv(svgd); + path_clipboard *= item->i2doc_affine().inverse(); + svgd = sp_svg_write_path( path_clipboard ); + } + param_write_to_repr(svgd); signal_path_pasted.emit(); } -- cgit v1.2.3 From 6a9762c7603a32c7ec5cc0aaed8048d84daee6e8 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 30 Apr 2015 11:17:07 +0200 Subject: Update 2Geom to r2347 (bzr r14059.2.3) --- src/live_effects/lpe-attach-path.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-attach-path.cpp b/src/live_effects/lpe-attach-path.cpp index 0fcd725ce..21459f322 100644 --- a/src/live_effects/lpe-attach-path.cpp +++ b/src/live_effects/lpe-attach-path.cpp @@ -87,7 +87,7 @@ void LPEAttachPath::doEffect (SPCurve * curve) Geom::Coord length = derivs[deriv_n].length(); if ( ! Geom::are_near(length, 0) ) { if (set_start_end) { - start_path_position.param_set_value(transformedpath.nearestTime(start_path_curve_end.getOrigin())); + start_path_position.param_set_value(transformedpath.nearestTime(start_path_curve_end.getOrigin()).asFlatTime()); } if (start_path_position > transformedpath.size()) { @@ -142,7 +142,7 @@ void LPEAttachPath::doEffect (SPCurve * curve) Geom::Coord length = derivs[deriv_n].length(); if ( ! Geom::are_near(length, 0) ) { if (set_end_end) { - end_path_position.param_set_value(transformedpath.nearestTime(end_path_curve_end.getOrigin())); + end_path_position.param_set_value(transformedpath.nearestTime(end_path_curve_end.getOrigin()).asFlatTime()); } if (end_path_position > transformedpath.size()) { -- cgit v1.2.3 From a0ed5b5138836e368e409b9ced656f970b225b38 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 3 May 2015 18:58:35 +0200 Subject: First batch (bzr r14095) --- src/live_effects/lpe-taperstroke.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 2c74af6d6..1888bc3f0 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -275,7 +275,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_str << "M 1,0 C " << 1 - (double)smoothing << ",0 0,0.5 0,0.5 0,0.5 " << 1 - (double)smoothing << ",1 1,1"; pat_vec = sp_svg_read_pathv(pat_str.str().c_str()); - pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], -fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; real_path.append(throwaway_path); @@ -304,7 +304,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_vec = sp_svg_read_pathv(pat_str_1.str().c_str()); pwd2 = Piecewise >(); - pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], -fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) { -- cgit v1.2.3 From c7ce360901e191572b207df27dd3e972bff3929f Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 3 May 2015 19:01:45 +0200 Subject: Revert bad commit (commited to wrong branch). (bzr r14096) --- src/live_effects/lpe-taperstroke.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 1888bc3f0..2c74af6d6 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -275,7 +275,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_str << "M 1,0 C " << 1 - (double)smoothing << ",0 0,0.5 0,0.5 0,0.5 " << 1 - (double)smoothing << ",1 1,1"; pat_vec = sp_svg_read_pathv(pat_str.str().c_str()); - pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], -fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; real_path.append(throwaway_path); @@ -304,7 +304,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_vec = sp_svg_read_pathv(pat_str_1.str().c_str()); pwd2 = Piecewise >(); - pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], -fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) { -- cgit v1.2.3 From 48e0423afcb02fe4a0f705d828a0dbdb3106b397 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 15:46:25 +0200 Subject: fixes a few of jenkins warnings (bzr r14126) --- src/live_effects/lpe-gears.cpp | 2 +- src/live_effects/lpe-taperstroke.cpp | 4 ---- src/live_effects/parameter/filletchamferpointarray.cpp | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp index 003e22567..fafe143b5 100644 --- a/src/live_effects/lpe-gears.cpp +++ b/src/live_effects/lpe-gears.cpp @@ -168,7 +168,7 @@ Geom::Path Gear::path() { D2 root = _arc(cursor, cursor+root_advance, root_radius()); makeContinuous(root, prev); pb.append(SBasisCurve(root)); - cursor += root_advance; + //cursor += root_advance; prev = root.at1(); if (base_radius() > root_radius()) { diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 2c74af6d6..451810d04 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -389,13 +389,9 @@ Piecewise > stretch_along(Piecewise > pwd2_in, Geom::Path x0 -= pattBndsX->min(); y0 -= pattBndsY->middle(); - double xspace = 0; double noffset = 0; double toffset = 0; // Prevent more than 90% overlap... - if (xspace < -pattBndsX->extent()*.9) { - xspace = -pattBndsX->extent()*.9; - } y0+=noffset; diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index e9d375b93..f05f401e4 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -506,7 +506,6 @@ std::vector FilletChamferPointArrayParam::get_times(int index, std::vect time_it1 = 0; } double resultLenght = 0; - time_it1_B = 1; if (subpaths[positions.first].closed() && last) { time_it2 = modf(to_time(index - positions.second , _vector[index - positions.second ][X]), &intpart); resultLenght = it1_length + to_len(index - positions.second, _vector[index - positions.second ][X]); -- cgit v1.2.3 From 78cee203a59243dcabbf67499682ce720be6d1d6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 9 May 2015 17:50:08 +0200 Subject: Remove documentUnits from live_effect/effect.cpp/h Remove units from fillet-chamfer and roughen (bzr r14136) --- src/live_effects/effect.cpp | 3 --- src/live_effects/effect.h | 1 - src/live_effects/lpe-fillet-chamfer.cpp | 7 +------ src/live_effects/lpe-fillet-chamfer.h | 1 - src/live_effects/lpe-roughen.cpp | 22 +++------------------- src/live_effects/lpe-roughen.h | 2 -- .../parameter/filletchamferpointarray.cpp | 12 +----------- .../parameter/filletchamferpointarray.h | 4 ---- 8 files changed, 5 insertions(+), 47 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1da364580..53097171b 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -364,7 +364,6 @@ Effect::Effect(LivePathEffectObject *lpeobject) lpeobj(lpeobject), concatenate_before_pwd2(false), sp_lpe_item(NULL), - defaultUnit("px"), current_zoom(1), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden @@ -454,7 +453,6 @@ void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/) void Effect::doOnApply_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - defaultUnit = sp_lpe_item->document->getDisplayUnit()->abbr; /*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); pathvector_before_effect = sp_curve->get_pathvector();*/ doOnApply(lpeitem); @@ -463,7 +461,6 @@ void Effect::doOnApply_impl(SPLPEItem const* lpeitem) void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast(lpeitem); - defaultUnit = sp_lpe_item->document->getDisplayUnit()->abbr; //printf("(SPLPEITEM*) %p\n", sp_lpe_item); SPShape * shape = dynamic_cast(sp_lpe_item); if(shape){ diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index ac1f0b8dc..a6b5a13ea 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -159,7 +159,6 @@ protected: bool concatenate_before_pwd2; SPLPEItem * sp_lpe_item; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them. - Glib::ustring defaultUnit; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them. double current_zoom; std::vector selectedNodesPoints; SPCurve * sp_curve; diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index c8458b8cb..ca87c7be1 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -29,7 +29,6 @@ // for programmatically updating knots #include "ui/tools-switch.h" -#include // TODO due to internal breakage in glibmm headers, this must be last: #include @@ -57,7 +56,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) : only_selected(_("Change only selected nodes"), _("Change only selected nodes"), "only_selected", &wr, this, false), flexible(_("Flexible radius size (%)"), _("Flexible radius size (%)"), "flexible", &wr, this, false), use_knot_distance(_("Use knots distance instead radius"), _("Use knots distance instead radius"), "use_knot_distance", &wr, this, false), - unit(_("Unit:"), _("Unit"), "unit", &wr, this), method(_("Method:"), _("Fillets methods"), "method", FMConverter, &wr, this, FM_AUTO), radius(_("Radius (unit or %):"), _("Radius, in unit or %"), "radius", &wr, this, 0.), chamfer_steps(_("Chamfer steps:"), _("Chamfer steps"), "chamfer_steps", &wr, this, 0), @@ -65,7 +63,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) : helper_size(_("Helper size with direction:"), _("Helper size with direction"), "helper_size", &wr, this, 0) { registerParameter(&fillet_chamfer_values); - registerParameter(&unit); registerParameter(&method); registerParameter(&radius); registerParameter(&chamfer_steps); @@ -223,7 +220,7 @@ void LPEFilletChamfer::updateFillet() { double power = 0; if (!flexible) { - power = Inkscape::Util::Quantity::convert(radius, unit.get_abbreviation(), defaultUnit) * -1; + power = radius * -1; } else { power = radius; } @@ -444,9 +441,7 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) } else { fillet_chamfer_values.set_helper_size(helper_size); } - fillet_chamfer_values.set_document_unit(defaultUnit); fillet_chamfer_values.set_use_distance(use_knot_distance); - fillet_chamfer_values.set_unit(unit.get_abbreviation()); SPCurve *c = SP_IS_PATH(lpeItem) ? static_cast(lpeItem) ->get_original_curve() : SP_SHAPE(lpeItem)->getCurve(); diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h index fb06e804c..f8e03a399 100644 --- a/src/live_effects/lpe-fillet-chamfer.h +++ b/src/live_effects/lpe-fillet-chamfer.h @@ -66,7 +66,6 @@ private: BoolParam only_selected; BoolParam flexible; BoolParam use_knot_distance; - UnitParam unit; EnumParam method; ScalarParam radius; ScalarParam chamfer_steps; diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp index 9d1c3152b..c5e002351 100644 --- a/src/live_effects/lpe-roughen.cpp +++ b/src/live_effects/lpe-roughen.cpp @@ -20,7 +20,6 @@ #include "live_effects/parameter/parameter.h" #include "helper/geom.h" #include -#include #include namespace Inkscape { @@ -36,7 +35,6 @@ DMConverter(DivisionMethodData, DM_END); LPERoughen::LPERoughen(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: - unit(_("Unit"), _("Unit"), "unit", &wr, this), method(_("Method"), _("Division method"), "method", DMConverter, &wr, this, DM_SEGMENTS), max_segment_size(_("Max. segment size"), _("Max. segment size"), @@ -54,7 +52,6 @@ LPERoughen::LPERoughen(LivePathEffectObject *lpeobject) shift_node_handles(_("Shift node handles"), _("Shift node handles"), "shift_node_handles", &wr, this, true) { - registerParameter(&unit); registerParameter(&method); registerParameter(&max_segment_size); registerParameter(&segments); @@ -98,14 +95,6 @@ Gtk::Widget *LPERoughen::newWidget() if ((*it)->widget_is_visible) { Parameter *param = *it; Gtk::Widget *widg = dynamic_cast(param->param_newWidget()); - if (param->param_key == "unit") { - Gtk::Label *unit_label = Gtk::manage(new Gtk::Label( - Glib::ustring(_("Roughen unit")), Gtk::ALIGN_START)); - unit_label->set_use_markup(true); - vbox->pack_start(*unit_label, false, false, 2); - vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()), - Gtk::PACK_EXPAND_WIDGET); - } if (param->param_key == "method") { Gtk::Label *method_label = Gtk::manage(new Gtk::Label( Glib::ustring(_("Add nodes Subdivide each segment")), @@ -160,11 +149,8 @@ double LPERoughen::sign(double random_number) Geom::Point LPERoughen::randomize() { - Inkscape::Util::Unit const *svg_units = SP_ACTIVE_DESKTOP->namedview->svg_units; - double displace_x_parsed = Inkscape::Util::Quantity::convert( - displace_x * global_randomize, unit.get_abbreviation(), svg_units->abbr); - double displace_y_parsed = Inkscape::Util::Quantity::convert( - displace_y * global_randomize, unit.get_abbreviation(), svg_units->abbr); + double displace_x_parsed = displace_x * global_randomize; + double displace_y_parsed = displace_y * global_randomize; Geom::Point output = Geom::Point(sign(displace_x_parsed), sign(displace_y_parsed)); return output; @@ -175,7 +161,6 @@ void LPERoughen::doEffect(SPCurve *curve) Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(curve->get_pathvector()); curve->reset(); - Inkscape::Util::Unit const *svg_units = SP_ACTIVE_DESKTOP->namedview->svg_units; for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) { if (path_it->empty()) @@ -220,8 +205,7 @@ void LPERoughen::doEffect(SPCurve *curve) } else { nCurve->lineto(point3); } - double length = Inkscape::Util::Quantity::convert( - curve_it1->length(0.001), svg_units->abbr, unit.get_abbreviation()); + double length = curve_it1->length(0.001); std::size_t splits = 0; if (method == DM_SEGMENTS) { splits = segments; diff --git a/src/live_effects/lpe-roughen.h b/src/live_effects/lpe-roughen.h index ed9f06cf7..2b285cd40 100644 --- a/src/live_effects/lpe-roughen.h +++ b/src/live_effects/lpe-roughen.h @@ -17,7 +17,6 @@ #include "live_effects/parameter/parameter.h" #include "live_effects/parameter/path.h" #include "live_effects/parameter/bool.h" -#include "live_effects/parameter/unit.h" #include "live_effects/parameter/random.h" namespace Inkscape { @@ -45,7 +44,6 @@ public: virtual Gtk::Widget *newWidget(); private: - UnitParam unit; EnumParam method; ScalarParam max_segment_size; ScalarParam segments; diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index f05f401e4..10ded4d9f 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -354,11 +354,6 @@ void FilletChamferPointArrayParam::set_pwd2( last_pwd2_normal = pwd2_normal_in; } -void FilletChamferPointArrayParam::set_document_unit(Glib::ustring value_document_unit) -{ - documentUnit = value_document_unit; -} - void FilletChamferPointArrayParam::set_helper_size(int hs) { helper_size = hs; @@ -374,11 +369,6 @@ void FilletChamferPointArrayParam::set_use_distance(bool use_knot_distance ) use_distance = use_knot_distance; } -void FilletChamferPointArrayParam::set_unit(const gchar *abbr) -{ - unit = abbr; -} - void FilletChamferPointArrayParam::updateCanvasIndicators() { std::vector ts = data(); @@ -812,7 +802,7 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_click(guint state) bool aprox = (A[0].degreesOfFreedom() != 2 || B[0].degreesOfFreedom() != 2) && !_pparam->use_distance?true:false; Geom::Point offset = Geom::Point(xModified, _pparam->_vector.at(_index).y()); Inkscape::UI::Dialogs::FilletChamferPropertiesDialog::showDialog( - this->desktop, offset, this, _pparam->unit, _pparam->use_distance, aprox, _pparam->documentUnit); + this->desktop, offset, this, _pparam->use_distance, aprox); } } diff --git a/src/live_effects/parameter/filletchamferpointarray.h b/src/live_effects/parameter/filletchamferpointarray.h index 7849d5afb..9bfd86b41 100644 --- a/src/live_effects/parameter/filletchamferpointarray.h +++ b/src/live_effects/parameter/filletchamferpointarray.h @@ -53,8 +53,6 @@ public: virtual void set_helper_size(int hs); virtual void set_use_distance(bool use_knot_distance); virtual void set_chamfer_steps(int value_chamfer_steps); - virtual void set_document_unit(Glib::ustring value_document_unit); - virtual void set_unit(const gchar *abbr); virtual void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector &hp_vec); virtual bool providesKnotHolderEntities() const { @@ -89,8 +87,6 @@ private: int helper_size; int chamfer_steps; bool use_distance; - const gchar *unit; - Glib::ustring documentUnit; Geom::PathVector hp; Geom::Piecewise > last_pwd2; -- cgit v1.2.3 From cb0c46c9678889ce05dedae3ad2569435c7bb969 Mon Sep 17 00:00:00 2001 From: Ben Scholzen 'DASPRiD Date: Wed, 20 May 2015 17:51:48 +0200 Subject: Use sane constant for min and max values in LPE dialogs (bzr r14163.1.2) --- src/live_effects/parameter/parameter.cpp | 7 ------- src/live_effects/parameter/parameter.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index beb750404..527bc06fe 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -42,13 +42,6 @@ Parameter::param_write_to_repr(const char * svgd) param_effect->getRepr()->setAttribute(param_key.c_str(), svgd); } -// In gtk2, this wasn't an issue; we could toss around -// G_MAXDOUBLE and not worry about size allocations. But -// in gtk3, it is an issue: it allocates widget size for the maxmium -// value you pass to it, leading to some insane lengths. -// If you need this to be more, please be conservative about it. -const double SCALARPARAM_G_MAXDOUBLE = 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile. - void Parameter::write_to_SVG(void) { gchar * str = param_getSVGValue(); diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index 2e6cae49f..cc2c4f3d6 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -13,6 +13,13 @@ #include <2geom/forward.h> #include <2geom/pathvector.h> +// In gtk2, this wasn't an issue; we could toss around +// G_MAXDOUBLE and not worry about size allocations. But +// in gtk3, it is an issue: it allocates widget size for the maxmium +// value you pass to it, leading to some insane lengths. +// If you need this to be more, please be conservative about it. +const double SCALARPARAM_G_MAXDOUBLE = 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile. + class KnotHolder; class SPLPEItem; class SPDesktop; -- cgit v1.2.3 From 25fa09178b7d0d0befa708e93ea5316ef381caa0 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Fri, 22 May 2015 10:23:27 +0200 Subject: Update to 2Geom revision 2396 (bzr r14059.2.16) --- src/live_effects/lpe-circle_3pts.cpp | 3 +- src/live_effects/lpe-circle_with_radius.cpp | 10 +-- src/live_effects/lpe-fillet-chamfer.cpp | 10 +-- src/live_effects/lpe-jointype.cpp | 2 +- src/live_effects/lpe-offset.cpp | 4 +- src/live_effects/lpe-powerstroke.cpp | 94 ++++------------------ .../parameter/filletchamferpointarray.cpp | 1 - 7 files changed, 28 insertions(+), 96 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-circle_3pts.cpp b/src/live_effects/lpe-circle_3pts.cpp index cbabb5a6c..dbb1f4b6b 100644 --- a/src/live_effects/lpe-circle_3pts.cpp +++ b/src/live_effects/lpe-circle_3pts.cpp @@ -17,6 +17,7 @@ // You might need to include other 2geom files. You can add them here: #include <2geom/path.h> #include <2geom/circle.h> +#include <2geom/path-sink.h> namespace Inkscape { namespace LivePathEffect { @@ -47,7 +48,7 @@ static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point con double radius = L2(M - A); Geom::Circle c(M, radius); - c.getPath(path_out); + path_out = Geom::Path(c); } Geom::PathVector diff --git a/src/live_effects/lpe-circle_with_radius.cpp b/src/live_effects/lpe-circle_with_radius.cpp index 32d0c0bf5..8f2156044 100644 --- a/src/live_effects/lpe-circle_with_radius.cpp +++ b/src/live_effects/lpe-circle_with_radius.cpp @@ -15,11 +15,9 @@ #include "display/curve.h" // You might need to include other 2geom files. You can add them here: -#include <2geom/path.h> -#include <2geom/sbasis.h> -#include <2geom/bezier-to-sbasis.h> -#include <2geom/d2.h> +#include <2geom/pathvector.h> #include <2geom/circle.h> +#include <2geom/path-sink.h> using namespace Geom; @@ -51,9 +49,7 @@ LPECircleWithRadius::doEffect_path (Geom::PathVector const & path_in) double radius = Geom::L2(pt - center); Geom::Circle c(center, radius); - c.getPath(path_out); - - return path_out; + return Geom::Path(c); } /* diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index 992c45a43..a9a96864a 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -16,7 +16,7 @@ #include "live_effects/lpe-fillet-chamfer.h" #include <2geom/sbasis-to-bezier.h> -#include <2geom/svg-elliptical-arc.h> +#include <2geom/elliptical-arc.h> #include <2geom/line.h> #include "desktop.h" @@ -582,7 +582,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) Geom::Path path_chamfer; path_chamfer.start(path_out.finalPoint()); if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){ - path_chamfer.appendNew(rx, ry, angleArc, 0, ccwToggle, endArcPoint); + path_chamfer.appendNew(rx, ry, angleArc, 0, ccwToggle, endArcPoint); } else { path_chamfer.appendNew(handle1, handle2, endArcPoint); } @@ -598,7 +598,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) path_chamfer.start(path_out.finalPoint()); if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){ ccwToggle = ccwToggle?0:1; - path_chamfer.appendNew(rx, ry, angleArc, 0, ccwToggle, endArcPoint); + path_chamfer.appendNew(rx, ry, angleArc, 0, ccwToggle, endArcPoint); }else{ path_chamfer.appendNew(inverseHandle1, inverseHandle2, endArcPoint); } @@ -611,13 +611,13 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) } else if (type == 2) { if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){ ccwToggle = ccwToggle?0:1; - path_out.appendNew(rx, ry, angleArc, 0, ccwToggle, endArcPoint); + path_out.appendNew(rx, ry, angleArc, 0, ccwToggle, endArcPoint); }else{ path_out.appendNew(inverseHandle1, inverseHandle2, endArcPoint); } } else if (type == 1){ if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){ - path_out.appendNew(rx, ry, angleArc, 0, ccwToggle, endArcPoint); + path_out.appendNew(rx, ry, angleArc, 0, ccwToggle, endArcPoint); } else { path_out.appendNew(handle1, handle2, endArcPoint); } diff --git a/src/live_effects/lpe-jointype.cpp b/src/live_effects/lpe-jointype.cpp index 893f3ab4e..cc5587194 100644 --- a/src/live_effects/lpe-jointype.cpp +++ b/src/live_effects/lpe-jointype.cpp @@ -20,7 +20,7 @@ #include "display/curve.h" #include <2geom/path.h> -#include <2geom/svg-elliptical-arc.h> +#include <2geom/elliptical-arc.h> #include "lpe-jointype.h" diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp index c841a5442..dd7af92a2 100644 --- a/src/live_effects/lpe-offset.cpp +++ b/src/live_effects/lpe-offset.cpp @@ -20,7 +20,7 @@ #include <2geom/path.h> #include <2geom/piecewise.h> #include <2geom/sbasis-geometric.h> -#include <2geom/svg-elliptical-arc.h> +#include <2geom/elliptical-arc.h> #include <2geom/transforms.h> namespace Inkscape { @@ -52,7 +52,7 @@ static void append_half_circle(Geom::Piecewise > &pwd2, using namespace Geom; double r = L2(dir); - SVGEllipticalArc cap(center + dir, r, r, angle_between(Point(1,0), dir), false, false, center - dir); + EllipticalArc cap(center + dir, r, r, angle_between(Point(1,0), dir), false, false, center - dir); Piecewise > cap_pwd2(cap.toSBasis()); pwd2.continuousConcat(cap_pwd2); } diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 6a823e943..6ce912bcb 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -27,12 +27,13 @@ #include <2geom/sbasis-geometric.h> #include <2geom/transforms.h> #include <2geom/bezier-utils.h> -#include <2geom/svg-elliptical-arc.h> +#include <2geom/elliptical-arc.h> #include <2geom/sbasis-to-bezier.h> #include <2geom/path-sink.h> #include <2geom/path-intersection.h> #include <2geom/crossing.h> #include <2geom/ellipse.h> +#include <2geom/circle.h> #include <2geom/math-utils.h> #include @@ -93,71 +94,6 @@ static Ellipse find_ellipse(Point P, Point Q, Point O) return Ellipse(A, B, C, D, E, F); } -/** - * Refer to: Weisstein, Eric W. "Circle-Circle Intersection." - From MathWorld--A Wolfram Web Resource. - http://mathworld.wolfram.com/Circle-CircleIntersection.html - * - * @return 0 if no intersection - * @return 1 if one circle is contained in the other - * @return 2 if intersections are found (they are written to p0 and p1) - */ -static int circle_circle_intersection(Circle const &circle0, Circle const &circle1, - Point & p0, Point & p1) -{ - Point X0 = circle0.center(); - double r0 = circle0.radius(); - Point X1 = circle1.center(); - double r1 = circle1.radius(); - - /* dx and dy are the vertical and horizontal distances between - * the circle centers. - */ - Point D = X1 - X0; - - /* Determine the straight-line distance between the centers. */ - double d = L2(D); - - /* Check for solvability. */ - if (d > (r0 + r1)) - { - /* no solution. circles do not intersect. */ - return 0; - } - if (d <= fabs(r0 - r1)) - { - /* no solution. one circle is contained in the other */ - return 1; - } - - /* 'point 2' is the point where the line through the circle - * intersection points crosses the line between the circle - * centers. - */ - - /* Determine the distance from point 0 to point 2. */ - double a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; - - /* Determine the coordinates of point 2. */ - Point p2 = X0 + D * (a/d); - - /* Determine the distance from point 2 to either of the - * intersection points. - */ - double h = std::sqrt((r0*r0) - (a*a)); - - /* Now determine the offsets of the intersection points from - * point 2. - */ - Point r = (h/d)*rot90(D); - - /* Determine the absolute intersection points. */ - p0 = p2 + r; - p1 = p2 - r; - - return 2; -} - /** * Find circle that touches inside of the curve, with radius matching the curvature, at time value \c t. * Because this method internally uses unitTangentAt, t should be smaller than 1.0 (see unitTangentAt). @@ -484,24 +420,24 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise solutions; + solutions = circle1.intersect(circle2); + if (solutions.size() == 2) { Geom::Point sol(0.,0.); - if ( dot(tang2,points[0]-B[i].at0()) > 0 ) { + if ( dot(tang2, solutions[0].point() - B[i].at0()) > 0 ) { // points[0] is bad, choose points[1] - sol = points[1]; - } else if ( dot(tang2,points[1]-B[i].at0()) > 0 ) { // points[0] could be good, now check points[1] + sol = solutions[1].point(); + } else if ( dot(tang2, solutions[1].point() - B[i].at0()) > 0 ) { // points[0] could be good, now check points[1] // points[1] is bad, choose points[0] - sol = points[0]; + sol = solutions[0].point(); } else { // both points are good, choose nearest - sol = ( distanceSq(B[i].at0(), points[0]) < distanceSq(B[i].at0(), points[1]) ) ? - points[0] : points[1]; + sol = ( distanceSq(B[i].at0(), solutions[0].point()) < distanceSq(B[i].at0(), solutions[1].point()) ) ? + solutions[0].point() : solutions[1].point(); } - Geom::EllipticalArc *arc0 = circle1.arc(B[prev_i].at1(), 0.5*(B[prev_i].at1()+sol), sol, true); - Geom::EllipticalArc *arc1 = circle2.arc(sol, 0.5*(sol+B[i].at0()), B[i].at0(), true); + Geom::EllipticalArc *arc0 = circle1.arc(B[prev_i].at1(), 0.5*(B[prev_i].at1()+sol), sol); + Geom::EllipticalArc *arc1 = circle2.arc(sol, 0.5*(sol+B[i].at0()), B[i].at0()); if (arc0) { build_from_sbasis(pb,arc0->toSBasis(), tol, false); @@ -739,7 +675,7 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) default: { double radius1 = 0.5 * distance(pwd2_out.lastValue(), mirrorpath.firstValue()); - fixed_path.appendNew( radius1, radius1, M_PI/2., false, y.lastValue() < 0, mirrorpath.firstValue() ); + fixed_path.appendNew( radius1, radius1, M_PI/2., false, y.lastValue() < 0, mirrorpath.firstValue() ); break; } } @@ -777,7 +713,7 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) default: { double radius2 = 0.5 * distance(pwd2_out.firstValue(), mirrorpath.lastValue()); - fixed_path.appendNew( radius2, radius2, M_PI/2., false, y.firstValue() < 0, pwd2_out.firstValue() ); + fixed_path.appendNew( radius2, radius2, M_PI/2., false, y.firstValue() < 0, pwd2_out.firstValue() ); break; } } diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index a3ff4c96f..955fcd621 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -11,7 +11,6 @@ #include <2geom/piecewise.h> #include <2geom/sbasis-to-bezier.h> #include <2geom/sbasis-geometric.h> -#include <2geom/svg-elliptical-arc.h> #include <2geom/line.h> #include <2geom/path-intersection.h> -- cgit v1.2.3 From 8d4ad16f759312fc28024de1df745888999392a5 Mon Sep 17 00:00:00 2001 From: Ben Scholzen 'DASPRiD Date: Mon, 25 May 2015 16:41:32 +0200 Subject: Fix taper stroke path generation (bzr r14172.1.1) --- src/live_effects/lpe-taperstroke.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 451810d04..1f2c3c79e 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -275,7 +275,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_str << "M 1,0 C " << 1 - (double)smoothing << ",0 0,0.5 0,0.5 0,0.5 " << 1 - (double)smoothing << ",1 1,1"; pat_vec = sp_svg_read_pathv(pat_str.str().c_str()); - pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], -fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; real_path.append(throwaway_path); @@ -304,7 +304,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_vec = sp_svg_read_pathv(pat_str_1.str().c_str()); pwd2 = Piecewise >(); - pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], -fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) { -- cgit v1.2.3 From dd0a71ebdfaea505a14acedcc81f7386666be8fe Mon Sep 17 00:00:00 2001 From: Ben Scholzen 'DASPRiD Date: Wed, 27 May 2015 21:42:16 +0200 Subject: Write line_width back to SVG after initially setting it on jointype and taperstroke LPE (bzr r14178.1.1) --- src/live_effects/lpe-jointype.cpp | 1 + src/live_effects/lpe-taperstroke.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-jointype.cpp b/src/live_effects/lpe-jointype.cpp index 0111a0f99..c6a08d336 100644 --- a/src/live_effects/lpe-jointype.cpp +++ b/src/live_effects/lpe-jointype.cpp @@ -110,6 +110,7 @@ void LPEJoinType::doOnApply(SPLPEItem const* lpeitem) sp_repr_css_attr_unref (css); line_width.param_set_value(width); + line_width.write_to_SVG(); } } diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 1f2c3c79e..5765febbd 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -126,6 +126,7 @@ void LPETaperStroke::doOnApply(SPLPEItem const* lpeitem) sp_repr_css_attr_unref (css); line_width.param_set_value(width); + line_width.write_to_SVG(); } else { printf("WARNING: It only makes sense to apply Taper stroke to paths (not groups).\n"); } -- cgit v1.2.3 From f914c2572f0e73cba795fb11047cfed056e06616 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 25 Jun 2015 18:08:54 +0200 Subject: Fix for the bug 1468396 Fixed bugs: - https://launchpad.net/bugs/1468396 (bzr r14217) --- src/live_effects/parameter/filletchamferpointarray.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/live_effects') diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index 10ded4d9f..c469b5fdd 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -491,6 +491,13 @@ std::vector FilletChamferPointArrayParam::get_times(int index, std::vect curve_it1 = subpaths[positions.first][positions.second].duplicate(); Coord it1_length = (*curve_it1).length(tolerance); double time_it1, time_it2, time_it1_B, intpart; + if(_vector.size() <= index){ + std::vector out; + out.push_back(0); + out.push_back(1); + out.push_back(0); + return out; + } time_it1 = modf(to_time(index, _vector[index][X]), &intpart); if (_vector[index][Y] == 0) { time_it1 = 0; -- cgit v1.2.3 From d798a62d8347d3191aac351eb7ebef44d9fa64a3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 25 Jun 2015 19:52:51 +0200 Subject: Fix for the bug 1468396. Fix the new bug noticed by su_v Fixed bugs: - https://launchpad.net/bugs/1468396 (bzr r14219) --- src/live_effects/parameter/filletchamferpointarray.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/live_effects') diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index c469b5fdd..43352507e 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -270,6 +270,9 @@ void FilletChamferPointArrayParam::recalculate_knots( Piecewise > const &pwd2_in) { bool change = false; + if(_vector.size() == 0){ + return; + } PathVector pathv = path_from_piecewise(pwd2_in, 0.001); if (!pathv.empty()) { std::vector result; -- cgit v1.2.3 From 0735cfb906cbfcff254979e99219af75ab0864cc Mon Sep 17 00:00:00 2001 From: jtx Date: Fri, 26 Jun 2015 14:07:24 +0200 Subject: Improve hidding helper path when show outline toogle is on (bzr r14220) --- src/live_effects/lpe-bspline.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index ecbfef76a..99e2a55fd 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -9,6 +9,7 @@ #include "sp-path.h" #include "svg/svg.h" #include "xml/repr.h" +#include "preferences.h" // TODO due to internal breakage in glibmm headers, this must be last: #include @@ -43,7 +44,7 @@ LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject) steps.param_set_digits(0); helper_size.param_set_range(0.0, 999.0); - helper_size.param_set_increments(5, 5); + helper_size.param_set_increments(1, 1); helper_size.param_set_digits(2); } @@ -76,13 +77,15 @@ void LPEBSpline::doEffect(SPCurve *curve) Geom::PathVector const original_pathv = curve->get_pathvector(); curve->reset(); - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) { if (path_it->empty()) { continue; } - hp.push_back(*path_it); + if (!prefs->getBool("/tools/nodes/show_outline", true)){ + hp.push_back(*path_it); + } Geom::Path::const_iterator curve_it1 = path_it->begin(); Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); Geom::Path::const_iterator curve_endit = path_it->end_default(); -- cgit v1.2.3 From 96085240c58b87b7df948b7fa1e928a4432a7cf1 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Wed, 8 Jul 2015 23:08:19 +0200 Subject: Fix build failures on some platforms. Correct CMakeLists.txt after 2Geom sync - patch by su_v. (bzr r14237) --- src/live_effects/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index c4b92e579..8a097590a 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -3,7 +3,6 @@ set(live_effects_SRC lpe-angle_bisector.cpp lpe-attach-path.cpp lpe-bendpath.cpp - lpe-boolops.cpp lpe-bounding-box.cpp lpe-bspline.cpp lpe-circle_3pts.cpp @@ -81,7 +80,6 @@ set(live_effects_SRC lpe-angle_bisector.h lpe-attach-path.h lpe-bendpath.h - lpe-boolops.h lpe-bounding-box.h lpe-bspline.h lpe-circle_3pts.h -- cgit v1.2.3 From 676707120d5527ff8c8c8c89ea33d1eadf9cf1b4 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 14 Jul 2015 13:04:32 +0200 Subject: Fix for circular references detection in almost all cases, fixing https://bugs.launchpad.net/inkscape/+bug/167247 and a few of its duplicates. This fix is aimed at preventing any sort of circular references with the URIReference::_acceptObject method, checking the absence of loops in the reference+child tree. There can be some performance improvements done if we add a pointer from cloned sub-objects to their origin sub-object. The remaining cases that are not fixed can involve non-trivial loops using one or more "url()" stylesheet references. Being able to take them into account would require a non-obvious style.cpp refactoring making use of URIReference for this kind of reference (and not handling manually the signals in the styling code, which would probably be a good thing to do anyway) (bzr r14245) --- src/live_effects/lpeobject-reference.cpp | 9 +-------- src/live_effects/parameter/path-reference.cpp | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpeobject-reference.cpp b/src/live_effects/lpeobject-reference.cpp index 573c8a2fd..d9de6e77f 100644 --- a/src/live_effects/lpeobject-reference.cpp +++ b/src/live_effects/lpeobject-reference.cpp @@ -43,14 +43,7 @@ LPEObjectReference::~LPEObjectReference(void) bool LPEObjectReference::_acceptObject(SPObject * const obj) const { if (IS_LIVEPATHEFFECT(obj)) { - SPObject * const owner = getOwner(); - /* Refuse references to us or to an ancestor. */ - for ( SPObject *iter = owner ; iter ; iter = iter->parent ) { - if ( iter == obj ) { - return false; - } - } - return true; + return URIReference::_acceptObject(obj); } else { return false; } diff --git a/src/live_effects/parameter/path-reference.cpp b/src/live_effects/parameter/path-reference.cpp index a76fb1b32..42589b050 100644 --- a/src/live_effects/parameter/path-reference.cpp +++ b/src/live_effects/parameter/path-reference.cpp @@ -22,7 +22,7 @@ bool PathReference::_acceptObject(SPObject * const obj) const return false; } // TODO: check whether the referred path has this LPE applied, if so: deny deny deny! - return true; + return URIReference::_acceptObject(obj); } else { return false; } -- cgit v1.2.3 From 1997b7aeecff6a01b3e319cd2a42a6029bc56ae7 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 19 Jul 2015 15:22:31 +0200 Subject: Enable stitching in Spiro and SPCurve to prevent some crashes (bzr r14250) --- src/live_effects/spiro-converters.cpp | 6 +++++- src/live_effects/spiro-converters.h | 6 ++---- src/live_effects/spiro.h | 6 ++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/spiro-converters.cpp b/src/live_effects/spiro-converters.cpp index 3c7bdf99e..f116d5256 100644 --- a/src/live_effects/spiro-converters.cpp +++ b/src/live_effects/spiro-converters.cpp @@ -64,7 +64,11 @@ ConverterSPCurve::curveto(double x1, double y1, double x2, double y2, double x3, } - +ConverterPath::ConverterPath(Geom::Path &path) + : _path(path) +{ + _path.setStitching(true); +} void ConverterPath::moveto(double x, double y, bool is_open) diff --git a/src/live_effects/spiro-converters.h b/src/live_effects/spiro-converters.h index 83f6ebbc3..90855d2d6 100644 --- a/src/live_effects/spiro-converters.h +++ b/src/live_effects/spiro-converters.h @@ -25,7 +25,7 @@ class ConverterSPCurve : public ConverterBase { public: ConverterSPCurve(SPCurve &curve) : _curve(curve) - {} ; + {} virtual void moveto(double x, double y, bool is_open); virtual void lineto(double x, double y); @@ -45,9 +45,7 @@ private: */ class ConverterPath : public ConverterBase { public: - ConverterPath(Geom::Path &path) - : _path(path) - {} ; + ConverterPath(Geom::Path &path); virtual void moveto(double x, double y, bool is_open); virtual void lineto(double x, double y); diff --git a/src/live_effects/spiro.h b/src/live_effects/spiro.h index 0d85da74b..066b44ca8 100644 --- a/src/live_effects/spiro.h +++ b/src/live_effects/spiro.h @@ -25,11 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA #define INKSCAPE_SPIRO_H #include "live_effects/spiro-converters.h" +#include <2geom/forward.h> class SPCurve; -namespace Geom { - class Path; -} namespace Spiro { @@ -53,4 +51,4 @@ double get_knot_th(const spiro_seg *s, int i); } // namespace Spiro -#endif // INKSCAPE_SPIRO_H \ No newline at end of file +#endif // INKSCAPE_SPIRO_H -- cgit v1.2.3 From 8417b110e22e3e56862c0deff4ae72e76a9958b1 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sun, 19 Jul 2015 19:27:14 -0400 Subject: fix typo in intersection_point() (Bug 1475097) Fixed bugs: - https://launchpad.net/bugs/1475097 (bzr r14251) --- src/live_effects/lpe-powerstroke.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 6ce912bcb..f90d67d4e 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -49,7 +49,7 @@ static boost::optional intersection_point( Point const & origin_a, Point { Coord denom = cross(vector_a, vector_b); if (!are_near(denom,0.)){ - Coord t = (cross(origin_b, vector_a) + cross(origin_b, vector_b)) / denom; + Coord t = (cross(vector_b, origin_a) + cross(origin_b, vector_b)) / denom; return origin_a + t * vector_a; } return boost::none; -- cgit v1.2.3