# Create set of data from vector curve [closed]

I need exactly what is written in the title. Suppose we have some curve plotted:

p = Plot[Sin[x],{x,0,2pi}]


now we save that as vector graphics:

Export["sth.svg",p]


and we have a plot saved as vector graphics. Now someone comes and want to recreate functional values of plot algorithmically (manual reading of functional values might be inaccurate and weary), so he runs some kind of script on that vector object and he gets functional values with following rules:

1) the output is set of pairs {{x1,y1},{x2,y2},...}

2) the starting point of curve is {0,0} (x1 = 0, y1 = 0). It's an arbitrary choice since whole set of data can be rescaled with respect to x, y and displace horizontally (add constant value to all x) or vertically (add constant value to all y)

3) the scale is absolutely optional, since everything can be rescaled and shifted to match real axes of original plot, for example most left point of x axis might be 0, the most right point might be 1. The vertical range is also optional.

4) specific value depends on curve thickness, but vector curves might be arbitrarily thin, so there is always a way to find arbitrarily accurate $y$ value for given $x$ values.

5) choice of $x$ values should be somewhat "wise" (the more curve changes at given point, the more dense should be $x$ values at neigbourhood of that point), but if not, at least there should be possibility to choose number of evenly distributed $x$ points.

So basically, the input is only one vertically single-valued vector curve and the output is "wise" choice of $x$ points and corresponding $y$ values.

I googled it but found nothing and I don't even know how to start. I'm sorry if question similar to this one was already answered.

Possible generalization: create parametric set of data, $x(t)$ and $y(t)$ from curve that is not a function, like ellipse or spiral.

P.S.: feel free to add some suitable tags.

## closed as off-topic by Dr. belisarius, m_goldberg, Bob Hanlon, Oleksandr R., ilianAug 22 '15 at 15:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "The question is out of scope for this site. The answer to this question requires either advice from Wolfram support or the services of a professional consultant." – Dr. belisarius, m_goldberg, Bob Hanlon, Oleksandr R., ilian
If this question can be reworded to fit the rules in the help center, please edit the question.

• Mathematica can import the elements of an SVG file as XML objects. Perhaps you could start from there, and then report back with any specific problems you encounter. Similar topics have been discussed before on this site for the more complex case of raster images: Recovering data points from an image, [How can I extract data points from a black and white image?](href="mathematica.stackexchange.com/q/3831/27951">), and Obtain Data points from a graph on an image without axes. – MarcoB Aug 22 '15 at 2:58
• I would strongly suggest that you attempt to tackle the problem on your own first: as it is, your question unfortunately reads more like a specification to hire a consultant than a request for help. – MarcoB Aug 22 '15 at 3:13
• @user16320 Click Here Has just what you need. – Bob Brooks Aug 22 '15 at 14:06
• This is not a free coding service. Unless someone has already solved this problem for themselves, it is unlikely that you will find anyone willing to implement it for you. On the other hand, if you make a start, you will probably find someone willing to help. But at the least you are going to have to teach yourself something about SVG objects and coordinate systems. Bear in mind that SVG is a presentation format, and not intended to contain quantitative information, so your task is not a simple one given an arbitrary SVG file. – Oleksandr R. Aug 22 '15 at 14:59