讲解.NET环境下绘制模糊数学中隶属函数分布图第3/5页
更新时间:2007年11月23日 17:13:15 作者:
以下是引用片段:
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);
}
for (d = c; d < d1; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)(unit * (System.Math.Pow((d1 - d) / (d1- c), k)));
y2 = o.Y - (float)(unit * (System.Math.Pow((d1 - d - interval) / (d1 - c), k)));
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
}
}
else if (type1 == 4)
...{
//set4();
PointF o1 = new PointF(this.pictureBox1.Width / 2, this.pictureBox1.Height / 4);
e.Graphics.DrawString("1", font, brush, o1);
if (type2 == 3)
...{
for (d = 0; d <= 2*a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)(System.Math.Exp(-((d-a)/k)*((d-a)/k)) * unit);
y2 = o.Y - (float)(System.Math.Exp(-((d-interval - a) / k) * ((d-interval - a) / k)) * 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 <= 2 * a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)(System.Math.Exp(-((d - a) / k) * ((d - a) / k)) * unit);
y2 = o.Y - (float)(System.Math.Exp(-((d - interval - a) / k) * ((d - interval - a) / k)) * 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 <= 2 * a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)(System.Math.Exp(-((d - a) / k) * ((d - a) / k)) * unit);
y2 = o.Y - (float)(1-System.Math.Exp(-((d - interval - a) / k) * ((d - interval - a) / k)) * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
}
}
else if (type1 == 5)
...{
//set5();
PointF o1 = new PointF(this.pictureBox1.Width / 2, this.pictureBox1.Height / 4);
e.Graphics.DrawString("1", font, brush, o1);
if (type2 == 3)
...{
for (d = 0; d <= 2 * a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)((1.0/(1+k*System.Math.Pow(d-a,l))) * unit);
y2 = o.Y - (float)((1.0 / (1 + k * System.Math.Pow(d-interval - a, l))) * 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 <= 2 * a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)((1.0 / (1 + k * System.Math.Pow(d - a, l))) * unit);
y2 = o.Y - (float)((1.0 / (1 + k * System.Math.Pow(d - interval - a, l))) * 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 <= 2 * a; d += interval)
...{
x1 = o.X + d * unit;
x2 = o.X + (d + interval) * unit;
y1 = o.Y - (float)((1.0 / (1 + k * System.Math.Pow(d - a, -l))) * unit);
y2 = o.Y - (float)((1.0 / (1 + k * System.Math.Pow(d - interval - a, -l))) * unit);
p1 = new PointF(x1, y1);
p2 = new PointF(x2, y2);
e.Graphics.DrawLine(Pens.Blue, p1, p2);
}
for (d = 2*a; d <= 3*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);
}
}
}
相关文章
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
最新评论