/*
* Copyright (C) Theodore Janeczko 2012 <flutterguy317@gmail.com>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <math.h>
#include "live_effects/lpe-attach-path.h"
#include "sp-item.h"
#include "sp-shape.h"
#include "sp-text.h"
#include "2geom/bezier-curve.h"
#include "2geom/path-sink.h"
#include "parameter/parameter.h"
#include "live_effects/parameter/point.h"
#include "parameter/originalpath.h"
namespace Inkscape {
namespace LivePathEffect {
start_path(_("Start path:"), _("Path to attach to the start of this path"), "startpath", &wr, this),
start_path_position(_("Start path position:"), _("Position to attach path start to"), "startposition", &wr, this, 0.0),
start_path_curve_start(_("Start path curve start:"), _("Starting curve"), "startcurvestart", &wr, this, Geom::Point(20,0)/*, true*/),
start_path_curve_end(_("Start path curve end:"), _("Ending curve"), "startcurveend", &wr, this, Geom::Point(20,0)/*, true*/),
end_path_position(_("End path position:"), _("Position to attach path end to"), "endposition", &wr, this, 0.0),
end_path_curve_start(_("End path curve start:"), _("Starting curve"), "endcurvestart", &wr, this, Geom::Point(20,0)/*, true*/),
end_path_curve_end(_("End path curve end:"), _("Ending curve"), "endcurveend", &wr, this, Geom::Point(20,0)/*, true*/)
{
//perceived_path = true;
show_orig_path = true;
}
{
}
{
}
{
if (start_path.linksToPath()) {
if ( !linked_pathv.empty() )
{
if (set_start_end) {
start_path_position.param_set_value(transformedpath.nearestTime(start_path_curve_end.getOrigin()).asFlatTime());
}
} else if (start_path_position < 0) {
}
std::vector<Geom::Point> derivs_2 = c->pointAndDerivatives(start_path_position >= transformedpath.size() ? 1 : (start_path_position - (int)start_path_position), 3);
double startangle = atan2(start_path_curve_start.getVector().y(), start_path_curve_start.getVector().x());
double endangle = atan2(start_path_curve_end.getVector().y(), start_path_curve_end.getVector().x());
Geom::Point pt1 = Geom::Point(start_path_curve_start.getVector().length() * cos(startangle + startderiv), start_path_curve_start.getVector().length() * sin(startangle + startderiv));
Geom::Point pt2 = Geom::Point(start_path_curve_end.getVector().length() * cos(endangle + endderiv), start_path_curve_end.getVector().length() * sin(endangle + endderiv));
p.appendNew<Geom::CubicBezier>(-pt2 + derivs_2[0], -pt1 + this_pathv.front().initialPoint(), this_pathv.front().initialPoint());
break;
}
}
break;
}
}
}
}
if (end_path.linksToPath()) {
if ( !linked_pathv.empty() )
{
if (set_end_end) {
end_path_position.param_set_value(transformedpath.nearestTime(end_path_curve_end.getOrigin()).asFlatTime());
}
} else if (end_path_position < 0) {
}
std::vector<Geom::Point> derivs_2 = c->pointAndDerivatives(end_path_position >= transformedpath.size() ? 1 : (end_path_position - (int)end_path_position), 3);
double startangle = atan2(end_path_curve_start.getVector().y(), end_path_curve_start.getVector().x());
Geom::Point pt1 = Geom::Point(end_path_curve_start.getVector().length() * cos(startangle + startderiv), end_path_curve_start.getVector().length() * sin(startangle + startderiv));
Geom::Point pt2 = Geom::Point(end_path_curve_end.getVector().length() * cos(endangle + endderiv), end_path_curve_end.getVector().length() * sin(endangle + endderiv));
p.appendNew<Geom::CubicBezier>(-pt1 + this_pathv.front().finalPoint(), -pt2 + derivs_2[0], derivs_2[0]);
break;
}
}
break;
}
}
delete last_seg_reverse;
}
}
}
}
} // 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 :