Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to return all points along a bezier curve?
    text
    copied!<p>I posted a previous question about generating a bezier curve based on only the start and end points, and I was able thanks to the answers in that create a bezier curve using the information I have.</p> <p>This is the code that allows me to draw the types of curve that I want on a form.</p> <pre><code>private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Random rnd = new Random(); Point startp = new Point(rnd.Next(0, this.Width), rnd.Next(0, this.Height)); Point endp = new Point(rnd.Next(0, this.Width), rnd.Next(0, this.Height)); int xMod = 0; int yMod = 0; if (startp.X &gt; endp.X) { xMod = -1; } else { xMod = 1; } if (startp.Y &gt; endp.Y) { yMod = 1; } else { yMod = -1; } Point control1p = new Point(endp.X + (rnd.Next(20, 50) * xMod), endp.Y + (rnd.Next(20, 50) * yMod)); Point control2p = new Point(endp.X + (rnd.Next(5, 20) * xMod), endp.Y + (rnd.Next(5, 20) * yMod)); Point[] pts = { startp, control1p, control2p, endp }; Pen dashed_pen = new Pen(Color.Black, 0); dashed_pen.DashStyle = Drawing2D.DashStyle.Dash; for (int i = 0; i &lt;= 2; i++) { e.Graphics.DrawLine(dashed_pen, pts(i), pts(i + 1)); } e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality; Pen bez_pen = new Pen(Color.Black, 3); e.Graphics.DrawBezier(bez_pen, pts(0), pts(1), pts(2), pts(3)) } </code></pre> <p>Is there a way, or can someone help me with returning all the points that form the curve? I'd like for each point of a curve calculated from those points to be returned in an array of points, but I'm having no luck figuring it out, and haven't been able to find a similar solution on stackoverflow or google in general.</p> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload