讲解.NET环境下绘制模糊数学中隶属函数分布图第4/5页
更新时间:2007年11月23日 17:13:15 作者:
以下是引用片段:
else if (type1 == 6)
...{
//set6();
PointF o1 = new PointF(this.pictureBox1.Width / 2, this.pictureBox1.Height / 4);
e.Graphics.DrawString("1", font, brush, o1);
if (type2 == 3)
...{
for (d =-b; d < -a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)((0.5 + 0.5 * System.Math.Sin((d-(a+b)/2)*(System.Math.PI/(b-a)))) * unit);
y2 = o.Y - (float)((0.5 + 0.5 * System.Math.Sin((d-interval - (a + b) / 2) * (System.Math.PI / (b - a)))) * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
for (d = -a; d < a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)(1* unit);
y2 = o.Y - (float)(1 * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
for (d = a; d < b; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)((0.5 - 0.5 * System.Math.Sin((d - (a + b) / 2) * (System.Math.PI / (b - a)))) * unit);
y2 = o.Y - (float)((0.5 - 0.5 * System.Math.Sin((d - interval - (a + b) / 2) * (System.Math.PI / (b - a)))) * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
}
else if (type2 == 1)
...{
for (d = 0; d < a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)(1 * unit);
y2 = o.Y - (float)(1 * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
for (d = a; d < b; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)((0.5 - 0.5 * System.Math.Sin((d - (a + b) / 2) * (System.Math.PI / (b - a)))) * unit);
y2 = o.Y - (float)((0.5 - 0.5 * System.Math.Sin((d - interval - (a + b) / 2) * (System.Math.PI / (b - a)))) * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
}
else if (type2 == 2)
...{
for (d = a; d < b; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)((0.5 + 0.5 * System.Math.Sin((d - (a + b) / 2) * (System.Math.PI / (b - a)))) * unit);
y2 = o.Y - (float)((0.5 + 0.5 * System.Math.Sin((d - interval - (a + b) / 2) * (System.Math.PI / (b - a)))) * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
for (d = b; d < c; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)(1 * unit);
y2 = o.Y - (float)(1 * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
}
}
}
private void button1_Click(object sender, EventArgs e)
...{
InitArray();
Graphics g = Graphics.FromHwnd(this.pictureBox1.Handle);
PaintEventArgs e1 = new PaintEventArgs(g, this.pictureBox1.ClientRectangle);
this.pictureBox1_Paint(this.pictureBox1, e1);
g.Dispose();
}
}
相关文章
C#中static void Main(string[] args) 参数示例详解
这篇文章主要介绍了C#中static void Main(string[] args) 参数详解,本文通过具体示例给大家介绍的非常详细,需要的朋友可以参考下2017-03-03C# 使用Microsoft Edge WebView2的相关总结
这篇文章主要介绍了C# 使用Microsoft Edge WebView2的相关总结,帮助大家更好的理解和学习使用c#,感兴趣的朋友可以了解下2021-02-02在C#中List集合使用First()方法获取第一个元素的操作
这篇文章主要介绍了在C#中List集合使用First()方法获取第一个元素的操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2020-12-12
最新评论