Code

Make LPEPerpBisector use the new nearest_point() function from point to line
authorcilix42 <cilix42@users.sourceforge.net>
Mon, 19 May 2008 16:02:19 +0000 (16:02 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Mon, 19 May 2008 16:02:19 +0000 (16:02 +0000)
src/live_effects/lpe-perp_bisector.cpp

index 2fec63f3c37141f18acde4442275fca463113d03..b31ad669635c1aeb7cc86b49b2f3c174c92f3047 100644 (file)
@@ -46,10 +46,7 @@ bisector_end_set(SPItem *item, NR::Point const &p, bool left) {
     Inkscape::LivePathEffect::LPEPerpBisector *lpe =
         (Inkscape::LivePathEffect::LPEPerpBisector *) sp_lpe_item_get_livepatheffect(SP_LPE_ITEM(item));
 
-    Geom::Point v(Geom::unit_vector(lpe->B - lpe->A));
-    Geom::Point diff(lpe->M - p.to_2geom());
-
-    double lambda = - v[Geom::Y] * diff[Geom::X] + v[Geom::X] * diff[Geom::Y];
+    double lambda = Geom::nearest_point(p.to_2geom(), lpe->M, lpe->perp_dir);
     if (left) {
         lpe->C = lpe->M + lpe->perp_dir * lambda;
         lpe->length_left.param_set_value(lambda);