Visualizzazione dei risultati da 1 a 9 su 9

Discussione: [c] frattali

  1. #1
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448

    [c] frattali

    ho scritto un programmino che "dovrebbe" generare una frattale secondo l'algoritmo di Mandelbrot.
    il problema è che l'output non è proprio quello che mi aspettavo, ho provato ad aumentare fino a 100000 il numero di iterazioni senza risultati.
    posto il codice della funzione principale
    codice:
    void Draw_Fractal(void) {
      int k;
      double zr,zi,x,y,absol;
      glColor3f(0.0, 0.0, 0.0);
      glClear(GL_COLOR_BUFFER_BIT);
      
      for (x=-2.0;x<=0.5;x+=0.001)
        for (y=-1.25;y<=1.25;y+=0.001) {
          zr=0.0;
          zi=0.0;
          for (k=0;k<=150;k++) {
            zr=zr*zr-zi*zi+x;
    	zi=2.0*zr*zi+y;
    	}
          absol=zr*zr+zi*zi;
          if (absol<=4.0) {
            glColor3d(absol/4, x*x/absol, y*y/absol);
            glBegin(GL_POINTS);
            glVertex2d(x, y);
            glEnd();
    	}
          }
      }
    cosa sto sbagliando? grazie per le risposte
    (il risultato è allegato.)
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

  2. #2
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    risolto :metallica
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

  3. #3
    come hai fatto?
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  4. #4
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    posto il codice:
    codice:
    void Draw_Fractal(void) {
      int k;
      double zr,zi,x,y,temp;
      glColor3f(0.0, 0.0, 0.0);
      glClear(GL_COLOR_BUFFER_BIT);
      
      for (x=-2.0;x<=0.5;x+=0.0005)
        for (y=-1.25;y<=1.25;y+=0.0005) {
          zr=0.0;
          zi=0.0;
          for (k=0;k<=1000;k++) {
            temp=zr*zr-zi*zi+x;
    	zi=2.0*zr*zi+y;
    	zr=temp;
    	if (zr*zr+zi*zi>=4.0) {
              glColor3d(k/20.0, k/20.0, k/40.0);
              glBegin(GL_POINTS);
              glVertex2d(x, y);
              glEnd();
    	  break;
    	  }
    	}
          }
      }
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

  5. #5
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    ho usato le GLUT per disegnare i singoli pixel processati con l'algoritmo iterativo di Mandelbrot.
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

  6. #6
    Utente di HTML.it L'avatar di anx721
    Registrato dal
    Apr 2003
    Messaggi
    2,352
    Bello il tuo frattale :gren: :gren:

  7. #7
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    ok, ora basta con gli snapshots
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

  8. #8
    Utente bannato
    Registrato dal
    Jan 2003
    Messaggi
    1,414


    Che belli! Ma cosa sono? Come li hai fatti?
    Mi potresti linkare qualche info? grassie

    [OT] Ma sei una ragazza? [/OT]

  9. #9
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    ehi,non sono una ragazza!
    Julia è il tipo di algoritmo!
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.