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