Draw and fill a signal

时间:2015-06-26 09:39:51

标签: c# drawing

I would like to draw and then fill a signal using graphics.drawcurve and graphics.fillclosedcurve as following:

Graphics

gX = drawPanel.CreateGraphics();
Pen pen1 = new Pen(Color.Black); 
Brush be = new SolidBrush(Color.Gray);
gX.DrawCurve(pen1, pointArray1, 0.01F);
gX.FillClosedCurve(be, pointArray1);

Although there is no minus in the plotted data I got some filled curved at the minus side of the curve (due to interpolation?) as following:

Filled signal

How can I get rid of these artifacts?

Thanks in advance!

1 个答案:

答案 0 :(得分:1)

不要使用DrawCurves来绘制真实数据!

它们看起来不错,在创建鼠标移动的徒手图时非常有用。

但是在绘制数据时,他们并不是那么好,因为他们倾向于透支 esp。当方向变化很快。

请参阅here了解透支的一个有益示例!设置Tension是限制问题的一种方法;但它也会限制线条的平滑度。

那里的解决方案使用Beziers,但这不是你应该做的!

你似乎有很多dara积分,我建议你坚持DrawLines&而是FillPolygon;他们仍然应该看起来相当顺利..