Ce code trace une étoile centrée en (x0,y0), à n branches, de rayon r et d'angle initial a.
Source / Exemple :
If n / 2 = Int(n / 2) Then
Px = r * Cos(a) + x0
Py = r * Sin(a) + y0
For j = 1 To n / 2
Px2 = r * Cos(a + 4 * Pi * j / n) + x0
Py2 = r * Sin(a + 4 * Pi * j / n) + y0
Picture1.Line (Px, Py)-(Px2, Py2)
Picture1.Line (Px, Py)-(Px2, Py2)
txtLaTeX.Text = txtLaTeX.Text & vbCrLf & "\put(" & Px & "," & Py & "){\line{...}}"
Px = Px2
Py = Py2
Next j
Px = r * Cos(a + 2 * Pi / n) + x0
Py = r * Sin(a + 2 * Pi / n) + y0
For j = 1 To n / 2
Px2 = r * Cos(a + 2 * Pi / n + 4 * Pi * j / n) + x0
Py2 = r * Sin(a + 2 * Pi / n + 4 * Pi * j / n) + y0
Picture1.Line (Px, Py)-(Px2, Py2)
Picture1.Line (Px, Py)-(Px2, Py2)
txtLaTeX.Text = txtLaTeX.Text & vbCrLf & "\put(" & Px & "," & Py & "){\line{...}}"
Px = Px2
Py = Py2
Next j
Else
Px = r * Cos(a) + x0
Py = r * Sin(a) + y0
For j = 1 To n
Px2 = r * Cos(a + 2 * Pi * j * (n - 1) / 2 / n) + x0
Py2 = r * Sin(a + 2 * Pi * j * (n - 1) / 2 / n) + y0
Picture1.Line (Px, Py)-(Px2, Py2)
txtLaTeX.Text = txtLaTeX.Text & vbCrLf & "\put(" & Px & "," & Py & "){\line{...}}"
Px = Px2
Py = Py2
Next j
End If
Conclusion :
La sortie se fait sur une picturebox modifiée pour avoir un repère orthonormal direct.
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.