lpe-copy_rotate.cpp revision 6b03b973a8d36d45d5345ba1013db10df1c7a5ce
#define INKSCAPE_LPE_COPY_ROTATE_CPP
/** \file
* LPE <copy_rotate> implementation
*/
/*
* Authors:
* Maximilian Albert
*
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
* Copyright (C) Maximilian Albert 2008 <maximilian.albert@gmail.com>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "live_effects/lpe-copy_rotate.h"
#include "sp-shape.h"
namespace Inkscape {
namespace LivePathEffect {
namespace CR {
class KnotHolderEntityStartingAngle : public LPEKnotHolderEntity
{
public:
};
class KnotHolderEntityRotationAngle : public LPEKnotHolderEntity
{
public:
};
} // namespace CR
rotation_angle(_("Rotation angle"), _("Angle between two successive copies"), "rotation_angle", &wr, this, 30.0),
num_copies(_("Number of copies"), _("Number of copies of the original path"), "num_copies", &wr, this, 5),
origin(_("Origin"), _("Origin of the rotation"), "origin", &wr, this, "Adjust the origin of the rotation"),
dist_angle_handle(100)
{
show_orig_path = true;
// register all your parameters here, so Inkscape knows which parameters this effect has:
num_copies.param_make_integer(true);
}
{
}
void
{
A = curve->first_point();
B = curve->last_point();
origin.param_setValue(A);
dir = unit_vector(B - A);
dist_angle_handle = L2(B - A);
}
{
using namespace Geom;
A = pwd2_in.firstValue();
dir = unit_vector(B - A);
for (int i = 0; i < num_copies; ++i) {
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
}
return output;
}
namespace CR {
using namespace Geom;
// TODO: make this more generic
static LPECopyRotate *
{
g_print ("Warning: Effect is not of type LPECopyRotate!\n");
return NULL;
}
return static_cast<LPECopyRotate *>(effect);
}
void
KnotHolderEntityStartingAngle::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state)
{
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
lpe->starting_angle.param_set_value(rad_to_deg(-angle_between(lpe->dir, s.to_2geom() - lpe->origin)));
if (state & GDK_SHIFT_MASK) {
} else {
}
// FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating.
}
void
KnotHolderEntityRotationAngle::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state)
{
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
lpe->rotation_angle.param_set_value(rad_to_deg(-angle_between(lpe->dir, s.to_2geom() - lpe->origin)) - lpe->starting_angle);
if (state & GDK_SHIFT_MASK) {
} else {
}
// FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating.
}
{
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
}
{
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
Point d = lpe->dir * Rotate(-deg_to_rad(lpe->starting_angle + lpe->rotation_angle)) * lpe->dist_angle_handle;
}
} // namespace CR
/* ######################## */
} //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 :