summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es>2017-12-01 19:54:29 +0000
committerJabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es>2017-12-01 19:54:29 +0000
commitcbdd1dfb6d9e228c82905cc5032eef81164887d6 (patch)
tree780faf2409c30ec2bda6cf59dad1788abfa5c5e6 /src
parentAdd show handles (diff)
downloadinkscape-cbdd1dfb6d9e228c82905cc5032eef81164887d6.tar.gz
inkscape-cbdd1dfb6d9e228c82905cc5032eef81164887d6.zip
Remobe BSPline interpolator, a non success code and remove showhandles code
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-interpolate_points.cpp3
-rw-r--r--src/live_effects/lpe-powerstroke-interpolators.h56
-rw-r--r--src/live_effects/lpe-powerstroke.cpp3
-rw-r--r--src/live_effects/lpe-show_handles.cpp23
-rw-r--r--src/live_effects/lpe-show_handles.h1
5 files changed, 5 insertions, 81 deletions
diff --git a/src/live_effects/lpe-interpolate_points.cpp b/src/live_effects/lpe-interpolate_points.cpp
index c745921c2..7d4c88dc1 100644
--- a/src/live_effects/lpe-interpolate_points.cpp
+++ b/src/live_effects/lpe-interpolate_points.cpp
@@ -25,8 +25,7 @@ static const Util::EnumData<unsigned> InterpolatorTypeData[] = {
{Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"},
{Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"},
{Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"},
- {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"},
- {Geom::Interpolate::INTERP_BSPLINE , N_("BSpline"), "BSpline"}
+ {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"}
};
static const Util::EnumDataConverter<unsigned> InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData));
diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h
index 21d25a797..e3ab37e27 100644
--- a/src/live_effects/lpe-powerstroke-interpolators.h
+++ b/src/live_effects/lpe-powerstroke-interpolators.h
@@ -15,7 +15,7 @@
#include <2geom/path.h>
#include <2geom/bezier-utils.h>
#include <2geom/sbasis-to-bezier.h>
-#include <math.h>
+
#include "live_effects/spiro.h"
@@ -27,7 +27,6 @@ enum InterpolatorType {
INTERP_LINEAR,
INTERP_CUBICBEZIER,
INTERP_CUBICBEZIER_JOHAN,
- INTERP_BSPLINE,
INTERP_SPIRO,
INTERP_CUBICBEZIER_SMOOTH,
INTERP_CENTRIPETAL_CATMULLROM
@@ -66,57 +65,6 @@ private:
Linear& operator=(const Linear&);
};
-class BSpline : public Interpolator {
-public:
- BSpline() {};
- virtual ~BSpline() {};
-
- virtual Path interpolateToPath(std::vector<Point> const &points) const {
- Path path;
- path.start( points.at(0) );
- Geom::Point handle_1(0,0);
- Geom::Point handle_prev = points.at(0);
- for (unsigned int i = 1 ; i < points.size() - 1; ++i) {
- Geom::Line line_a(points.at(i - 1), points.at(i));
- double angle_a = line_a.angle();
- Geom::Line line_b(points.at(i),points.at(i + 1));
- double angle_b = line_b.angle();
- Geom::Line line_handles(line_a.pointAt(0.66667),line_b.pointAt(0.33334));
- line_handles *= Geom::Translate(points.at(i) - line_handles.pointAt(0.5));
- Geom::Line line_perp_a(line_a.pointAt(0.5), Geom::Point::polar(angle_a + Geom::rad_from_deg(90),1) +line_a.pointAt(0.5));
- Geom::Line line_perp_b(line_b.pointAt(0.5), Geom::Point::polar(angle_b + Geom::rad_from_deg(90),1) +line_b.pointAt(0.5));
- std::vector<CurveIntersection> result = line_perp_a.intersect(line_perp_b);
- Geom::Point handle_2(0,0);
- if(result.size() > 0) {
- Geom::Line line_to_handle_a(result[0],line_a.pointAt(0.66667));
- Geom::Line line_to_handle_b(result[0],line_b.pointAt(0.33334));
- std::vector<CurveIntersection> handle_a_res = line_to_handle_a.intersect(line_handles);
- std::vector<CurveIntersection> handle_b_res = line_to_handle_b.intersect(line_handles);
- if(handle_a_res.size() > 0) {
- handle_2 = handle_a_res[0];
- }
- if(handle_a_res.size() > 0) {
- handle_1 = handle_b_res[0];
- }
- }
- if (i == 1) {
- Geom::Line start_segment(handle_prev,handle_2);
- handle_prev = start_segment.pointAt(0.5);
- }
- path.appendNew<CubicBezier>(handle_prev, handle_2, points.at(i));
- handle_prev = handle_1;
- }
- Geom::Point last = points.at(points.size()-1);
- Geom::Line last_segment(last,handle_1);
- path.appendNew<CubicBezier>(handle_1, last_segment.pointAt(0.5), last);
- return path;
- };
-
-private:
- BSpline(const BSpline&);
- BSpline& operator=(const BSpline&);
-};
-
// this class is terrible
class CubicBezierFit : public Interpolator {
public:
@@ -354,8 +302,6 @@ Interpolator::create(InterpolatorType type) {
return new Geom::Interpolate::CubicBezierSmooth();
case INTERP_CENTRIPETAL_CATMULLROM:
return new Geom::Interpolate::CentripetalCatmullRomInterpolator();
- case INTERP_BSPLINE:
- return new Geom::Interpolate::BSpline();
default:
return new Geom::Interpolate::Linear();
}
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index b2b55a08c..96f487211 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -123,8 +123,7 @@ static const Util::EnumData<unsigned> InterpolatorTypeData[] = {
{Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"},
{Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"},
{Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"},
- {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"},
- {Geom::Interpolate::INTERP_BSPLINE , N_("BSpline"), "BSpline"}
+ {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"}
};
static const Util::EnumDataConverter<unsigned> InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData));
diff --git a/src/live_effects/lpe-show_handles.cpp b/src/live_effects/lpe-show_handles.cpp
index 2da570537..7c298d0e7 100644
--- a/src/live_effects/lpe-show_handles.cpp
+++ b/src/live_effects/lpe-show_handles.cpp
@@ -12,7 +12,6 @@
#include <2geom/svg-path-parser.h>
#include "helper/geom.h"
#include "desktop-style.h"
-#include "display/curve.h"
#include "style.h"
#include "svg/svg.h"
@@ -28,14 +27,12 @@ LPEShowHandles::LPEShowHandles(LivePathEffectObject *lpeobject)
handles(_("Show handles"), _("Show handles"), "handles", &wr, this, true),
original_path(_("Show path"), _("Show path"), "original_path", &wr, this, true),
show_center_node(_("Show center of node"), _("Show center of node"), "show_center_node", &wr, this, false),
- original_d(_("Show original"), _("Show original"), "original_d", &wr, this, false),
scale_nodes_and_handles(_("Scale nodes and handles"), _("Scale nodes and handles"), "scale_nodes_and_handles", &wr, this, 10)
{
registerParameter(&nodes);
registerParameter(&handles);
registerParameter(&original_path);
registerParameter(&show_center_node);
- registerParameter(&original_d);
registerParameter(&scale_nodes_and_handles);
scale_nodes_and_handles.param_set_range(0, 500.);
scale_nodes_and_handles.param_set_increments(1, 1);
@@ -83,7 +80,7 @@ void LPEShowHandles::doBeforeEffect (SPLPEItem const* lpeitem)
Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in)
{
Geom::PathVector path_out;
- Geom::PathVector original_pathv = pathv_to_linear_and_cubic_beziers(path_in);
+ Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(path_in);
if(original_path) {
for (unsigned int i=0; i < path_in.size(); i++) {
path_out.push_back(path_in[i]);
@@ -92,26 +89,10 @@ Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in
if(!outline_path.empty()) {
outline_path.clear();
}
- if (original_d) {
- SPCurve * shape_curve = sp_shape->getCurveBeforeLPE();
- if (shape_curve) {
- Geom::PathVector original_curve = shape_curve->get_pathvector();
- if(original_path) {
- for (unsigned int i=0; i < original_curve.size(); i++) {
- path_out.push_back(original_curve[i]);
- }
- }
- original_pathv.insert(original_pathv.end(), original_curve.begin(), original_curve.end());
- }
- generateHelperPath(original_pathv);
- shape_curve->unref();
- } else {
- generateHelperPath(original_pathv);
- }
+ generateHelperPath(original_pathv);
for (unsigned int i=0; i < outline_path.size(); i++) {
path_out.push_back(outline_path[i]);
}
-
return path_out;
}
diff --git a/src/live_effects/lpe-show_handles.h b/src/live_effects/lpe-show_handles.h
index 583be9e61..c46abd2c2 100644
--- a/src/live_effects/lpe-show_handles.h
+++ b/src/live_effects/lpe-show_handles.h
@@ -43,7 +43,6 @@ private:
BoolParam nodes;
BoolParam handles;
BoolParam original_path;
- BoolParam original_d;
BoolParam show_center_node;
ScalarParam scale_nodes_and_handles;
double stroke_width;