Closed abey79 closed 3 years ago
Funny, I noticed this yesterday evening that it is not great that the invert function actually touches the document as the show
after the gwrite
then displays not the original document anymore.
What I'm not understanding completely is how the scale and offset parameters would allow to invert the axis? If you want to invert the y axis, would you then set the scale_y to -1 and the offset_y to the maximum way of the y axis on the pen plotter?
I also think the invert_axis
method is now unused and can be removed.
And the README still contains an example with the old invert_y = true
Ah, I had only checked the bundled for that.
Yeah, pulled the reference, the function and bumped the version.
What I'm not understanding completely is how the scale and offset parameters would allow to invert the axis? If you want to invert the y axis, would you then set the scale_y to -1 and the offset_y to the maximum way of the y axis on the pen plotter?
@theomega yeah exactly. If you use scale_x = -1
, you most probably need to set offset_x
to some value that is the width of the target plotter's usable space.
Thanks @tatarize for cleaning after me. I did do this in a rush this morning without waiting for the full caffeine effect.
If you want I've no qualms moving the whole repository over http://github.com/PlotterTools at some point or just having you slurp up all the code and then deprecate the whole thing. Especially if you correct your write
routine such that you could do this without some gwrite
stand-in command. I figure that would be the solid point to do integration or whatnot.
This lemme waste 4 hours thing, has literally the highest stars/time spent ratio. 8 / 5-8 hours. Whereas MeerK40t's sitting at 71 / 2000+.
@theomega's point seemed to have gotten lost ithinkido has highlighted the issue for me again, and the implication in @abey79's comment was in error. Since the transformation between vpype's and the target's coordinate system does not depend on what needs to be drawn, this approach was erroneous IMO.
-- This actually does depend on what needs to be drawn. Flipping the origin point from the upper-left to lower-left requires that we actually flip the image across the center of the image. You could do this with scale and offset. But, only if you offset the drawing by 50% of the size of the drawing which isn't something you know from within the toml.
This PR adds the following features:
scale_x
andscale_y
config parameters to individually control the scaling of both axesoffset_x
andoffset_y
config parameters to individually control offsets on both axesThis PR further addresses two issues:
invert_x
andinvert_y
parameters were meant to address the target with axis orientation different from vpype. However the mirroring was implemented about a point defined as the center of the documents bound, which depends on the actual content of the pipeline (it would fail with an empty pipeline). Since the transformation between vpype's and the target's coordinate system does not depend on what needs to be drawn, this approach was erroneous IMO. In this PR,invert_x
andinvert_y
are removed (axis mirroring can be achieved withscale_x
andscale_y
).gwrite
command was modifying in-place the document, this affecting vpype's pipeline. Since the scaling/translating is meant for the sole purpose of matching the target's coordinate system, these modification should not leak to vpype's pipeline. This PR use adeepcopy
to avoid this.cc @theomega