diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2015-07-04 16:15:46 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2015-07-04 16:15:46 +0000 |
| commit | 1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8 (patch) | |
| tree | a91517f9165322b4e42c6cdeb4263beaedc4d02f /src/live_effects/parameter | |
| parent | Packaging. New Win32 installer Danish translation. (diff) | |
| parent | Upgrade to 2Geom r2413 (diff) | |
| download | inkscape-1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8.tar.gz inkscape-1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8.zip | |
Sync 2Geom to revision 2413.
May introduce regressions.
(bzr r14226)
Diffstat (limited to 'src/live_effects/parameter')
| -rw-r--r-- | src/live_effects/parameter/filletchamferpointarray.cpp | 29 | ||||
| -rw-r--r-- | src/live_effects/parameter/filletchamferpointarray.h | 6 | ||||
| -rw-r--r-- | src/live_effects/parameter/originalpatharray.h | 2 | ||||
| -rw-r--r-- | src/live_effects/parameter/path.cpp | 6 | ||||
| -rw-r--r-- | src/live_effects/parameter/path.h | 6 | ||||
| -rw-r--r-- | src/live_effects/parameter/powerstrokepointarray.cpp | 4 |
6 files changed, 26 insertions, 27 deletions
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); |
