Code

71611e18bdc6613fbc0a1356a2b2b09ed4200ce5
[inkscape.git] / src / live_effects / lpe-circle_with_radius.cpp
1 /** @file
2  * @brief LPE effect that draws a circle based on two points and a radius
3  * - implementation
4  */
5 /* Authors:
6  *   Johan Engelen <j.b.c.engelen@utwente.nl>
7  *
8  * Copyright (C) 2007 Authors
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
13 #include "live_effects/lpe-circle_with_radius.h"
14 #include "display/curve.h"
16 // You might need to include other 2geom files. You can add them here:
17 #include <2geom/path.h>
18 #include <2geom/sbasis.h>
19 #include <2geom/bezier-to-sbasis.h>
20 #include <2geom/d2.h>
21 #include <2geom/circle.h>
23 using namespace Geom;
25 namespace Inkscape {
26 namespace LivePathEffect {
28 LPECircleWithRadius::LPECircleWithRadius(LivePathEffectObject *lpeobject) :
29     Effect(lpeobject)//,
30     // initialise your parameters here:
31     //radius(_("Float parameter"), _("just a real number like 1.4!"), "svgname", &wr, this, 50)
32 {
33     // register all your parameters here, so Inkscape knows which parameters this effect has:
34     //registerParameter( dynamic_cast<Parameter *>(&radius) );
35 }
37 LPECircleWithRadius::~LPECircleWithRadius()
38 {
40 }
42 std::vector<Geom::Path>
43 LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> const & path_in)
44 {
45     std::vector<Geom::Path> path_out = std::vector<Geom::Path>();
47     Geom::Point center = path_in[0].initialPoint();
48     Geom::Point pt = path_in[0].finalPoint();
50     double radius = Geom::L2(pt - center);
52     Geom::Circle c(center, radius);
53     c.getPath(path_out);
55     return path_out;
56 }
58 /*
60 Geom::Piecewise<Geom::D2<Geom::SBasis> >
61 LPECircleWithRadius::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
62 {
63     Geom::Piecewise<Geom::D2<Geom::SBasis> > output;
65     output = pwd2_in;   // spice this up to make the effect actually *do* something!
67     return output;
68 }
70 */
72 /* ######################## */
74 } //namespace LivePathEffect
75 } /* namespace Inkscape */
77 /*
78   Local Variables:
79   mode:c++
80   c-file-style:"stroustrup"
81   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
82   indent-tabs-mode:nil
83   fill-column:99
84   End:
85 */
86 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :