From cf07db5344c64930b5b7ff4e6a3d5c2af82e56e4 Mon Sep 17 00:00:00 2001 From: Jonathan Neuhauser Date: Wed, 26 May 2021 23:53:53 +0200 Subject: [PATCH] fix wrong transform order, change tangential offset to percentage of dx --- pathscatter.inx | 2 +- pathscatter.py | 8 +- ...143__--stretch__False__--follow__False.out | 157 +++++++++++++----- ...py__--grouppick__True__--pickmode__seq.out | 64 ++++--- ...rue__--rotate__True__--copymode__clone.out | 16 +- ...True__--follow__True__--copymode__copy.out | 18 +- tests/data/svg/scatter.svg | 47 +++--- 7 files changed, 207 insertions(+), 105 deletions(-) diff --git a/pathscatter.inx b/pathscatter.inx index 4d54e81c..41b66e10 100644 --- a/pathscatter.inx +++ b/pathscatter.inx @@ -9,7 +9,7 @@ false 0.0 0.0 - 0.0 + 0.0 false diff --git a/pathscatter.py b/pathscatter.py index c5cbfd1b..08e73ee8 100755 --- a/pathscatter.py +++ b/pathscatter.py @@ -83,7 +83,7 @@ class PathScatter(pathmodifier.Diffeo): bbox = BoundingBox(-bbox.y, -bbox.x) mat = Transform([[0, -1, 0], [1, 0, 0]]) * mat mat.add_translate([0, self.options.noffset]) - node.transform *= mat + node.transform = mat * node.transform return bbox def effect(self): @@ -141,11 +141,11 @@ class PathScatter(pathmodifier.Diffeo): length = sum(lengths) dx = width + self.options.space if self.options.stretch: - n = int((length - self.options.toffset + self.options.space) / dx) + n = int(length / dx + self.options.space) if n > 0: - dx = (length - self.options.toffset) / n + dx = (length) / n - s = self.options.toffset + s = 0 if self.options.stretch else self.options.toffset * 0.01 * dx while s <= length: local_transform = self.localTransformAt(s, skelcomp, lengths, skel_closed, \ self.options.follow) diff --git a/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__False__--follow__False.out b/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__False__--follow__False.out index 5693f815..f8d0f712 100644 --- a/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__False__--follow__False.out +++ b/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__False__--follow__False.out @@ -1,6 +1,6 @@ - + - + @@ -11,71 +11,148 @@ - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__True__--copymode__copy__--grouppick__True__--pickmode__seq.out b/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__True__--copymode__copy__--grouppick__True__--pickmode__seq.out index 9aff6bf3..0bf037eb 100644 --- a/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__True__--copymode__copy__--grouppick__True__--pickmode__seq.out +++ b/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__True__--copymode__copy__--grouppick__True__--pickmode__seq.out @@ -1,6 +1,6 @@ - + - + @@ -11,32 +11,52 @@ - - - - + + + + - + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__True__--rotate__True__--copymode__clone.out b/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__True__--rotate__True__--copymode__clone.out index f4a04535..cac8ad16 100644 --- a/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__True__--rotate__True__--copymode__clone.out +++ b/tests/data/refs/pathscatter__--id__g12668__--id__path8143__--stretch__True__--rotate__True__--copymode__clone.out @@ -1,6 +1,6 @@ - + - + @@ -11,14 +11,14 @@ - - - - + + + + - + - + \ No newline at end of file diff --git a/tests/data/refs/pathscatter__--id__path3990__--id__path3982__--stretch__True__--follow__True__--copymode__copy.out b/tests/data/refs/pathscatter__--id__path3990__--id__path3982__--stretch__True__--follow__True__--copymode__copy.out index 5c27adda..6f1ecf58 100644 --- a/tests/data/refs/pathscatter__--id__path3990__--id__path3982__--stretch__True__--follow__True__--copymode__copy.out +++ b/tests/data/refs/pathscatter__--id__path3990__--id__path3982__--stretch__True__--follow__True__--copymode__copy.out @@ -1,6 +1,6 @@ - + - + @@ -12,14 +12,14 @@ - - - + + + - + - - + + @@ -61,5 +61,5 @@ - + \ No newline at end of file diff --git a/tests/data/svg/scatter.svg b/tests/data/svg/scatter.svg index e2ac00a1..0a3ff5d3 100644 --- a/tests/data/svg/scatter.svg +++ b/tests/data/svg/scatter.svg @@ -1,19 +1,19 @@ + viewBox="0 0 210 297" + version="1.1" + id="svg8" + sodipodi:docname="scatter.svg" + inkscape:version="1.1-rc (52f87abb86, 2021-05-02)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + id="base" + objecttolerance="10.0" + gridtolerance="10.0" + guidetolerance="10.0" + inkscape:pagecheckerboard="0" /> @@ -43,7 +47,7 @@ image/svg+xml - + @@ -59,14 +63,15 @@ style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + transform="matrix(0.41480048,0.30168733,-0.26562825,0.47110973,136.76388,-111.50467)" + style="stroke-width:1.90501"> + style="stroke-width:4.97366">