summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2015-07-04 16:15:46 +0000
committerKrzysztof Kosiński <tweenk.pl@gmail.com>2015-07-04 16:15:46 +0000
commit1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8 (patch)
treea91517f9165322b4e42c6cdeb4263beaedc4d02f /src/live_effects
parentPackaging. New Win32 installer Danish translation. (diff)
parentUpgrade to 2Geom r2413 (diff)
downloadinkscape-1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8.tar.gz
inkscape-1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8.zip
Sync 2Geom to revision 2413.
May introduce regressions. (bzr r14226)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/Makefile_insert2
-rw-r--r--src/live_effects/effect.cpp94
-rw-r--r--src/live_effects/effect.h8
-rw-r--r--src/live_effects/lpe-angle_bisector.cpp10
-rw-r--r--src/live_effects/lpe-angle_bisector.h2
-rw-r--r--src/live_effects/lpe-attach-path.cpp16
-rw-r--r--src/live_effects/lpe-boolops.cpp79
-rw-r--r--src/live_effects/lpe-boolops.h53
-rw-r--r--src/live_effects/lpe-bounding-box.cpp2
-rw-r--r--src/live_effects/lpe-bspline.cpp12
-rw-r--r--src/live_effects/lpe-circle_3pts.cpp11
-rw-r--r--src/live_effects/lpe-circle_3pts.h2
-rw-r--r--src/live_effects/lpe-circle_with_radius.cpp16
-rw-r--r--src/live_effects/lpe-circle_with_radius.h2
-rw-r--r--src/live_effects/lpe-clone-original.cpp2
-rw-r--r--src/live_effects/lpe-constructgrid.cpp6
-rw-r--r--src/live_effects/lpe-constructgrid.h2
-rw-r--r--src/live_effects/lpe-curvestitch.cpp10
-rw-r--r--src/live_effects/lpe-curvestitch.h2
-rw-r--r--src/live_effects/lpe-ellipse_5pts.cpp8
-rw-r--r--src/live_effects/lpe-ellipse_5pts.h2
-rw-r--r--src/live_effects/lpe-fill-between-many.cpp4
-rw-r--r--src/live_effects/lpe-fill-between-strokes.cpp26
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp32
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h8
-rw-r--r--src/live_effects/lpe-gears.cpp6
-rw-r--r--src/live_effects/lpe-gears.h2
-rw-r--r--src/live_effects/lpe-interpolate.cpp2
-rw-r--r--src/live_effects/lpe-interpolate.h2
-rw-r--r--src/live_effects/lpe-interpolate_points.h2
-rw-r--r--src/live_effects/lpe-jointype.cpp4
-rw-r--r--src/live_effects/lpe-jointype.h2
-rw-r--r--src/live_effects/lpe-knot.cpp20
-rw-r--r--src/live_effects/lpe-knot.h10
-rw-r--r--src/live_effects/lpe-lattice2.cpp4
-rw-r--r--src/live_effects/lpe-line_segment.cpp16
-rw-r--r--src/live_effects/lpe-line_segment.h2
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp10
-rw-r--r--src/live_effects/lpe-mirror_symmetry.h2
-rw-r--r--src/live_effects/lpe-offset.cpp6
-rw-r--r--src/live_effects/lpe-parallel.cpp2
-rw-r--r--src/live_effects/lpe-perp_bisector.cpp4
-rw-r--r--src/live_effects/lpe-perspective-envelope.cpp4
-rw-r--r--src/live_effects/lpe-powerstroke.cpp122
-rw-r--r--src/live_effects/lpe-powerstroke.h4
-rw-r--r--src/live_effects/lpe-rough-hatches.cpp3
-rw-r--r--src/live_effects/lpe-roughen.cpp4
-rw-r--r--src/live_effects/lpe-ruler.cpp2
-rw-r--r--src/live_effects/lpe-show_handles.cpp19
-rw-r--r--src/live_effects/lpe-show_handles.h2
-rw-r--r--src/live_effects/lpe-simplify.cpp15
-rw-r--r--src/live_effects/lpe-skeleton.cpp6
-rw-r--r--src/live_effects/lpe-skeleton.h4
-rw-r--r--src/live_effects/lpe-sketch.cpp2
-rw-r--r--src/live_effects/lpe-spiro.cpp3
-rw-r--r--src/live_effects/lpe-tangent_to_curve.cpp8
-rw-r--r--src/live_effects/lpe-taperstroke.cpp11
-rw-r--r--src/live_effects/lpe-test-doEffect-stack.cpp6
-rw-r--r--src/live_effects/lpe-test-doEffect-stack.h2
-rw-r--r--src/live_effects/lpe-vonkoch.cpp22
-rw-r--r--src/live_effects/lpe-vonkoch.h2
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.cpp29
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.h6
-rw-r--r--src/live_effects/parameter/originalpatharray.h2
-rw-r--r--src/live_effects/parameter/path.cpp6
-rw-r--r--src/live_effects/parameter/path.h6
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp4
67 files changed, 295 insertions, 506 deletions
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 53097171b..332d81777 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<EffectType> 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<Effect*> ( new LPERuler(lpeobj) );
break;
- case BOOLOPS:
- neweffect = static_cast<Effect*> ( new LPEBoolops(lpeobj) );
- break;
case INTERPOLATE:
neweffect = static_cast<Effect*> ( new LPEInterpolate(lpeobj) );
break;
@@ -520,24 +514,24 @@ Effect::acceptParamPath (SPPath const*/*param_path*/) {
void
Effect::doEffect (SPCurve * curve)
{
- std::vector<Geom::Path> orig_pathv = curve->get_pathvector();
+ Geom::PathVector orig_pathv = curve->get_pathvector();
- std::vector<Geom::Path> result_pathv = doEffect_path(orig_pathv);
+ Geom::PathVector result_pathv = doEffect_path(orig_pathv);
curve->set_pathvector(result_pathv);
}
-std::vector<Geom::Path>
-Effect::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+Effect::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
if ( !concatenate_before_pwd2 ) {
// default behavior
for (unsigned int i=0; i < path_in.size(); i++) {
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_in = path_in[i].toPwSb();
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_out = doEffect_pwd2(pwd2_in);
- std::vector<Geom::Path> 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 a6b5a13ea..ea57ff243 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<Geom::Path> )
- virtual std::vector<Geom::Path>
- doEffect_path (std::vector<Geom::Path> const & path_in);
+ // doEffect(Geom::PathVector )
+ virtual Geom::PathVector
+ doEffect_path (Geom::PathVector const & path_in);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> >
doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
@@ -162,7 +162,7 @@ protected:
double current_zoom;
std::vector<Geom::Point> selectedNodesPoints;
SPCurve * sp_curve;
- std::vector<Geom::Path> 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<Geom::Path>
-LPEAngleBisector::doEffect_path (std::vector<Geom::Path> 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<Geom::Path> const & path_in)
Geom::Point D = ptA - dir * length_left;
Geom::Point E = ptA + dir * length_right;
- Piecewise<D2<SBasis> > output = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(D[X], E[X]), Linear(D[Y], E[Y])));
+ Piecewise<D2<SBasis> > output = Piecewise<D2<SBasis> >(D2<SBasis>(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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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..21459f322 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<Geom::Path> 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<Geom::Path> 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()).asFlatTime());
}
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<Geom::Point> 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<Geom::Path> 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()).asFlatTime());
}
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<Geom::Point> 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 <j.b.c.engelen@utwente.nl>
- *
- * 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<unsigned> 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<unsigned> 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<Parameter *>(&boolop_type) );
- registerParameter( dynamic_cast<Parameter *>(&bool_path) );
-}
-
-LPEBoolops::~LPEBoolops()
-{
-
-}
-
-
-Geom::PathVector
-LPEBoolops::doEffect_path (Geom::PathVector const & path_in)
-{
- std::vector<Geom::Path> 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 <j.b.c.engelen@utwente.nl>
- *
- * 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<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
-
-private:
- PathParam bool_path;
- EnumParam<unsigned> 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::LineSegment>(Geom::Point(bbox->right(), bbox->bottom()));
p.appendNew<Geom::LineSegment>(Geom::Point(bbox->left(), bbox->bottom()));
p.appendNew<Geom::LineSegment>(Geom::Point(bbox->left(), bbox->top()));
- std::vector<Geom::Path> 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 99e2a55fd..c2a2d080e 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -124,12 +124,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();
@@ -147,7 +147,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();
@@ -164,7 +164,7 @@ void LPEBSpline::doEffect(SPCurve *curve)
cubic = dynamic_cast<Geom::CubicBezier const *>(&*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());
}
@@ -178,7 +178,7 @@ void LPEBSpline::doEffect(SPCurve *curve)
cubic = dynamic_cast<Geom::CubicBezier const *>(&*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());
}
@@ -236,7 +236,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..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 {
@@ -30,7 +31,7 @@ LPECircle3Pts::~LPECircle3Pts()
{
}
-static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point const &C, std::vector<Geom::Path> &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;
@@ -47,13 +48,13 @@ 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);
}
-std::vector<Geom::Path>
-LPECircle3Pts::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPECircle3Pts::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out = std::vector<Geom::Path>();
+ 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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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..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;
@@ -40,10 +38,10 @@ LPECircleWithRadius::~LPECircleWithRadius()
}
-std::vector<Geom::Path>
-LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPECircleWithRadius::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out = std::vector<Geom::Path>();
+ Geom::PathVector path_out = Geom::PathVector();
Geom::Point center = path_in[0].initialPoint();
Geom::Point pt = path_in[0].finalPoint();
@@ -51,9 +49,7 @@ LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> 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-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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::Path> 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<Geom::Path>
-LPEConstructGrid::doEffect_path (std::vector<Geom::Path> 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<Geom::Path> const & path_in)
second_path.appendNew<LineSegment>( origin + second_p*nr_x );
// use the gridpaths and set them in the correct grid
- std::vector<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::Path>
-LPECurveStitch::doEffect_path (std::vector<Geom::Path> 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<Geom::Path> const & path_in)
gdouble scaling = bndsStroke->max() - bndsStroke->min();
Point stroke_origin(bndsStroke->min(), (bndsStrokeY->max()+bndsStrokeY->min())/2);
- std::vector<Geom::Path> 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<Geom::Path> const & path_in)
// add stuff to one big pw<d2<sbasis> > 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<Geom::Path> 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<D2<SBasis> > pwd2;
- std::vector<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::Path>
-LPEEllipse5Pts::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEEllipse5Pts::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out = std::vector<Geom::Path>();
+ Geom::PathVector path_out = Geom::PathVector();
if (path_in[0].size() < 4) {
@@ -190,7 +190,7 @@ LPEEllipse5Pts::doEffect_path (std::vector<Geom::Path> const & path_in)
p.appendNew<Geom::CubicBezier>(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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::Path> res_pathv;
+ Geom::PathVector res_pathv;
SPItem * firstObj = NULL;
for (std::vector<PathAndDirection*>::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<Geom::Path> linked_pathv = linked_path.get_pathvector();
- std::vector<Geom::Path> second_pathv = second_path.get_pathvector();
- std::vector<Geom::Path> result_linked_pathv;
- std::vector<Geom::Path> 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<Geom::Path>::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<Geom::Path>::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<Geom::LineSegment>(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<Geom::Path> linked_pathv = linked_path.get_pathvector();
- std::vector<Geom::Path> result_pathv;
+ Geom::PathVector linked_pathv = linked_path.get_pathvector();
+ Geom::PathVector result_pathv;
- for (std::vector<Geom::Path>::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<Geom::Path> second_pathv = second_path.get_pathvector();
- std::vector<Geom::Path> result_pathv;
+ Geom::PathVector second_pathv = second_path.get_pathvector();
+ Geom::PathVector result_pathv;
- for (std::vector<Geom::Path>::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 ca87c7be1..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"
@@ -272,11 +272,11 @@ void LPEFilletChamfer::refreshKnots()
}
}
-void LPEFilletChamfer::doUpdateFillet(std::vector<Geom::Path> const& original_pathv, double power)
+void LPEFilletChamfer::doUpdateFillet(Geom::PathVector const &original_pathv, double power)
{
std::vector<Point> filletChamferData = fillet_chamfer_values.data();
std::vector<Geom::Point> result;
- std::vector<Geom::Path> 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) {
@@ -320,11 +320,11 @@ void LPEFilletChamfer::doUpdateFillet(std::vector<Geom::Path> const& original_pa
fillet_chamfer_values.param_set_and_write_new_value(result);
}
-void LPEFilletChamfer::doChangeType(std::vector<Geom::Path> const& original_pathv, int type)
+void LPEFilletChamfer::doChangeType(Geom::PathVector const &original_pathv, int type)
{
std::vector<Point> filletChamferData = fillet_chamfer_values.data();
std::vector<Geom::Point> result;
- std::vector<Geom::Path> 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;
@@ -461,7 +461,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<Geom::Path>::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--;
@@ -471,17 +471,17 @@ int LPEFilletChamfer::getKnotsNumber(SPCurve const *c)
}
void
-LPEFilletChamfer::adjustForNewPath(std::vector<Geom::Path> 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<Geom::Path>
-LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
+Geom::PathVector
+LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
{
- std::vector<Geom::Path> pathvector_out;
+ Geom::PathVector pathvector_out;
Piecewise<D2<SBasis> > pwd2_in = paths_to_pw(pathv_to_linear_and_cubic_beziers(path_in));
pwd2_in = remove_short_cuts(pwd2_in, .01);
Piecewise<D2<SBasis> > der = derivative(pwd2_in);
@@ -490,7 +490,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
std::vector<Point> filletChamferData = fillet_chamfer_values.data();
unsigned int counter = 0;
const double K = (4.0 / 3.0) * (sqrt(2.0) - 1.0);
- std::vector<Geom::Path> 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())
@@ -543,7 +543,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> 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) {
@@ -582,7 +582,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> 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<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ path_chamfer.appendNew<EllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
} else {
path_chamfer.appendNew<Geom::CubicBezier>(handle1, handle2, endArcPoint);
}
@@ -598,7 +598,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> 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<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ path_chamfer.appendNew<EllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
}else{
path_chamfer.appendNew<Geom::CubicBezier>(inverseHandle1, inverseHandle2, endArcPoint);
}
@@ -611,13 +611,13 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> 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<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ path_out.appendNew<EllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
}else{
path_out.appendNew<Geom::CubicBezier>(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<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ path_out.appendNew<EllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
} else {
path_out.appendNew<Geom::CubicBezier>(handle1, handle2, endArcPoint);
}
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index f8e03a399..290a37f92 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -37,11 +37,11 @@ public:
LPEFilletChamfer(LivePathEffectObject *lpeobject);
virtual ~LPEFilletChamfer();
- virtual std::vector<Geom::Path> doEffect_path(std::vector<Geom::Path> 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<Geom::Path> const &path_in);
+ virtual void adjustForNewPath(Geom::PathVector const &path_in);
virtual Gtk::Widget* newWidget();
int getKnotsNumber(SPCurve const *c);
@@ -53,8 +53,8 @@ public:
void fillet();
void inverseFillet();
void updateFillet();
- void doUpdateFillet(std::vector<Geom::Path> const& original_pathv, double power);
- void doChangeType(std::vector<Geom::Path> 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 fafe143b5..d4d695542 100644
--- a/src/live_effects/lpe-gears.cpp
+++ b/src/live_effects/lpe-gears.cpp
@@ -232,10 +232,10 @@ LPEGears::~LPEGears()
}
-std::vector<Geom::Path>
-LPEGears::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEGears::doEffect_path (Geom::PathVector const &path_in)
{
- std::vector<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::Path> path_out;
+ Geom::PathVector path_out;
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_A = path_in[0].toPwSb();
Geom::Piecewise<Geom::D2<Geom::SBasis> > 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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
EnumParam<unsigned> interpolator_type;
diff --git a/src/live_effects/lpe-jointype.cpp b/src/live_effects/lpe-jointype.cpp
index c6a08d336..28f99eb94 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"
@@ -151,7 +151,7 @@ void LPEJoinType::doOnRemove(SPLPEItem const* lpeitem)
}
}
-std::vector<Geom::Path> LPEJoinType::doEffect_path(std::vector<Geom::Path> 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 <Geom::Path> doEffect_path (std::vector<Geom::Path> 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 ec2f9c419..c3000fe0d 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<Geom::Point> 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<Geom::Path> const &paths) : std::vector<CrossingPoint>(){
+CrossingPoints::CrossingPoints(Geom::PathVector const &paths) : std::vector<CrossingPoint>(){
// std::cout<<"\nCrossingPoints creation from path vector\n";
for( unsigned i=0; i<paths.size(); i++){
for( unsigned ii=0; ii < size_nondegenerate(paths[i]); ii++){
@@ -391,11 +391,11 @@ LPEKnot::updateSwitcher(){
}
}
-std::vector<Geom::Path>
-LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in)
+Geom::PathVector
+LPEKnot::doEffect_path (Geom::PathVector const &path_in)
{
using namespace Geom;
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
if (gpaths.size()==0){
return path_in;
@@ -433,7 +433,7 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in)
std::vector<Point> 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 ){
@@ -486,8 +486,9 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> 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<Geom::Path> const &path_in)
//recursively collect gpaths and stroke widths (stolen from "sp-lpe_item.cpp").
static void
-collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector<Geom::Path> &paths, std::vector<double> &stroke_widths){
+collectPathsAndWidths (SPLPEItem const *lpeitem, Geom::PathVector &paths, std::vector<double> &stroke_widths){
if (SP_IS_GROUP(lpeitem)) {
std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(lpeitem));
for ( std::vector<SPItem*>::const_iterator iter = item_list.begin(); iter != item_list.end(); iter++) {
@@ -615,8 +616,7 @@ LPEKnot::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::Pat
svgd = "M 10,0 C 10,5.52 5.52,10 0,10 -5.52,10 -10,5.52 -10,0 c 0,-5.52 4.48,-10 10,-10 5.52,0 10,4.48 10,10 z";
}
PathVector pathv = sp_svg_read_pathv(svgd);
- pathv *= Affine(r,0,0,r,0,0);
- pathv += switcher;
+ pathv *= Affine(r,0,0,r,0,0) * Translate(switcher);
hp_vec.push_back(pathv);
}
diff --git a/src/live_effects/lpe-knot.h b/src/live_effects/lpe-knot.h
index 080f32de2..95bfaf6e1 100644
--- a/src/live_effects/lpe-knot.h
+++ b/src/live_effects/lpe-knot.h
@@ -42,8 +42,8 @@ struct CrossingPoint {
class CrossingPoints : public std::vector<CrossingPoint>{
public:
CrossingPoints() : std::vector<CrossingPoint>() {}
- CrossingPoints(Geom::CrossingSet const &cs, std::vector<Geom::Path> const &path);//for self crossings only!
- CrossingPoints(std::vector<Geom::Path> const &paths);
+ CrossingPoints(Geom::CrossingSet const &cs, Geom::PathVector const &path);//for self crossings only!
+ CrossingPoints(Geom::PathVector const &paths);
CrossingPoints(std::vector<double> const &input);
std::vector<double> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::PathVector> &hp_vec);
- std::vector<Geom::Path> 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<Geom::Path> 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<double> 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 02bda3af5..8c7f46cbd 100644
--- a/src/live_effects/lpe-lattice2.cpp
+++ b/src/live_effects/lpe-lattice2.cpp
@@ -291,7 +291,7 @@ LPELattice2::vertical(PointParam &param_one, PointParam &param_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;
@@ -312,7 +312,7 @@ LPELattice2::horizontal(PointParam &param_one, PointParam &param_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<Geom::Path>
-LPELineSegment::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPELineSegment::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> 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<Geom::LineSegment> intersection_segment = Geom::rect_line_intersect(dummyRect, Geom::Line(A, B));
+ boost::optional<Geom::LineSegment> 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<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
//private:
EnumParam<EndType> 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<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(A[X], B[X]), Linear(A[Y], B[Y])));
+ Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(SBasis(A[X], B[X]), SBasis(A[Y], B[Y])));
reflection_line.set_new_value(rline, true);
}
-std::vector<Geom::Path>
-LPEMirrorSymmetry::doEffect_path (std::vector<Geom::Path> 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<Geom::Path> path_out;
+ Geom::PathVector path_out;
if (!discard_orig_path) {
path_out = path_in;
}
- std::vector<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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..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<Geom::D2<Geom::SBasis> > &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<D2<SBasis> > cap_pwd2(cap.toSBasis());
pwd2.continuousConcat(cap_pwd2);
}
@@ -72,7 +72,7 @@ LPEOffset::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_
Piecewise<D2<SBasis> > 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<Geom::D2<Geom::SBasis> > const & pwd
C = offset_pt - dir * length_left;
D = offset_pt + dir * length_right;
- output = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y])));
+ output = Piecewise<D2<SBasis> >(D2<SBasis>(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<Geom::D2<Geom::SBasis> > const &
C = M + perp_dir * length_left;
D = M - perp_dir * length_right;
- output = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y])));
+ output = Piecewise<D2<SBasis> >(D2<SBasis>(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 &param_one, PointParam &param_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 &param_one, PointParam &param_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..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 <math.h>
@@ -46,9 +47,9 @@ namespace Geom {
static boost::optional<Point> 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;
@@ -94,71 +95,6 @@ static Ellipse find_ellipse(Point P, Point Q, Point O)
}
/**
- * 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.ray();
- Point X1 = circle1.center();
- double r1 = circle1.ray();
-
- /* 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).
*/
@@ -313,7 +249,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 +298,7 @@ void LPEPowerStroke::doOnRemove(SPLPEItem const* lpeitem)
}
void
-LPEPowerStroke::adjustForNewPath(std::vector<Geom::Path> 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 +323,8 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
return pb.peek().front();
}
+ pb.setStitching(true);
+
Geom::Point start = B[0].at0();
pb.moveTo(start);
build_from_sbasis(pb, B[0], tol, false);
@@ -446,7 +384,7 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
break;
}
- pb.arcTo( ellipse.ray(Geom::X), ellipse.ray(Geom::Y), ellipse.rot_angle(),
+ pb.arcTo( ellipse.ray(Geom::X), ellipse.ray(Geom::Y), ellipse.rotationAngle(),
false, width < 0, B[i].at0() );
break;
@@ -482,24 +420,24 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
// Extrapolate using the curvature at the end of the path segments to join
Geom::Circle circle1 = Geom::touching_circle(reverse(B[prev_i]), 0.0);
Geom::Circle circle2 = Geom::touching_circle(B[i], 0.0);
- Geom::Point points[2];
- int solutions = circle_circle_intersection(circle1, circle2, points[0], points[1]);
- if (solutions == 2) {
+ std::vector<Geom::ShapeIntersection> 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);
@@ -574,7 +512,7 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
Geom::Path spiro;
Spiro::spiro_run(controlpoints, 4, spiro);
- pb.append(spiro.portion(1,spiro.size_open()-1), Geom::Path::STITCH_DISCONTINUOUS);
+ pb.append(spiro.portion(1, spiro.size_open() - 1));
break;
}
case LINEJOIN_BEVEL:
@@ -593,15 +531,15 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
if (cross.size() != 1) {
// empty crossing or too many crossings: default to bevel
pb.lineTo(B[i].at0());
- pb.append(bzr2, Geom::Path::STITCH_DISCONTINUOUS);
+ pb.append(bzr2);
} else {
// :-) quick hack:
for (unsigned i=0; i < bzr1.size_open(); ++i) {
pb.backspace();
}
- pb.append( bzr1.portion(0, cross[0].ta), Geom::Path::STITCH_DISCONTINUOUS );
- pb.append( bzr2.portion(cross[0].tb, bzr2.size_open()), Geom::Path::STITCH_DISCONTINUOUS );
+ pb.append( bzr1.portion(0, cross[0].ta) );
+ pb.append( bzr2.portion(cross[0].tb, bzr2.size_open()) );
}
}
} else {
@@ -615,12 +553,12 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
}
-std::vector<Geom::Path>
-LPEPowerStroke::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in)
{
using namespace Geom;
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
if (path_in.empty()) {
return path_out;
}
@@ -737,12 +675,12 @@ LPEPowerStroke::doEffect_path (std::vector<Geom::Path> const & path_in)
default:
{
double radius1 = 0.5 * distance(pwd2_out.lastValue(), mirrorpath.firstValue());
- fixed_path.appendNew<SVGEllipticalArc>( radius1, radius1, M_PI/2., false, y.lastValue() < 0, mirrorpath.firstValue() );
+ fixed_path.appendNew<EllipticalArc>( radius1, radius1, M_PI/2., false, y.lastValue() < 0, mirrorpath.firstValue() );
break;
}
}
- fixed_path.append(fixed_mirrorpath, Geom::Path::STITCH_DISCONTINUOUS);
+ fixed_path.append(fixed_mirrorpath);
switch (start_linecap) {
case LINECAP_ZERO_WIDTH:
@@ -775,7 +713,7 @@ LPEPowerStroke::doEffect_path (std::vector<Geom::Path> const & path_in)
default:
{
double radius2 = 0.5 * distance(pwd2_out.firstValue(), mirrorpath.lastValue());
- fixed_path.appendNew<SVGEllipticalArc>( radius2, radius2, M_PI/2., false, y.firstValue() < 0, pwd2_out.firstValue() );
+ fixed_path.appendNew<EllipticalArc>( radius2, radius2, M_PI/2., false, y.firstValue() < 0, pwd2_out.firstValue() );
break;
}
}
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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::Path> 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<std::vector<Point> > 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 c5e002351..33ffd96d6 100644
--- a/src/live_effects/lpe-roughen.cpp
+++ b/src/live_effects/lpe-roughen.cpp
@@ -271,8 +271,8 @@ SPCurve *LPERoughen::addNodesAndJitter(const Geom::Curve *A, double t)
}
if (cubic) {
std::pair<Geom::CubicBezier, Geom::CubicBezier> div = cubic->subdivide(t);
- std::vector<Geom::Point> seg1 = div.first.points(),
- seg2 = div.second.points();
+ std::vector<Geom::Point> 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<D2<SBasis> > seg(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y])));
+ Piecewise<D2<SBasis> > seg(D2<SBasis>(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<Geom::Path> LPEShowHandles::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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<Geom::Path>
-LPESkeleton::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPESkeleton::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
- virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
+// virtual Geom::PathVector doEffect_path (Geom::PathVector const &path_in);
+ virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &pwd2_in);
/* the knotholder entity classes (if any) can be declared friends */
//friend class Skeleton::KnotHolderEntityMyHandle;
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<Geom::D2<Geom::SBasis> > 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=(r<l)?r:l;
//collect the tgt segment into output.
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 <typeinfo>
#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<Geom::D2<Geom::SBasis> > const
C = ptA - derivA * length_left;
D = ptA + derivA * length_right;
- output = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y])));
+ output = Piecewise<D2<SBasis> >(D2<SBasis>(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<D2<SBasis> > 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 5765febbd..ef616f802 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>
@@ -194,7 +193,7 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > 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
@@ -318,7 +317,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<LineJoinType>(join_type.get_value()));
+ throwaway_path = half_outline(pathv_out[1].reversed(), fabs(line_width)/2., miter_limit, static_cast<LineJoinType>(join_type.get_value()));
if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) {
real_path.appendNew<Geom::LineSegment>(throwaway_path.initialPoint());
@@ -483,7 +482,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.
@@ -508,10 +507,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<D2<SBasis> > 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<Geom::Path>
-LPEdoEffectStackTest::doEffect_path (std::vector<Geom::Path> 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<Geom::Path> 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<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > 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<Geom::Path>
-LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEVonKoch::doEffect_path (Geom::PathVector const & path_in)
{
using namespace Geom;
- std::vector<Geom::Path> 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<Geom::Path> const & path_in)
}
//Generate path:
- std::vector<Geom::Path> pathi = path_in;
- std::vector<Geom::Path> path_out = path_in;
+ Geom::PathVector pathi = path_in;
+ Geom::PathVector path_out = path_in;
for (unsigned i = 0; i<nbgenerations; i++){
if (drawall.get_value()){
path_out = path_in;
complexity = path_in_complexity;
}else{
- path_out = std::vector<Geom::Path>();
+ path_out = Geom::PathVector();
complexity = 0;
}
for (unsigned j = 0; j<transforms.size(); j++){
@@ -203,7 +203,7 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
hp_vec.push_back(refbox_as_vect);
}
//Draw the transformed boxes
- std::vector<Geom::Path> generating_path = generator.get_pathvector();
+ Geom::PathVector generating_path = generator.get_pathvector();
for (unsigned i=0;i<generating_path.size(); i++){
if (generating_path[i].size()==0){
//Ooops! this should not happen.
@@ -243,7 +243,7 @@ LPEVonKoch::doBeforeEffect (SPLPEItem const* lpeitem)
using namespace Geom;
original_bbox(lpeitem);
- std::vector<Geom::Path> 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<LineSegment>(B);
- std::vector<Geom::Path> 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<Geom::Path> paths,refpaths;
+ Geom::PathVector paths,refpaths;
Geom::Path path = Geom::Path(A);
path.appendNew<Geom::LineSegment>(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<Geom::Path> paths;
+ //Geom::PathVector paths;
//Geom::Path path = Geom::Path( (Point) refA);
//path.appendNew<Geom::LineSegment>( (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<Geom::Path> doEffect_path (std::vector<Geom::Path> 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 43352507e..b089213fd 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>
@@ -205,7 +204,7 @@ void FilletChamferPointArrayParam::recalculate_controlpoints_for_new_pwd2(
//delete temp vector
std::vector<Point>().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 +222,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 +233,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;
}
@@ -396,8 +395,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++;
@@ -413,7 +412,7 @@ void FilletChamferPointArrayParam::addCanvasIndicators(
double FilletChamferPointArrayParam::rad_to_len(int index, double rad)
{
double len = 0;
- std::vector<Geom::Path> subpaths = path_from_piecewise(last_pwd2, 0.1);
+ Geom::PathVector subpaths = path_from_piecewise(last_pwd2, 0.1);
std::pair<std::size_t, std::size_t> positions = get_positions(index, subpaths);
D2<SBasis> A = last_pwd2[last_index(index, subpaths)];
if(positions.second != 0){
@@ -431,7 +430,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){
@@ -446,7 +445,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<Geom::Path> subpaths = path_from_piecewise(last_pwd2, 0.1);
+ Geom::PathVector subpaths = path_from_piecewise(last_pwd2, 0.1);
std::pair<std::size_t, std::size_t> positions = get_positions(index, subpaths);
Piecewise<D2<SBasis> > u;
u.push_cut(0);
@@ -478,14 +477,14 @@ double FilletChamferPointArrayParam::len_to_rad(int index, double len)
if (cubic2) {
ray2.setPoints(endArcPoint, (*cubic2)[1]);
}
- bool ccwToggle = cross(A->finalPoint() - 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);
return rad * -1;
}
-std::vector<double> FilletChamferPointArrayParam::get_times(int index, std::vector<Geom::Path> subpaths, bool last)
+std::vector<double> FilletChamferPointArrayParam::get_times(int index, Geom::PathVector subpaths, bool last)
{
const double tolerance = 0.001;
const double gapHelper = 0.00001;
@@ -540,7 +539,7 @@ std::vector<double> FilletChamferPointArrayParam::get_times(int index, std::vect
return out;
}
-std::pair<std::size_t, std::size_t> FilletChamferPointArrayParam::get_positions(int index, std::vector<Geom::Path> subpaths)
+std::pair<std::size_t, std::size_t> FilletChamferPointArrayParam::get_positions(int index, Geom::PathVector subpaths)
{
int counter = -1;
std::size_t first = 0;
@@ -582,7 +581,7 @@ std::pair<std::size_t, std::size_t> FilletChamferPointArrayParam::get_positions(
return out;
}
-int FilletChamferPointArrayParam::last_index(int index, std::vector<Geom::Path> subpaths)
+int FilletChamferPointArrayParam::last_index(int index, Geom::PathVector subpaths)
{
int counter = -1;
bool inSubpath = false;
@@ -708,9 +707,9 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_set(Point const &p,
return;
}
Piecewise<D2<SBasis> > 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;
}
@@ -802,7 +801,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<Geom::Path> subpaths = path_from_piecewise(_pparam->last_pwd2, 0.1);
+ Geom::PathVector subpaths = path_from_piecewise(_pparam->last_pwd2, 0.1);
std::pair<std::size_t, std::size_t> positions = _pparam->get_positions(_index, subpaths);
D2<SBasis> 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 9bfd86b41..48cd26d2d 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<std::size_t, std::size_t> get_positions(int index, std::vector<Geom::Path> subpaths);
- virtual int last_index(int index, std::vector<Geom::Path> subpaths);
- std::vector<double> get_times(int index, std::vector<Geom::Path> subpaths, bool last);
+ virtual std::pair<std::size_t, std::size_t> get_positions(int index, Geom::PathVector subpaths);
+ virtual int last_index(int index, Geom::PathVector subpaths);
+ std::vector<double> 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<Geom::Path> _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 32e82ff8c..e0369e662 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<Geom::Path> 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<Geom::Path>).
+ * See comments for set_new_value(Geom::PathVector).
*/
void
PathParam::set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & newpath, bool write_to_svg)
@@ -291,7 +291,7 @@ PathParam::set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > 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<Geom::Path> 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<Geom::Path> const & get_pathvector() const;
+ Geom::PathVector const & get_pathvector() const;
Geom::Piecewise<Geom::D2<Geom::SBasis> > 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<Geom::Path> const &newpath, bool write_to_svg);
+ void set_new_value (Geom::PathVector const &newpath, bool write_to_svg);
void set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > 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<Geom::Path> _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<Geom::D2<Geom::SBasis> > _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<D2<SBasis> > 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);