FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC

Développement d'applications avec le langage Panoramic
 
AccueilAccueil  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  MembresMembres  Connexion  
Derniers sujets
» Bataille navale SM
Biomorphes de Pickover Emptypar jjn4 Hier à 17:39

» Une calculatrice en une ligne de programme
Biomorphes de Pickover Emptypar jean_debord Hier à 8:01

» Gestion d'un système client-serveur.
Biomorphes de Pickover Emptypar Pedro Jeu 25 Avr 2024 - 19:31

» Les maths du crocodile
Biomorphes de Pickover Emptypar jean_debord Jeu 25 Avr 2024 - 10:37

» Naissance de Crocodile Basic
Biomorphes de Pickover Emptypar jean_debord Jeu 25 Avr 2024 - 8:45

» Editeur EliP 6 : Le Tiny éditeur avec 25 onglets de travail
Biomorphes de Pickover Emptypar Froggy One Mer 24 Avr 2024 - 18:38

» Dessine-moi une galaxie
Biomorphes de Pickover Emptypar jjn4 Lun 22 Avr 2024 - 13:47

» Erreur END_SUB
Biomorphes de Pickover Emptypar jjn4 Lun 22 Avr 2024 - 13:43

» Bug sur DIM_LOCAL ?
Biomorphes de Pickover Emptypar papydall Dim 21 Avr 2024 - 23:30

» Form
Biomorphes de Pickover Emptypar leclode Dim 21 Avr 2024 - 18:09

» trop de fichiers en cours
Biomorphes de Pickover Emptypar Marc Dim 21 Avr 2024 - 2:41

» 2D_fill_color(résolu)
Biomorphes de Pickover Emptypar leclode Sam 20 Avr 2024 - 8:32

» Consommation gaz électricité
Biomorphes de Pickover Emptypar leclode Mer 17 Avr 2024 - 11:07

» on_key_down (résolu)
Biomorphes de Pickover Emptypar leclode Mar 16 Avr 2024 - 11:01

» Sous-programme(résolu)
Biomorphes de Pickover Emptypar jjn4 Jeu 4 Avr 2024 - 14:42

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Avril 2024
LunMarMerJeuVenSamDim
1234567
891011121314
15161718192021
22232425262728
2930     
CalendrierCalendrier
Le Deal du moment : -21%
LEGO® Icons 10329 Les Plantes Miniatures, ...
Voir le deal
39.59 €

 

 Biomorphes de Pickover

Aller en bas 
3 participants
AuteurMessage
jean_debord

jean_debord


Nombre de messages : 1249
Age : 69
Localisation : Limoges
Date d'inscription : 21/09/2008

Biomorphes de Pickover Empty
MessageSujet: Biomorphes de Pickover   Biomorphes de Pickover EmptySam 26 Avr 2014 - 16:35

Les Biomorphes de Pickover sont des ensembles de Julia coloriés de manière à imiter des animaux microscopiques. Le programme suivant en trace quelques-uns à partir de la formule classique z^2 + c. On peut obtenir des images différentes en changeant les coordonnées c_X et c_Y du paramètre c.

Tout ceci sera développé dans un prochain article.

Ce programme est pour le compilateur. Il marche aussi avec l'interpréteur, mais beaucoup plus lentement.

Code:

' **********************************************************************
' Biomorphe de Pickover
' **********************************************************************

' Variables definies par l'utilisateur

dim PicWidth%  : PicWidth%  = 640   : ' Taille de l'image en pixels
dim PicHeight% : PicHeight% = 480

dim c_X        : c_X = 0.4          : ' Coordonnees du parametre c
dim c_Y        : c_Y = 0.7

dim x0         : x0 = 0             : ' Coord. du centre de l'image
dim y0         : y0 = 0
dim Esc        : Esc = 10           : ' Rayon d'echappement
dim MaxIter%   : MaxIter% = 100     : ' Nb maxi d'iterations
dim ZoomFact   : ZoomFact = 1       : ' Facteur de zoom
dim ColorFact  : ColorFact = -2     : ' Facteur de coloration
dim CstVal     : CstVal = 0.9       : ' Luminosite HSV (constante)

' Variables supplementaires

dim HalfPicWidth%  : HalfPicWidth%  = PicWidth% / 2
dim HalfPicHeight% : HalfPicHeight% = PicHeight% / 2

dim Ln2   : Ln2   = log(2)
dim Esc2  : Esc2  = Esc * Esc
dim LnEsc : LnEsc = log(Esc)

dim H, S, V, R%, G%, B%  : ' Parametres de coloration

dim AbsColor             : ' abs(ColorFact)
dim ScaleFact            : ' Facteur d'echelle = distance entre 2 pixels

dim Nx%, Ny%             : ' Coordonnees d'un point (pixels)
dim xt, yt               : ' Coordonnees d'un point (algebriques)

dim Iter%                : ' Nb d'iterations
dim zn_x, zn_y           : ' Nombre complexe z(n)

' Variables utilisees en interne par les sous-programmes

dim II%, ZZ, FF, PP, QQ, TT, RR, GG, BB  : ' HSVtoRGB
dim M2, Dwell, Q, Angle, Radius          : ' MdbCol
dim x, y                                 : ' Biomorph

