Giter Site home page Giter Site logo

Linesort breaking straight lines about vpype HOT 11 CLOSED

abey79 avatar abey79 commented on May 22, 2024
Linesort breaking straight lines

from vpype.

Comments (11)

abey79 avatar abey79 commented on May 22, 2024

I just pushed b1b4ab7 to better visualise what happens.

from vpype.

abey79 avatar abey79 commented on May 22, 2024

The root cause is the fact that your SVG paths are made of (straight) curves instead of lines:

image

(Notice the "c" in the d attribute.)

vpype converts everything to poly lines on input, and will quantise curves based on the --quantization parameter. Apparently, the implicit linesimplify of the read command is not able to completely cope with it It does, to some extend, eg. compare:

vpype read blockhouse.svg show -d
vpype read -s blockhouse.svg show -d

(You'll need to update vpype before, I just added -d.)

I suggest you look at whatever generated the file to see if you can have it generate lines instead of curves. It may very well be that the situation will improve when #31 is fixed too.

from vpype.

ithinkido avatar ithinkido commented on May 22, 2024

That - d is very useful. I can not use the -s , I am getting an "not valid integer' error, but still i get the idea, the lines are not lines, but curves and that is not great for optimization.

from vpype.

abey79 avatar abey79 commented on May 22, 2024

Sorry the -s was meant to be after the read, not before. I fixed it up there.

from vpype.

abey79 avatar abey79 commented on May 22, 2024

Hey @ithinkido, I revisited this following the resolution of #34, and although the implicit simplify in read still has issues (#31), an explicit linesimplify now cleans your example file nicely:

image

from vpype.

ithinkido avatar ithinkido commented on May 22, 2024

Super clean !! Thanks

from vpype.

haschdl avatar haschdl commented on May 22, 2024

sorry to open and old topic, but since my issue is identical to the one initially reported here by @ithinkido , I decided writing a comment instead of opening a new issue. I read @abey79 comment and while I understand that "vpype converts everything to poly lines on input" I still would like to know if there is a way to prevent that, when my primary goal is to use only linemerge.

In other words, I would like to use the power of linemerge and leave the rest intact. The reason for that is what the initial post mentioned, it affects the plot results.

Here is an example, on the right the result after linemerge
image

The SVG is created using Processing and its arc() command (using bezier() has the same effect).
I am using vpype 1.9.0, the entire command is:

vpype read --single-layer 20220329174853.svg linemerge write out.svg

For reference purposes only, Adobe Illustrator's simplify command "recreates" the curves, while vpype's linesimplify would, as described, reduce the number of line segments.

from vpype.

abey79 avatar abey79 commented on May 22, 2024

Hello @haschdl. No, there is currently no way around the linearisation at all. I'm kind of thinking of getting there, but it'll take an entire rewrite of pretty much everything, so it could be years until that happens (if at all).

As a side note, a "line-merge-only" Python script could conceivably be hacked without much hassle using svgelements to extract path elements and using the same merging algorithm as vpype, since it only considers end points. But that would be just a script. There is currently no way to fit this into vpype.

from vpype.

ithinkido avatar ithinkido commented on May 22, 2024

@haschdl take a look at this. It should do what you are looking for. https://github.com/fablabnbg/inkscape-chain-paths

from vpype.

haschdl avatar haschdl commented on May 22, 2024

@abey79 thank you, I understand it now. I will check the alternatives.
@ithinkido thanks for the tip! inkscape-chain-paths looks like the right solution, but unfortunately it didn't work in Inskcape 1.1 with my drawing. It could be a good starting point to get hands-on, as it is just one script. Are you using the extension?

from vpype.

ithinkido avatar ithinkido commented on May 22, 2024

Yes, I used it an hour ago in 1.1. Still seems to work for me.

from vpype.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.