Is there a list of the kinds of objects in SVG, and their complexity?

General discussions about Inkscape.
mraccident
Posts: 6
Joined: Fri Jan 12, 2018 3:41 am

Is there a list of the kinds of objects in SVG, and their complexity?

Postby mraccident » Fri Jan 12, 2018 5:03 am

Specifically - the first question I thought of - is whether the basic shapes are lighter than if I'll turn them to paths. Meaning - that they require less information, and lighter on the program\rendering.
So if I'll create a very complex "painting" - maybe I should try to use most basic shapes - to the highest degree I can?
A more specific question - if indeed the basic shapes are simpler, is -- is the simplicity kept with complex manipulation of the shapes - without turning them into paths. And if so - does it have to do with the manipulations being sort-of or exactly - as fractal equations etc; while for a special path - each part of the shape \ node - requires its own specific information etc?

And is there a list somewhere - of the different complexities of kinds of objects\filters\effects etc? So I'll be able to use the program in the smartest way.

I probably should have started with only the question - are they different; but I know the number of viewers drops - the more time passes \ posts are added.

Moini
Posts: 2342
Joined: Mon Oct 05, 2015 10:44 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby Moini » Fri Jan 12, 2018 8:20 am

I'd guess it's computatively easier to have some nodes and straight lines, rather than just a corner and some lengths, and you need to compute the rest. But probably, that depends on the implementation. Might be there are ways to speed things up.

There is the SVG standard: https://www.w3.org/Graphics/SVG/
And the Inkscape source code: https://gitlab.com/inkscape/inkscape
And your SVG file's code: open file with text editor, or open XML editor in Inkscape

As for the rest: I suggest you just try it out. You can use timing, or there's the menu item 'Help > About Memory'. For concrete implementation questions, ask the developers on their mailing list, or on IRC.
https://inkscape.org/en/community/

But what I can say with certainty is that filters will do a great job in slowing down rendering, even if you use more cores, and lower quality. But you can turn them off, so they aren't displayed most of the time, if you want to.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Lazur
Posts: 4463
Joined: Tue Jun 14, 2016 10:38 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby Lazur » Fri Jan 12, 2018 9:11 am

Complexity? What would that be.
Here we had a challenge on drawing the same image with the smallest possible size -with very similar rendering but different underlying struture. There are many ways of doing so, and the smallest ones are practically uneditable and unusable for like vinyl cutting.
In this topic there was a similar challenge.
Size is one thing, rendering performance is another. If using cloning you can reduce the file size and if clones don't have any style attributes set, the performance can be better too.

Filtering is not in the usual toolkit of vector users for a reason. Performance is limited by a certain zoom level as of eating up all the resources and other issues.

For performance testing, have a look at this collection.
There are many different kind of svg-s involved -some that is refusing exporting at a decent resolution, other one using an excessive amount of nodes and there is one with unnecessary amount of style attributes.
Also the amount of clones can cause problems.

The most fitting approach depends on what you want to achieve.

mraccident
Posts: 6
Joined: Fri Jan 12, 2018 3:41 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby mraccident » Fri Jan 12, 2018 9:57 am

I would like to know some general mathematics behind a shape, curve, node, shade, color-gradient etc.
Anyway, thank you.

Lazur
Posts: 4463
Joined: Tue Jun 14, 2016 10:38 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby Lazur » Fri Jan 12, 2018 10:47 am

Shapes are drawn with the rectangle and the ellipse tool. If you perform a boolean operation on them (like intersecting one with another) the result will be a path.
Inkscape uses paths mostly, which are cubic Bézier curves. Here is a primer on Bézier curves.
That means circles cannot be represented perfectly with paths and parallel lines are not 100% correct but the difference is so small it won't generate issues in regular use.
On a side note the svg specs linked above allow polyline objects and circular arcs to be segments in a path, but inkscape doesn't have a gui for them -can render those only. If you want to edit those -from a matlab generated svg for example- then you'd need converting them to paths first.

Personally I rather use paths converted from polygons -drawn with the * tool- than the ellipse tool for constructions in inkscape.


