你想得出这样进了二次曲线通过 3个给定的点,或者你想画一个二次贝塞尔曲线是使用 3点给定的点?
如果你想要的是Bézier曲线,试试这个:
private void AddBeziersExample(PaintEventArgs e)
{
// Adds a Bezier curve.
Point[] myArray =
{
new Point(100, 50),
new Point(120, 150),
new Point(140, 100)
};
// Create the path and add the curves.
GraphicsPath myPath = new GraphicsPath();
myPath.AddBeziers(myArray);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Run Code Online (Sandbox Code Playgroud)
我只是无耻地从MSDN文档中解除了GraphicsPath.AddBeziers().
编辑:如果您真正想要的是拟合二次曲线,那么您需要对点进行曲线拟合或多项式插值.也许Ask Dr. Math的这个答案会有所帮助.
| 归档时间: |
|
| 查看次数: |
4286 次 |
| 最近记录: |