lpe-copy_rotate.cpp revision e26c9ddadf81406137f3c82e9457d01a5965810c
/** \file
* LPE <copy_rotate> implementation
*/
/*
* Authors:
* Maximilian Albert <maximilian.albert@gmail.com>
* Johan Engelen <j.b.c.engelen@alumnus.utwente.nl>
* Jabiertxo Arraiza Cenoz <jabier.arraiza@marker.es>
* Copyright (C) Authors 2007-2012
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "live_effects/lpe-copy_rotate.h"
#include "knot-holder-entity.h"
#include "knotholder.h"
namespace Inkscape {
namespace LivePathEffect {
namespace CR {
class KnotHolderEntityStartingAngle : public LPEKnotHolderEntity {
public:
};
class KnotHolderEntityRotationAngle : public LPEKnotHolderEntity {
public:
};
} // namespace CR
origin(_("Origin"), _("Origin of the rotation"), "origin", &wr, this, "Adjust the origin of the rotation"),
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),
copies_to_360(_("360º Copies"), _("No rotation angle, fixed to 360º"), "copies_to_360", &wr, this, true),
fusion_paths(_("Fusioned paths"), _("Fusion paths by helper line"), "fusion_paths", &wr, this, false),
dist_angle_handle(100.0)
{
show_orig_path = true;
_provides_knotholder_entities = true;
apply_to_clippath_and_mask = true;
// register all your parameters here, so Inkscape knows which parameters this effect has:
num_copies.param_make_integer(true);
}
{
}
void
{
using namespace Geom;
origin.param_setValue(A);
dist_angle_handle = L2(B - A);
dir = unit_vector(B - A);
}
void
{
if(fusion_paths) {
angle += starting_angle;
}
// cycle through all parameters. Most parameters will not need transformation, but path and point params do.
for (std::vector<Parameter *>::iterator it = param_vector.begin(); it != param_vector.end(); ++it) {
}
}
void
{
using namespace Geom;
if( copies_to_360 ) {
}
}
if(fusion_paths && copies_to_360) {
if((int)num_copies%2 !=0) {
}
} else {
}
if(dist_angle_handle < 1.0) {
dist_angle_handle = 1.0;
}
dir = unit_vector(B - A);
// 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)
if( fusion_paths || copies_to_360 ) {
}
}
int
{
double pos = (B[Geom::X]-A[Geom::X])*(X[Geom::Y]-A[Geom::Y]) - (B[Geom::Y]-A[Geom::Y])*(X[Geom::X]-A[Geom::X]);
}
bool
{
using Geom::X;
using Geom::Y;
double t1 = (p[X]*(p3[Y] - p1[Y]) + p[Y]*(p1[X] - p3[X]) - p1[X]*p3[Y] + p1[Y]*p3[X]) / denominator;
double t2 = (p[X]*(p2[Y] - p1[Y]) + p[Y]*(p1[X] - p2[X]) - p1[X]*p2[Y] + p1[Y]*p2[X]) / -denominator;
}
void
{
double time_start = 0.0;
int position = 0;
}
if(!portion_original.empty()){
if(rotation_angle != 180) {
position = pointInTriangle(side_checker, divider.initialPoint(), divider[0].finalPoint(), divider[1].finalPoint());
}
if(position == 1) {
}
}
}
position = pointSideOfLine(divider[0].finalPoint(), divider[1].finalPoint(), original.finalPoint());
if(rotation_angle != 180) {
position = pointInTriangle(original.finalPoint(), divider.initialPoint(), divider[0].finalPoint(), divider[1].finalPoint());
}
if(!portion_original.empty()){
} else {
tmp_path[0] = portion_original;
} else {
}
}
}
}
}
}
void
{
for (Geom::PathVector::const_iterator path_it = path_on.begin(); path_it != path_on.end(); ++path_it) {
continue;
}
for (int i = 0; i < num_copies; ++i) {
if(i%2 != 0) {
Geom::Point B = origin + dir * Geom::Rotate(-Geom::rad_from_deg((rotation_angle*i)+starting_angle)) * size_divider;
double c = (B[0] - A[0]) / hyp; // cos(alpha)
m = tmpM;
m = m * sca;
m = m * m1;
} else {
}
append_path *= m;
if(i != 0 && tmp_path_helper.size() > 0 &&( Geom::are_near(tmp_path_helper[tmp_path_helper.size()-1].finalPoint(),append_path.finalPoint()))) {
} else if(i != 0 && tmp_path_helper.size() > 0 && Geom::are_near(tmp_path_helper[tmp_path_helper.size()-1].initialPoint(),append_path.initialPoint())) {
} else if(i != 0 && tmp_path_helper.size() > 0 && Geom::are_near(tmp_path_helper[tmp_path_helper.size()-1].finalPoint(),append_path.initialPoint())) {
} else if(i != 0 && tmp_path_helper.size() > 0 && Geom::are_near(tmp_path_helper[tmp_path_helper.size()-1].initialPoint(),append_path.finalPoint())) {
} else if(i != 0 && tmp_path_helper.size() > 0 && Geom::are_near(tmp_path_helper[0].finalPoint(),append_path.finalPoint())) {
} else if(i != 0 && tmp_path_helper.size() > 0 && Geom::are_near(tmp_path_helper[0].initialPoint(),append_path.initialPoint())) {
} else {
}
if(tmp_path_helper.size() > 0 && Geom::are_near(tmp_path_helper[tmp_path_helper.size()-1].finalPoint(),tmp_path_helper[tmp_path_helper.size()-1].initialPoint())) {
}
}
double diagonal = Geom::distance(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
Geom::Rect bbox(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
Geom::Point base_point = origin + dir * Geom::Rotate(-Geom::rad_from_deg((rotation_angle * num_copies) + starting_angle)) * size_divider;
if(Geom::are_near(tmp_path_helper[0].initialPoint(),base_a) && Geom::are_near(tmp_path_helper[0].finalPoint(),base_a)){
tmp_path_helper[0].close();
}
tmp_path_helper[0].close();
}
} else if((Geom::are_near(tmp_path_helper[0].initialPoint(),base_a) && Geom::are_near(tmp_path_helper[tmp_path_helper.size()-1].finalPoint(),base_b)) ||
(Geom::are_near(tmp_path_helper[0].initialPoint(),base_b) && Geom::are_near(tmp_path_helper[tmp_path_helper.size()-1].finalPoint(),base_a))){
}
}
if(tmp_path_helper.size() > 0 && Geom::are_near(tmp_path_helper[0].finalPoint(),tmp_path_helper[0].initialPoint())) {
tmp_path_helper[0].close();
}
}
}
{
using namespace Geom;
return pwd2_in;
}
double diagonal = Geom::distance(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
Geom::Rect bbox(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
Geom::Point line_end = origin + dir * Rotate(-rad_from_deg(rotation_angle + starting_angle)) * size_divider;
//Note:: beter way to do this
//Whith AppendNew have problems whith the crossing order
if(fusion_paths) {
for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) {
continue;
}
bool end_open = false;
end_open = true;
}
}
}
}
}
} else {
for (int i = 0; i < num_copies; ++i) {
}
}
return output;
}
void
LPECopyRotate::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec)
{
using namespace Geom;
hp.appendNew<Geom::LineSegment>(origin + dir * Rotate(-rad_from_deg(rotation_angle+starting_angle)) * dist_angle_handle);
}
void
{
}
void
{
{
_("Adjust the starting angle"));
knotholder->add(e);
}
{
_("Adjust the rotation angle"));
knotholder->add(e);
}
};
namespace CR {
using namespace Geom;
void
KnotHolderEntityStartingAngle::knot_set(Geom::Point const &p, Geom::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)
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(Geom::Point const &p, Geom::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(deg_from_rad(-angle_between(lpe->dir, s - 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.
}
KnotHolderEntityStartingAngle::knot_get() const
{
}
KnotHolderEntityRotationAngle::knot_get() const
{
}
} // 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 :