如何获取.net DrawArc 方法的弧长

How to get the arc length for .net DrawArc method

我想知道如何获取我在位图上绘制的这两个形状的弧长。使用以下方法绘制曲线:

'Half Round:
Dim gfxpath As New GraphicsPath
gfxpath.AddArc(outRect, 180, 180)
gfxpath.AddArc(inRect, 180, 180)
gfxpath.CloseFigure()
gfx.FillPath(b, gfxpath)
gfx.DrawPath(p, gfxpath)

'Quarter Round:
Dim gfxpath As New GraphicsPath
gfx.DrawArc(p, outRect, 270, 90)
gfx.DrawArc(p, inRect, 270, 90)

我只需要外弧(由外矩形包围的弧)的弧长。谢谢!

椭圆弧长没有封闭公式。它通过所谓的 "elliptic integrals"

来表达

您可以计算弧长积分的数值解。

如果你的圆弧是全椭圆的一半和四分之一(从图片上看不清楚),你可以使用一些近似值,例如,Ramanujan one

p = Pi * (3*(a+b)+Sqrt((3a+b)*(a+3b)))

第一张图片

len = p / 2 = 1.5708 * (3*(36+18)+Sqrt((3*36+18)*(36+3*18)))