From d4200d96d8369f38efb722b04869b360388eeb80 Mon Sep 17 00:00:00 2001 From: cilix42 Date: Fri, 1 Aug 2008 17:42:13 +0000 Subject: [PATCH] simplify code --- src/live_effects/lpe-copy_rotate.cpp | 20 +++++++------------- 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 > 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::Point) origin); path.appendNew(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&); -- 2.30.2