How do I generate points for custom curve?

Basically, what I am doing is generating some curves based on a few points, then, I want to get an array of points of the finished curve. I want to do this in C#.

Graphics.DrawCurve and Graphics.DrawBezier do exactly what I want, except they draw the curves onto an object when I just want an array of points.

Also, the curves are not mathematical functions, many will be like this:

Further clarification will be given if needed.
Who is Participating?
Also, the curves are not mathematical functions
No offense, but they actually are. They just aren't simple functions that we saw in algebra.
If you look, you'll see that while the entire curve would be hard to find a function for, the curve can certainly be broken into chunks that can be expressed with simple(ish) functions.
DrawCurves and DrawBezier do exactly that (use mathematical techniques to approximate the functions).
You could look up a lot of research on curve fitting and fit the curves yourself, but since the functions are already there, just draw the objects from the DrawCurves and DrawBezier functions onto a temp image (that is never displayed) and then iterate through that image to find the pixels.
Really, the task you are asking to solve- almost impossible to solve.

Do you know what algorithms are used by DrawCurve, eg., to calculate coordinates of points? No. I don't know either. At least, for sure. Of course, I can guess... But implementation may change - no one guaranteed...

Anyway, you may need to write your own method based on an existing algorithm:

The above is just outline but gives an idea. Pretty tricky, I'd say :)

really, tpayn sayed basicly same... You just can't get points from existing method.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Or you could draw the curve on a temp image and then parse through that image and find which points were drawn. It's not incredibly efficient, but it will certainly work.
I'd say TommySzalapski's proposal is more real to implement. Not sure about performance though...
RewtAccessAuthor Commented:
Led me to solution, but really just posted a link
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.