Page 2 of 2

Posted: Tue Nov 26, 2002 2:07 pm
by BackupUser
Restored from previous forum. Originally posted by pusztry.

Thanks This is fun to mess with.

- Ryan


WinXP, PIII 800 MHz, 512MB RAM, SB Live 5.1, NVidia TNT 2 Ultra

Posted: Tue Nov 26, 2002 11:45 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.

just try by replacing the *Line\l = command with ie :

Code: Select all

    floatvalue.f = colorcounter / #maxcolor * $FF + Random(80)
    *Line\l = RGB(floatvalue, floatvalue / 2, floatvalue / 2)
some more color with automatic distortion effect :wink:

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten

Posted: Fri Nov 29, 2002 9:27 am
by BackupUser
Restored from previous forum. Originally posted by Froggerprogger.

Good Morning!
The following code is nearly too cool for this world :):
It shows the julia set with a mouse-varied constant.
So just move the mouse carefully and pray for a faster CPU...

Code: Select all

Declare drawfractal(cx.f, cy.f)#xmax=1024
#ymax=768

#maxcolor=32

#leftside.f  =-2
#top.f       =1.5
xside.f     =4
yside.f     =-3
xscale.f    =xside/#xmax          
yscale.f    =yside/#ymax
cx.f = -0.033 : cy.f = 0.696
; try cx.f = -0.773 :   cy.f = -0.109

Structure LONG
  l.l
EndStructure

If InitSprite()=0 Or InitKeyboard()=0 Or InitMouse()=0
  beep_(300,300):End:EndIf

OpenScreen(#xmax,#ymax,32,"")


Procedure drawfractal(cx.f,cy.f)
  Shared xscale, yscale

  StartDrawing(ScreenOutput())
    Buffer = DrawingBuffer()
    Pitch  = DrawingBufferPitch()
  For y= 0 To #ymax-1
    *Line.LONG = Buffer+y*Pitch
    For x= 0 To #xmax-1
      zx.f= x*xscale+#leftside
      zy.f= y*yscale+#top
        
      colorcounter=0
      
      PowZX.f = 0
      PowZY.f = 0
  
      Repeat 
  
        PowZX = zx*zx
        PowZY = zy*zy
        tempx.f = PowZX-PowZY+cx
        zy      = 2 * zx * zy + cy
        zx      = tempx
        colorcounter+1
          
      Until PowZX+PowZY>4 Or colorcounter>=#maxcolor
      
      floatvalue.f = colorcounter / #maxcolor * $B0 * 3
      *Line\l = RGB(floatvalue, floatvalue / 2, floatvalue / 3)
      ;*Line\l = colorcounter * $111111
      *Line+4
    Next
  Next
  FrontColor(255,255,255)
  DrawingMode(1)
  DrawText("x: "+StrF(cx,4) + "    y: "+StrF(cy,4)+"          ")
  StopDrawing()
  FlipBuffers()
EndProcedure


Repeat
   ExamineMouse()

   cx + MouseDeltaX()*0.005 
   cy - MouseDeltaY()*0.005   
   
   drawfractal(cx,cy)

   ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
CloseScreen()

Thank you all for the new energy in the fractal direction, it's the most fantastic mathematical complex, I've ever heard of.
think global - act fractal !

Purebasic - what a nice name for a girl-friend