label Func, Biomorph, MdbCol, HSVtoRGB

' ----------------------------------------------------------------------
' Description des objets
' ----------------------------------------------------------------------

' Fenetre principale

left    0, 50
top     0, 50
width   0, PicWidth% + 70
height  0, PicHeight% + 120
caption 0, "Biomorphe de Pickover ... Veuillez patienter."

' Image

picture 1
left    1, 30
top     1, 40
width   1, PicWidth%
height  1, PicHeight%

2d_target_is 1

' ----------------------------------------------------------------------
' Programme principal
' ----------------------------------------------------------------------

ColorFact = 0.01 * ColorFact
AbsColor  = abs(ColorFact)
ScaleFact = 4 / (PicHeight% * ZoomFact)

for Ny% = 0 to PicHeight% - 1
  yt = y0 - ScaleFact * (Ny% - HalfPicHeight%)
  for Nx% = 0 to PicWidth% - 1
    xt = x0 + ScaleFact * (Nx% - HalfPicWidth%)
    gosub Biomorph
    2d_pen_color R%, G%, B%
    2d_point Nx%, Ny%
  next Nx%
next Ny%

caption 0, "Biomorphe de Pickover ... Terminé."

end

' ----------------------------------------------------------------------
' Sous-programmes
' ----------------------------------------------------------------------

Func:
' Calcul de la fonction complexe : (zn_x, zn_y) = f(x, y) + c

  zn_x = x * x - y * y + c_X
  zn_y = 2 * x * y + c_Y
return

Biomorph:
' Iteration de la fonction complexe au point (xt, yt)

  zn_x = xt
  zn_y = yt
  
  Iter% = 0
  M2 = 0

  while Iter% < MaxIter% and M2 < Esc2

    x = zn_x
    y = zn_y

    gosub Func

    M2 = zn_x * zn_x + zn_y * zn_y
    
    Iter% = Iter% + 1

  end_while

  if abs(zn_x) < Esc or abs(zn_y) < Esc
    R% = 0
    G% = 0
    B% = 0
    return
  end_if

  gosub MdbCol
return

MdbCol:
' Determine la teinte (Hue, H) et la Saturation (S)
' d'apres le "Continuous dwell"

  Dwell = Iter% + log(LnEsc / log(M2)) / Ln2
  if Dwell <= 0 then Dwell = 0.1
  Q = log(Dwell) * AbsColor

  if Q < 0.5
    Q = 1 - 1.5 * Q
    Angle = 1 - Q
  else
    Q = 1.5 * Q - 0.5
    Angle = Q
  end_if

  Radius = sqr(Q)

' Si ColorFact > 0, assombrir une bande sur 2

  V = CstVal

  if (ColorFact > 0) and (odd(Iter%) > 0)
    V = 0.85 * V
    Radius = 0.667 * Radius
  end_if

  H = Angle * 10
  H = H - int(H)
  H = H * 360

  S = Radius - int(Radius)

' Convertir HSV en RGB

  gosub HSVtoRGB
return

HSVtoRGB:
' Conversion HSV --> RGB.
' Entree : H, S, V. Sortie : R%, G%, B%

  if S = 0
    R% = int(V * 255)
    G% = R%
    B% = R%
    return
  end_if

  ZZ  = H / 60
  II% = int(ZZ)
  FF  = ZZ - int(ZZ)
  PP  = V * (1 - S)
  QQ  = V * (1 - S * FF)
  TT  = V * (1 - S * (1 - FF))

  select II%
    case 0
      RR = V  : GG = TT : BB = PP
    case 1
      RR = QQ : GG = V  : BB = PP
    case 2
      RR = PP : GG = V  : BB = TT
    case 3
      RR = PP : GG = QQ : BB = V
    case 4
      RR = TT : GG = PP : BB = V
    case 5
      RR = V  : GG = PP : BB = QQ
  end_select

  R% = int(RR * 255)
  G% = int(GG * 255)
  B% = int(BB * 255)
return
Revenir en haut Aller en bas
http://www.unilim.fr/pages_perso/jean.debord/index.htm
papydall

papydall


Nombre de messages : 6996
Age : 73
Localisation : Moknine (Tunisie) Entre la chaise et le clavier
Date d'inscription : 03/03/2012

Biomorphes de Pickover Empty
MessageSujet: Re: Biomorphes de Pickover   Biomorphes de Pickover EmptySam 26 Avr 2014 - 16:45

Très intéressant !
Revenir en haut Aller en bas
http://papydall-panoramic.forumarabia.com/
Jicehel

Jicehel


Nombre de messages : 5947
Age : 51
Localisation : 77500
Date d'inscription : 18/04/2011

Biomorphes de Pickover Empty
MessageSujet: Re: Biomorphes de Pickover   Biomorphes de Pickover EmptySam 26 Avr 2014 - 17:56

Joli Wink
Revenir en haut Aller en bas
Contenu sponsorisé





Biomorphes de Pickover Empty
MessageSujet: Re: Biomorphes de Pickover   Biomorphes de Pickover Empty

Revenir en haut Aller en bas
 
Biomorphes de Pickover
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Biomorphe de Pickover

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC :: PANORAMIC Le compilateur :: Le Compilateur-
Sauter vers: