From 241347e25e559460b985f944bbcb2b5c9c910c86 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Sep 2014 03:35:12 +0200 Subject: Fillet-Chamfer update. Two things. Helper paths on knots: now work well in rect and curves Method: Now the method ase selectable. Three methods: Auto: Straight lines whith arcs and curves whith bezier Arc: Always use arc. Bezier: Always use bezier. (bzr r13341.1.225) --- .../parameter/filletchamferpointarray.cpp | 37 +++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'src/live_effects/parameter/filletchamferpointarray.cpp') diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index bb00ef045..e2b1aba61 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -8,11 +8,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include - -#include "ui/dialog/lpe-fillet-chamfer-properties.h" -#include "live_effects/parameter/filletchamferpointarray.h" - #include <2geom/piecewise.h> #include <2geom/sbasis-to-bezier.h> #include <2geom/sbasis-geometric.h> @@ -384,25 +379,29 @@ void FilletChamferPointArrayParam::updateCanvasIndicators() std::vector ts = data(); hp.clear(); unsigned int i = 0; - Piecewise > const &n = get_pwd2_normal(); for (std::vector::const_iterator point_it = ts.begin(); point_it != ts.end(); ++point_it) { - double Xvalue = to_time(i, (*point_it)[X]); - double XPlusValue = to_time(i, -helper_size) - i; - if (Xvalue == i) { + double Xvalue = to_time(i, (*point_it)[X]) -i; + if (Xvalue == 0) { i++; continue; } - Point canvas_point = last_pwd2.valueAt(Xvalue) + 0 * n.valueAt(Xvalue); - Point start_point = last_pwd2.valueAt(Xvalue + XPlusValue) + - helper_size * n.valueAt(Xvalue + XPlusValue); - Point end_point = last_pwd2.valueAt(Xvalue + XPlusValue) - - helper_size * n.valueAt(Xvalue + XPlusValue); - Geom::Path arrow; - arrow.start(start_point); - arrow.appendNew(canvas_point); - arrow.appendNew(end_point); - hp.push_back(arrow); + Geom::Point ptA = last_pwd2[i].valueAt(Xvalue); + Geom::Point derivA = unit_vector(derivative(last_pwd2[i]).valueAt(Xvalue)); + Geom::Rotate rot(Geom::Rotate::from_degrees(-90)); + derivA = derivA * rot; + Geom::Point C = ptA - derivA * helper_size; + Geom::Point D = ptA + derivA * helper_size; + Geom::Ray ray1(C, D); + char const * svgd = "M 1,0.25 0.5,0 1,-0.25 M 1,0.5 0,0 1,-0.5"; + Geom::PathVector pathv = sp_svg_read_pathv(svgd); + Geom::Affine aff = Geom::Affine(); + aff *= Geom::Scale(helper_size); + aff *= Geom::Rotate(ray1.angle() - deg_to_rad(270)); + pathv *= aff; + pathv += last_pwd2[i].valueAt(Xvalue); + hp.push_back(pathv[0]); + hp.push_back(pathv[1]); i++; } } -- cgit v1.2.3