资源简介
c#编写的散点图拟合成光滑曲线的小工具。
代码片段和文件信息
//*************************************************
//Author: Fady Aladdin C# C++ Software Developer
//Cairo Egypt
//*************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace LagrangeInterpolation
{
public partial class frmView : Form
{
#region Class Constructor
public frmView()
{
InitializeComponent();
}
#endregion
#region Structurs
private struct Operators
{
public List Operatos;
}
private struct LineC
{
public PointF sPoint;
public PointF ePoint;
}
#endregion
#region Globals
private List points = new List();
Graphics g;
//Define a List of Operators (to hold a list of Lagrange operators in each od it‘s elements)
List OpList;//= new List();
//A list of X coordinates which we will compute the Lagrange operators according to and they will be
//the X coordinates of the fitted curve.
//A list of Y coordinates which is computed according to Lagrange operators and they will be
//the Y coordiantes of the fitted curve.
List Xs;//= new List();
List Ys;//= new List();
bool curveRendered = false;
List lineList = new List();
List intersectedPoints = new List();
#endregion
#region Event Handlers
private void pictureBox_MouseDown(object sender MouseEventArgs e)
{
g = pictureBox.CreateGraphics();
PointF p = new PointF(e.X e.Y);
points.Add(p);
Brush b;
b = Brushes.Yellow;
PointF t = new PointF(p.X - 8 p.Y - 25);
g.DrawString(“.“ new Font(“Bold“ 20) b t);
renderCircules(points);
}
private void pictureBox_MouseMove(object sender MouseEventArgs e)
{
Text = e.X.ToString() + ““ + e.Y.ToString() + “ Lagrange Interpolation Curve Fitting C# Fady Aladdin“;
if (chkGrid.Checked)
renderGrid();
if (curveRendered)
renderCurve();
}
private void pictureBox_Paint(object sender PaintEventArgs e)
{
if (chkGrid.Checked)
renderGrid();
if (curveRendered)
renderCurve();
}
private void btnFit_Click(object sender EventArgs e)
{
btnFit.Enabled = false;
fitLagrange(points);
}
private void btnClear_Click(object sender EventArgs e)
{
g.Clear(Color.Black);
point
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2008-08-15 12:20 LagrangeInterpolation\
目录 0 2008-08-23 22:21 LagrangeInterpolation\LagrangeInterpolation\
目录 0 2008-08-23 12:15 LagrangeInterpolation\LagrangeInterpolation\bin\
目录 0 2008-08-15 12:27 LagrangeInterpolation\LagrangeInterpolation\bin\Debug\
文件 24576 2008-08-23 22:21 LagrangeInterpolation\LagrangeInterpolation\bin\Debug\LagrangeInterpolation.exe
文件 5632 2005-09-23 08:56 LagrangeInterpolation\LagrangeInterpolation\bin\Debug\LagrangeInterpolation.vshost.exe
文件 8794 2008-08-23 22:21 LagrangeInterpolation\LagrangeInterpolation\frmView.cs
文件 5118 2008-08-23 18:56 LagrangeInterpolation\LagrangeInterpolation\frmView.Designer.cs
文件 5814 2008-08-23 12:08 LagrangeInterpolation\LagrangeInterpolation\frmView.resx
文件 3259 2008-08-23 12:15 LagrangeInterpolation\LagrangeInterpolation\LagrangeInterpolation.csproj
文件 388 2008-08-23 12:17 LagrangeInterpolation\LagrangeInterpolation\Program.cs
目录 0 2008-08-23 18:46 LagrangeInterpolation\LagrangeInterpolation\Properties\
文件 1306 2008-08-23 18:46 LagrangeInterpolation\LagrangeInterpolation\Properties\AssemblyInfo.cs
文件 2869 2008-08-15 12:19 LagrangeInterpolation\LagrangeInterpolation\Properties\Resources.Designer.cs
文件 5612 2008-08-15 12:19 LagrangeInterpolation\LagrangeInterpolation\Properties\Resources.resx
文件 1104 2008-08-15 12:19 LagrangeInterpolation\LagrangeInterpolation\Properties\Settings.Designer.cs
文件 249 2008-08-15 12:19 LagrangeInterpolation\LagrangeInterpolation\Properties\Settings.settings
文件 952 2008-08-15 12:20 LagrangeInterpolation\LagrangeInterpolation.sln
评论
共有 条评论