summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5dee771)
raw | patch | inline | side by side (parent: 5dee771)
author | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 8 Jul 2008 21:18:50 +0000 (21:18 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 8 Jul 2008 21:18:50 +0000 (21:18 +0000) |
src/live_effects/CMakeLists.txt | patch | blob | history | |
src/live_effects/Makefile_insert | patch | blob | history | |
src/live_effects/effect.cpp | patch | blob | history | |
src/live_effects/effect.h | patch | blob | history | |
src/live_effects/lpe-mirror_reflect.cpp | [deleted file] | patch | blob | history |
src/live_effects/lpe-mirror_reflect.h | [deleted file] | patch | blob | history |
src/live_effects/lpe-mirror_symmetry.cpp | [new file with mode: 0644] | patch | blob |
src/live_effects/lpe-mirror_symmetry.h | [new file with mode: 0644] | patch | blob |
index 38b6521066f554e758623ab76f3247e4505f8d1e..c50c103575fb475d24e01d53ae849f8ccd13aa67 100644 (file)
lpegroupbbox.cpp
lpe-knot.cpp
lpe-lattice.cpp
-lpe-mirror_reflect.cpp
+lpe-mirror_symmetry.cpp
lpeobject.cpp
lpeobject-reference.cpp
lpe-patternalongpath.cpp
index 366a94883ba93170f2b7a3cfd952da102fa3ea8e..b9f86454612e3364d8f24351586164152df67ab0 100644 (file)
live_effects/lpe-circle_with_radius.h \
live_effects/lpe-perspective_path.cpp \
live_effects/lpe-perspective_path.h \
- live_effects/lpe-mirror_reflect.cpp \
- live_effects/lpe-mirror_reflect.h \
+ live_effects/lpe-mirror_symmetry.cpp \
+ live_effects/lpe-mirror_symmetry.h \
live_effects/lpe-circle_3pts.cpp \
live_effects/lpe-circle_3pts.h \
live_effects/lpe-angle_bisector.cpp \
index 339e5c83385bd29942cfd57fd622869f812f6b51..66d2334e018684ad2ed8b74748c9ab8853dfb012 100644 (file)
#include "live_effects/lpe-constructgrid.h"
#include "live_effects/lpe-perp_bisector.h"
#include "live_effects/lpe-tangent_to_curve.h"
-#include "live_effects/lpe-mirror_reflect.h"
+#include "live_effects/lpe-mirror_symmetry.h"
#include "live_effects/lpe-circle_3pts.h"
#include "live_effects/lpe-angle_bisector.h"
#include "live_effects/lpe-parallel.h"
{CONSTRUCT_GRID, N_("Construct grid"), "construct_grid"},
{PERP_BISECTOR, N_("Perpendicular bisector"), "perp_bisector"},
{TANGENT_TO_CURVE, N_("Tangent to curve"), "tangent_to_curve"},
- {MIRROR_REFLECT, N_("Mirror reflection"), "mirror_reflect"},
+ {MIRROR_SYMMETRY, N_("Mirror symmetry"), "mirror_symmetry"},
{CIRCLE_3PTS, N_("Circle through 3 points"), "circle_3pts"},
{ANGLE_BISECTOR, N_("Angle bisector"), "angle_bisector"},
{PARALLEL, N_("Parallel"), "parallel"},
case TANGENT_TO_CURVE:
neweffect = static_cast<Effect*> ( new LPETangentToCurve(lpeobj) );
break;
- case MIRROR_REFLECT:
- neweffect = static_cast<Effect*> ( new LPEMirrorReflect(lpeobj) );
+ case MIRROR_SYMMETRY:
+ neweffect = static_cast<Effect*> ( new LPEMirrorSymmetry(lpeobj) );
break;
case CIRCLE_3PTS:
neweffect = static_cast<Effect*> ( new LPECircle3Pts(lpeobj) );
index 38c9ccdaaadfe64aef5b4c8d47ff71e55a4eeb16..dc5d6ec4a1fb6fcdfa18be85b71fcb5123daa13b 100644 (file)
CONSTRUCT_GRID,
PERP_BISECTOR,
TANGENT_TO_CURVE,
- MIRROR_REFLECT,
+ MIRROR_SYMMETRY,
CIRCLE_3PTS,
ANGLE_BISECTOR,
PARALLEL,
diff --git a/src/live_effects/lpe-mirror_reflect.cpp b/src/live_effects/lpe-mirror_reflect.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-#define INKSCAPE_LPE_MIRROR_REFLECT_CPP
-/** \file
- * LPE <mirror_reflection> implementation: mirrors a path with respect to a given line.
- */
-/*
- * Authors:
- * Maximilian Albert
- * Johan Engelen
- *
- * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
- * Copyright (C) Maximilin Albert 2008 <maximilian.albert@gmail.com>
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "live_effects/lpe-mirror_reflect.h"
-#include <sp-path.h>
-#include <display/curve.h>
-#include <svg/path-string.h>
-
-#include <2geom/path.h>
-#include <2geom/transforms.h>
-#include <2geom/matrix.h>
-
-namespace Inkscape {
-namespace LivePathEffect {
-
-LPEMirrorReflect::LPEMirrorReflect(LivePathEffectObject *lpeobject) :
- Effect(lpeobject),
- discard_orig_path(_("Discard original path?"), _("Check this to only keep the mirrored part of the path"), "discard_orig_path", &wr, this, false),
- reflection_line(_("Reflection line"), _("Line which serves as 'mirror' for the reflection"), "reflection_line", &wr, this, "M0,0 L100,100")
-{
- show_orig_path = true;
-
- registerParameter( dynamic_cast<Parameter *>(&discard_orig_path) );
- registerParameter( dynamic_cast<Parameter *>(&reflection_line) );
-}
-
-LPEMirrorReflect::~LPEMirrorReflect()
-{
-
-}
-
-void
-LPEMirrorReflect::acceptParamPath (SPPath *param_path) {
- using namespace Geom;
-
- SPCurve* curve = sp_path_get_curve_for_edit (param_path);
- Geom::Point A(curve->first_point().to_2geom());
- Geom::Point B(curve->last_point().to_2geom());
-
- Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(A[X], B[X]), Linear(A[Y], B[Y])));
- reflection_line.param_set_and_write_new_value(rline);
-
- SP_OBJECT(param_path)->deleteObject(true);
-
- // don't remove this; needed for cleanup tasks
- Effect::acceptParamPath(param_path);
-}
-
-std::vector<Geom::Path>
-LPEMirrorReflect::doEffect_path (std::vector<Geom::Path> const & path_in)
-{
- std::vector<Geom::Path> path_out;
- if (!discard_orig_path) {
- path_out = path_in;
- }
-
- std::vector<Geom::Path> mline(reflection_line.get_pathvector());
- Geom::Point A(mline.front().initialPoint());
- Geom::Point B(mline.back().finalPoint());
-
- Geom::Matrix m1(1.0, 0.0, 0.0, 1.0, A[0], A[1]);
- double hyp = Geom::distance(A, B);
- double c = (B[0] - A[0]) / hyp; // cos(alpha)
- double s = (B[1] - A[1]) / hyp; // sin(alpha)
-
- Geom::Matrix m2(c, -s, s, c, 0.0, 0.0);
- Geom::Matrix sca(1.0, 0.0, 0.0, -1.0, 0.0, 0.0);
-
- Geom::Matrix m = m1.inverse() * m2;
- m = m * sca;
- m = m * m2.inverse();
- m = m * m1;
-
- for (int i = 0; i < static_cast<int>(path_in.size()); ++i) {
- path_out.push_back(path_in[i] * m);
- }
-
- return path_out;
-}
-
-/* ######################## */
-
-} //namespace LivePathEffect
-} /* namespace Inkscape */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/live_effects/lpe-mirror_reflect.h b/src/live_effects/lpe-mirror_reflect.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef INKSCAPE_LPE_MIRROR_REFLECT_H
-#define INKSCAPE_LPE_MIRROR_REFLECT_H
-
-/** \file
- * LPE <mirror_reflection> implementation: mirrors a path with respect to a given line.
- */
-/*
- * Authors:
- * Maximilian Albert
- * Johan Engelen
- *
- * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
- * Copyright (C) Maximilin Albert 2008 <maximilian.albert@gmail.com>
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "live_effects/effect.h"
-#include "live_effects/parameter/parameter.h"
-#include "live_effects/parameter/point.h"
-#include "live_effects/parameter/path.h"
-
-namespace Inkscape {
-namespace LivePathEffect {
-
-class LPEMirrorReflect : public Effect {
-public:
- LPEMirrorReflect(LivePathEffectObject *lpeobject);
- virtual ~LPEMirrorReflect();
-
- virtual void acceptParamPath (SPPath *param_path);
- virtual int acceptsNumParams() { return 2; }
-
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
-
-private:
- BoolParam discard_orig_path;
- PathParam reflection_line;
-
- LPEMirrorReflect(const LPEMirrorReflect&);
- LPEMirrorReflect& operator=(const LPEMirrorReflect&);
-};
-
-} //namespace LivePathEffect
-} //namespace Inkscape
-
-#endif
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
--- /dev/null
@@ -0,0 +1,107 @@
+#define INKSCAPE_LPE_MIRROR_SYMMETRY_CPP
+/** \file
+ * LPE <mirror_symmetry> implementation: mirrors a path with respect to a given line.
+ */
+/*
+ * Authors:
+ * Maximilian Albert
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
+ * Copyright (C) Maximilin Albert 2008 <maximilian.albert@gmail.com>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/lpe-mirror_symmetry.h"
+#include <sp-path.h>
+#include <display/curve.h>
+#include <svg/path-string.h>
+
+#include <2geom/path.h>
+#include <2geom/transforms.h>
+#include <2geom/matrix.h>
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+LPEMirrorSymmetry::LPEMirrorSymmetry(LivePathEffectObject *lpeobject) :
+ Effect(lpeobject),
+ discard_orig_path(_("Discard original path?"), _("Check this to only keep the mirrored part of the path"), "discard_orig_path", &wr, this, false),
+ reflection_line(_("Reflection line"), _("Line which serves as 'mirror' for the reflection"), "reflection_line", &wr, this, "M0,0 L100,100")
+{
+ show_orig_path = true;
+
+ registerParameter( dynamic_cast<Parameter *>(&discard_orig_path) );
+ registerParameter( dynamic_cast<Parameter *>(&reflection_line) );
+}
+
+LPEMirrorSymmetry::~LPEMirrorSymmetry()
+{
+
+}
+
+void
+LPEMirrorSymmetry::acceptParamPath (SPPath *param_path) {
+ using namespace Geom;
+
+ SPCurve* curve = sp_path_get_curve_for_edit (param_path);
+ Geom::Point A(curve->first_point().to_2geom());
+ Geom::Point B(curve->last_point().to_2geom());
+
+ Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(A[X], B[X]), Linear(A[Y], B[Y])));
+ reflection_line.param_set_and_write_new_value(rline);
+
+ SP_OBJECT(param_path)->deleteObject(true);
+
+ // don't remove this; needed for cleanup tasks
+ Effect::acceptParamPath(param_path);
+}
+
+std::vector<Geom::Path>
+LPEMirrorSymmetry::doEffect_path (std::vector<Geom::Path> const & path_in)
+{
+ std::vector<Geom::Path> path_out;
+ if (!discard_orig_path) {
+ path_out = path_in;
+ }
+
+ std::vector<Geom::Path> mline(reflection_line.get_pathvector());
+ Geom::Point A(mline.front().initialPoint());
+ Geom::Point B(mline.back().finalPoint());
+
+ Geom::Matrix m1(1.0, 0.0, 0.0, 1.0, A[0], A[1]);
+ double hyp = Geom::distance(A, B);
+ double c = (B[0] - A[0]) / hyp; // cos(alpha)
+ double s = (B[1] - A[1]) / hyp; // sin(alpha)
+
+ Geom::Matrix m2(c, -s, s, c, 0.0, 0.0);
+ Geom::Matrix sca(1.0, 0.0, 0.0, -1.0, 0.0, 0.0);
+
+ Geom::Matrix m = m1.inverse() * m2;
+ m = m * sca;
+ m = m * m2.inverse();
+ m = m * m1;
+
+ for (int i = 0; i < static_cast<int>(path_in.size()); ++i) {
+ path_out.push_back(path_in[i] * m);
+ }
+
+ return path_out;
+}
+
+/* ######################## */
+
+} //namespace LivePathEffect
+} /* namespace Inkscape */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef INKSCAPE_LPE_MIRROR_SYMMETRY_H
+#define INKSCAPE_LPE_MIRROR_SYMMETRY_H
+
+/** \file
+ * LPE <mirror_symmetry> implementation: mirrors a path with respect to a given line.
+ */
+/*
+ * Authors:
+ * Maximilian Albert
+ * Johan Engelen
+ *
+ * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
+ * Copyright (C) Maximilin Albert 2008 <maximilian.albert@gmail.com>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/effect.h"
+#include "live_effects/parameter/parameter.h"
+#include "live_effects/parameter/point.h"
+#include "live_effects/parameter/path.h"
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+class LPEMirrorSymmetry : public Effect {
+public:
+ LPEMirrorSymmetry(LivePathEffectObject *lpeobject);
+ virtual ~LPEMirrorSymmetry();
+
+ virtual void acceptParamPath (SPPath *param_path);
+ virtual int acceptsNumParams() { return 2; }
+
+ virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+
+private:
+ BoolParam discard_orig_path;
+ PathParam reflection_line;
+
+ LPEMirrorSymmetry(const LPEMirrorSymmetry&);
+ LPEMirrorSymmetry& operator=(const LPEMirrorSymmetry&);
+};
+
+} //namespace LivePathEffect
+} //namespace Inkscape
+
+#endif