diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-08-01 17:42:13 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-08-01 17:42:13 +0000 |
| commit | ada6f921ce0b91a34e3d9f6ce459af283c8551fd (patch) | |
| tree | c5ac448e69571b338c23b05abd7d05a95ec6d351 | |
| parent | Helperpath for lpe-rotate-copies (diff) | |
| download | inkscape-ada6f921ce0b91a34e3d9f6ce459af283c8551fd.tar.gz inkscape-ada6f921ce0b91a34e3d9f6ce459af283c8551fd.zip | |
simplify code
(bzr r6510)
| -rw-r--r-- | src/live_effects/lpe-copy_rotate.cpp | 20 | ||||
| -rw-r--r-- | src/live_effects/lpe-copy_rotate.h | 3 |
2 files changed, 10 insertions, 13 deletions
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 79312ad9b..5fd33605b 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -90,6 +90,11 @@ LPECopyRotate::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p { using namespace Geom; + // I first suspected the minus sign to be a bug in 2geom but it is + // likely due to SVG's choice of coordinate system orientation (max) + start_pos = origin + dir * Rotate(-deg_to_rad(starting_angle)) * dist_angle_handle; + rot_pos = origin + dir * Rotate(-deg_to_rad(starting_angle + rotation_angle)) * dist_angle_handle; + A = pwd2_in.firstValue(); B = pwd2_in.lastValue(); dir = unit_vector(B - A); @@ -113,9 +118,6 @@ LPECopyRotate::addCanvasIndicators(SPLPEItem *lpeitem, std::vector<Geom::PathVec { using namespace Geom; - Point start_pos = origin + dir * Rotate(-deg_to_rad(starting_angle)) * dist_angle_handle; - Point rot_pos = origin + dir * Rotate(-deg_to_rad(starting_angle + rotation_angle)) * dist_angle_handle; - Path path(start_pos); path.appendNew<LineSegment>((Geom::Point) origin); path.appendNew<LineSegment>(rot_pos); @@ -185,22 +187,14 @@ NR::Point KnotHolderEntityStartingAngle::knot_get() { LPECopyRotate* lpe = get_effect(item); - // I first suspected the minus sign to be a bug in 2geom but it is - // likely due to SVG's choice of coordinate system orientation (max) - Point d = lpe->dir * Rotate(-deg_to_rad(lpe->starting_angle)) * lpe->dist_angle_handle; - - return snap_knot_position(lpe->origin + d); + return snap_knot_position(lpe->start_pos); } NR::Point KnotHolderEntityRotationAngle::knot_get() { LPECopyRotate* lpe = get_effect(item); - // I first suspected the minus sign to be a bug in 2geom but it is - // likely due to SVG's choice of coordinate system orientation (max) - Point d = lpe->dir * Rotate(-deg_to_rad(lpe->starting_angle + lpe->rotation_angle)) * lpe->dist_angle_handle; - - return snap_knot_position(lpe->origin + d); + return snap_knot_position(lpe->rot_pos); } } // namespace CR diff --git a/src/live_effects/lpe-copy_rotate.h b/src/live_effects/lpe-copy_rotate.h index 7cf9bdef7..8cabdfb48 100644 --- a/src/live_effects/lpe-copy_rotate.h +++ b/src/live_effects/lpe-copy_rotate.h @@ -52,6 +52,9 @@ private: Geom::Point A; Geom::Point B; Geom::Point dir; + + Geom::Point start_pos; + Geom::Point rot_pos; double dist_angle_handle; LPECopyRotate(const LPECopyRotate&); |
