Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

TRACÉ D'ÉTOILES


Information sur la source

Catégorie :Graphique Classé sous : etoile Niveau : Initié Date de création : 13/08/2001 Vu : 2 978

Note :
6 / 10 - par 3 personnes
6,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

Description

Ce code trace une étoile centrée en (x0,y0), à n branches, de rayon r et d'angle initial a.
 

Source

  • 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
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.
 

Commentaires et avis

Aucun commentaire pour le moment.

Ajouter un commentaire

Discussions en rapport avec ce code source dans le forum

Aide pour MACRO TABLE DE MULTIPLICATION [ par bencoco ] Bonjour, J'ai un soucis pour réussir à faire une macro VBA en utilisant Word : l'énoncé me demande faire une macro qui demande à l'utilisateur un nomb


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Comparez les prix Nouvelle version

Photothèque Nouveau !



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,328 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.