You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my project (https://github.com/abey79/vpype), I need to load SVG and convert all geometries (including curves) to line strings with controllable step size. I'm not 100% happy with the current solution and I'm looking at alternatives and svg.path could certainly help.
Conceptually, this is the way I'd do thing with a non-parallel version of *.point(pos):
foreleminpath:
ifisinstance(elem, svg.Line):
coords= [elem.start, elem.end]
else:
step=int(math.ceil(elem.length() /quantization) +1)
coords.extend(elem.point(i/step) foriinrange(step+1))
# append coords to the output buffer
The number of calls to elem.point() can be very high (some user have A2+ SVGs and typically using 0.1mm step size) and this incurs significant loading times.
Proposal
Introduce a dependancy on NumPy and allow *.point(pos) to accept NumPy arrays of float. In this case, the function would return a Numpy array of complex instead of a single complex. A cursory look at the code indicates that minimal changes would be required for this to work (mainly in Arc.point() and Path.point()).
With this issue I'm hoping to probe this project's maintainers willingness to go in this direction, since a dependancy
would be introduced (this project's first as far as I can tell!). This issue also has some loose ties with #31 and #36, as NumPy could be helpful in the application of transforms.
The text was updated successfully, but these errors were encountered:
I will not introduce a dependency on NumPy, sorry. This is a small lightweight library.
It feels like there must be a better way to parallelize this...
Background
In my project (https://github.com/abey79/vpype), I need to load SVG and convert all geometries (including curves) to line strings with controllable step size. I'm not 100% happy with the current solution and I'm looking at alternatives and svg.path could certainly help.
Conceptually, this is the way I'd do thing with a non-parallel version of
*.point(pos)
:The number of calls to
elem.point()
can be very high (some user have A2+ SVGs and typically using 0.1mm step size) and this incurs significant loading times.Proposal
Introduce a dependancy on NumPy and allow
*.point(pos)
to accept NumPy arrays of float. In this case, the function would return a Numpy array of complex instead of a single complex. A cursory look at the code indicates that minimal changes would be required for this to work (mainly inArc.point()
andPath.point()
).With this issue I'm hoping to probe this project's maintainers willingness to go in this direction, since a dependancy
would be introduced (this project's first as far as I can tell!). This issue also has some loose ties with #31 and #36, as NumPy could be helpful in the application of transforms.
The text was updated successfully, but these errors were encountered: