开发者

.NET - need 10 points around an ellipse

Simple code fragment below draws an ellipse on a VB.NET panel. I now need to locate 10 points ON that ellipse, so I can draw small circles along the edge (the final effect will be an elliptical "table" with 10 "seats" around it.

Help filling in the center of my loop below appreciated.

    Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

    Const OFFSET As Integer = -36

    Dim g As Graphics = e.Graphics
    Dim r As Rectangle = Panel1.ClientRectangle
    Dim iAng As Integer


    r.Inflate(OFFSET, OFFSET)
    g.D开发者_开发知识库rawEllipse(Pens.Black, r)

    For i As Integer = 0 To 9
        iAng = i * 36

    Next

End Sub


If A is the horizontal radius of the ellipse, and B is the vertical radius, then for any given angle R in radians:

X(R) = A * cos(R)

Y(R) = B * sin(R)

So if you take R = 0, 1 * 2pi/10, 2 * 2pi/10....9 * 2pi/10, then you can find ten seats distributed around the ellipse.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