summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2016-12-18 23:41:02 +0000
committerJabiertxof <jtx@jtx>2016-12-18 23:41:02 +0000
commita51cc412f3dc7e62ce12faade1b78f6cf5c2f452 (patch)
tree15c57db7d0d2d393972c3feb01a23420a8db521c /src
parentworking on reflections (diff)
parentSome coding style fixes (diff)
downloadinkscape-a51cc412f3dc7e62ce12faade1b78f6cf5c2f452.tar.gz
inkscape-a51cc412f3dc7e62ce12faade1b78f6cf5c2f452.zip
Update to trunk
(bzr r15295.1.28)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp15
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp17
2 files changed, 12 insertions, 20 deletions
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index 5b94e9083..0492b12d6 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -262,19 +262,8 @@ LPECopyRotate::setFusion(Geom::PathVector &path_on, Geom::Path divider, double s
if (i%2 != 0) {
Geom::Point A = (Geom::Point)origin;
Geom::Point B = origin + dir * Geom::Rotate(-Geom::rad_from_deg((rotation_angle*i)+starting_angle)) * size_divider;
- Geom::Translate m1(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::Affine m2(c, -s, s, c, 0.0, 0.0);
- Geom::Scale sca(1.0, -1.0);
-
- Geom::Affine tmp_m = m1.inverse() * m2;
- m = tmp_m;
- m = m * sca;
- m = m * m2.inverse();
- m = m * m1;
+ Geom::Line ls(A,B);
+ Geom::Affine m = Geom::reflection (ls.vector(), A);
} else {
append_path = original;
}
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index 3676013e0..2cc187fb4 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -173,8 +173,8 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem)
} else if ( mode == MT_FREE) {
if(!are_near(previous_center,center_point, 0.01)) {
Geom::Point trans = center_point - previous_center;
- start_point.param_setValue(start_point * trans);
- end_point.param_setValue(end_point * trans);
+ start_point.param_setValue(start_point * trans, true);
+ end_point.param_setValue(end_point * trans, true);
}
} else if ( mode == MT_V){
if(SP_ACTIVE_DESKTOP){
@@ -185,7 +185,7 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem)
start_point.param_setValue(sp);
Geom::Point ep = Geom::Point(view_box_rect.width()/2.0, view_box_rect.height());
ep *= i2anc_affine(SP_OBJECT(lpeitem), SP_OBJECT(SP_ACTIVE_DESKTOP->currentLayer()->parent)) .inverse();
- end_point.param_setValue(ep);
+ end_point.param_setValue(ep, true);
}
} else { //horizontal page
if(SP_ACTIVE_DESKTOP){
@@ -196,7 +196,7 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem)
start_point.param_setValue(sp);
Geom::Point ep = Geom::Point(view_box_rect.width(), view_box_rect.height()/2.0);
ep *= i2anc_affine(SP_OBJECT(lpeitem), SP_OBJECT(SP_ACTIVE_DESKTOP->currentLayer()->parent)) .inverse();
- end_point.param_setValue(ep);
+ end_point.param_setValue(ep, true);
}
}
@@ -445,6 +445,7 @@ LPEMirrorSymmetry::transform_multiply(Geom::Affine const& postmul, bool set)
param->param_transform_multiply(postmul, set);
}
previous_center = Geom::middle_point((Geom::Point)start_point, (Geom::Point)end_point);
+
// Geom::Affine m = Geom::identity();
// m *= sp_lpe_item->transform;
// m *= postmul;
@@ -454,6 +455,7 @@ LPEMirrorSymmetry::transform_multiply(Geom::Affine const& postmul, bool set)
// if (other) {
// sp_lpe_item_update_patheffect(SP_LPE_ITEM(other), false, false);
// }
+
}
void
@@ -493,8 +495,9 @@ LPEMirrorSymmetry::doEffect_path (Geom::PathVector const & path_in)
path_out = pathv_to_linear_and_cubic_beziers(path_in);
}
- Geom::Line ls((Geom::Point)start_point, (Geom::Point)end_point);
- Geom::Affine m = Geom::reflection (ls.vector(), (Geom::Point)start_point);
+
+ Geom::Line line_separation((Geom::Point)start_point, (Geom::Point)end_point);
+ Geom::Affine m = Geom::reflection (line_separation.vector(), (Geom::Point)start_point);
if (fuse_paths && !discard_orig_path) {
for (Geom::PathVector::const_iterator path_it = original_pathv.begin();
@@ -521,7 +524,7 @@ LPEMirrorSymmetry::doEffect_path (Geom::PathVector const & path_in)
}
Geom::Point s = start_point;
Geom::Point e = end_point;
- double dir = ls.angle();
+ double dir = line_separation.angle();
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()));
double size_divider = Geom::distance(center_point, bbox) + diagonal;