public partial class Form1 : Form
private List<double> ptList = new List<double>();
private BezierCurve bc = new BezierCurve();
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
g.DrawRectangle(px, new Rectangle(e.X, e.Y, 1, 1));
Pen px = new Pen(Brushes.Red);
Pen newpx = new Pen(Brushes.Magenta);
private void button1_Click(object sender, EventArgs e)
// how many points do you need on the curve?
const int POINTS_ON_CURVE = 1000;
double ptind = new double[ptList.Count];
double p = new double[POINTS_ON_CURVE];
bc.Bezier2D(ptind, (POINTS_ON_CURVE) / 2, p);
// draw points
for (int i = 1; i != POINTS_ON_CURVE-1; i += 2)
g.DrawRectangle(newpx, new Rectangle((int)p[i + 1], (int)p[i], 1, 1));
private void Form1_Load(object sender, EventArgs e)
g = Graphics.FromHwnd(pictureBox1.Handle);
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Gravi Information Technologies and Consultancy Ltd
Currently, also an MSc. student in Technical University of Munich, I develop practical application in computer vision for more than 5 years. I design real-time solutions to industrial and practical vision problems, both 3D and 2D. Very interested in developing algorithms in C relating math and vision.
Please visit Gravi's web page (http://www.gravi.com.tr) and my page (http://www.tbirdal.me) to learn more about what we develop.
I admire performance in algorithms.
"Great minds never die, they just tend to infinity..."