Shade, gradient, stroke width is added on the rendering level as fill and stroke attributes. Meaning you can't run a cnc machine to follow those as per se.
Besides they depend on the rendering capabilities which can have some limits and can be switched off.
As an example you can draw parallel circles on screen with a radial gradient, but it will be aliased. Gradients are not anti-aliased unlike everything else. (For example this spiral is drawn from squares with radial gradients -see how the edges are "spiky".)

In the previously linked vector optimizing challenge the key was to use a dasharray on a stroked path to draw a circular grid instead of drawing the square grid by four noded paths. That can save alot of space but makes it impossible to get the exact coordinates of those corners. Can't snap to them, can't cut them out with a cnc machine. Yet both render the same. So how would you decide which one suits your needs better?

Moini
Posts: 2342
Joined: Mon Oct 05, 2015 10:44 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby Moini » Fri Jan 12, 2018 11:55 am

I would like to know some general mathematics behind a shape, curve, node, shade, color-gradient etc.


For that, either read Inkscape's and cairo's code, if you're after the specific implementation of the renderer, or look into the SVG specification if you're interested in the general workings, or ask the Inkscape / cairo developers.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

mraccident
Posts: 6
Joined: Fri Jan 12, 2018 3:41 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby mraccident » Sat Jan 13, 2018 2:42 am

Lazur - thank you for the post. I'll read on the Bézier-Curves.
What I plan to do with the program - is to design paintings, and then to print only the outlines\points and to paint in analog\traditional means, according to the design. So if I understood the concepts correctly:
I can use the square-grid - for maximum future manipulation ability.
And things like: dasharray, clones, pattern \ shape around path -- for shapes\patterns - which can be general and random\arbitrary - for my needs. And they will be lighter\smaller.

Did I understand correctly?



Another question – can I check the complexity \ amount of information – of a shape\object I created; for instance – how many nodes it has, how many bits it "weighs" etc?

Lazur
Posts: 4463
Joined: Tue Jun 14, 2016 10:38 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby Lazur » Sat Jan 13, 2018 2:58 am

Keep an eye to the bottom indication line. If a path is selected, the number of nodes is displayed.
Like "Path 4 nodes in Layer 1. Click selection to toggle scale/rotation handles".

Paintings can vary alot in style and technique.
Regular printers can't print with white ink so probably it's not for an oil painting?
Thinking out loud, if you want to draw something like a black&white paint by number layout, that can be done on raster images as well.
Illustrator has a trace bitmap algorithm inkscape doesn't have an equivalent. It can generate such vector svg-s as this one. Adding a white fill and black strokes to these paths would be a perfect layout then.

Lazur
Posts: 4463
Joined: Tue Jun 14, 2016 10:38 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby Lazur » Sat Jan 13, 2018 3:03 am

mraccident wrote:So if I understood the concepts correctly:
I can use the square-grid - for maximum future manipulation ability.
And things like: dasharray, clones, pattern \ shape around path -- for shapes\patterns - which can be general and random\arbitrary - for my needs. And they will be lighter\smaller.

Did I understand correctly?


Yes, that's true.
Maximum future manipulation ability is usually the opposite of the smallest possible svg file, with a regular drawing.

mraccident
Posts: 6
Joined: Fri Jan 12, 2018 3:41 am

Re: Is there a list of the kinds of objects in SVG, and their complexity?

Postby mraccident » Sat Jan 13, 2018 3:53 am

Lazur - OK I think that helped most my query.

The painting part is much simpler. I want to design - practically the perfect final image; and I love the fact that it's possible to do perfectly\mathematically etc. Then I'll just print the most general lines\points - only to not have to find them again; so those can be printed on a piece of paper -- then traced with this paper with ink on one side (however it's called) - to the final painting-surface. Then I'll paint, using the design as reference. And again - I can know the exact few colors I used; which enables to find the precise colors - with liquid paint, for instance. And I also know how I created the look - exactly; which should help with understanding - how to reproduce\create it with the analog colors.

Thank you.


Return to “General Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest