.NET - you need 10 points around the ellipse

A simple piece of code draws an ellipse in a VB.NET panel. Now I need to find 10 points on this ellipse, so I can draw small circles along the edge (the final effect will be an elliptical "table" with 10 "seats" around it.

Help fill the center of my cycle below, rated.

    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.DrawEllipse(Pens.Black, r)

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

    Next

End Sub
+3
source share
1 answer

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 places distributed around the ellipse.

+2
source

Source: https://habr.com/ru/post/1755852/


All Articles