Hey all!
All thanks goes to this website. All I did was translate the code into VB with slight modifications. It draws the set at the specified location, zoom, and with the specified iterations (max). It's really interesting, plus, you can essentially zoom in an unlimited amount of times at any location.
Attachment 137995Code:Private Function Draw(max As Int32, W As Int32, H As Int32, Zoom As Single, X_Location As Single, Y_Location As Single) As Bitmap Dim B As New Bitmap(W + 1, H + 1) For row As Int32 = 0 To H Step 1 For col As Int32 = 0 To W Step 1 Dim c_re As Double = (col - W / 2.0) * (4 / Zoom) / W + X_Location Dim c_im As Double = (row - H / 2.0) * (4 / Zoom) / W + Y_Location Dim x As Double = 0 Dim y As Double = 0 Dim iteration As Int32 = 0 Do While (x * x + y * y <= 4 And iteration < max) Dim x_new As Double = x * x - y * y + c_re y = 2 * x * y + c_im x = x_new iteration += 1 Loop Dim RGB As Int32 = CInt(254 * iteration / max) If (iteration < max) Then B.SetPixel(col, row, Color.FromArgb(RGB, RGB, RGB)) Else B.SetPixel(col, row, Color.Black) ' B.SetPixel(col, row, Color.White) Else B.SetPixel(col, row, Color.Black) Next col Next row Return B End Function
Attachment 137997
~Nic




Reply With Quote
