【正文】
圖 ○ 2 Mandelbrot 集:查看 Mandelbrot 集。 ○ 2 保存 : 保存當前圖片。 // oops, something happened in the write else return TRUE。dwWritten, NULL)。 // Write the file header WriteFile(fh,(LPBYTE)amp。 = 0。 dwDIBSize += dwBmBitsSize。t calculate size, so trust the biSizeImage // field if ((lpBIbiCompression == BI_RLE8) || (lpBIbiCompression == BI_RLE4)) dwDIBSize += lpBIbiSizeImage。 } // Fill in the fields of the file header // Fill in file type (first 2 bytes must be BM for a bitmap) = DIB_HEADER_MARKER。t // save it because our functions aren39。 if (!lpBI) { CloseHandle(fh)。 if (!hDib) return FALSE。 // Header for Bitmap file LPBITMAPINFOHEADER lpBI。 RealizePalette(hDC)。 return NULL。 hDIB = NULL。 ReleaseDC(NULL, hDC)。 else { 理學學士學位論文 第二章 分形 相關(guān) 理 論 問題 19 // clean up and return NULL GlobalFree(hDIB)。 // if the driver did not fill in the biSizeImage field, make one up if ( == 0) = WIDTHBYTES((DWORD) * biBits) * 。 /// use our bitmap info. to fill BITMAPINFOHEADER *lpbi = bi。 RealizePalette(hDC)。 RealizePalette(hDC)。 // calculate size of memory block required to store BITMAPINFO dwLen = + PaletteSize((LPBYTE)amp。 = 0。 = 1。 else // if greater than 8bit, force to 24bit biBits = 24。 // calculate bits per pixel 理學學士學位論文 第二章 分形 相關(guān) 理 論 問題 17 biBits = * 。 // fill in BITMAP structure, return NULL if it didn39。 // size of memory block HANDLE hDIB, h。 } 位圖格式轉(zhuǎn)換函數(shù): HDIB CGlobal::BitmapToDIB(HBITMAP hBitmap, HPALETTE hPal) { BITMAP bm。 // select old bitmap back into memory DC and get handle to // bitmap of the screen hBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap)。 nHeight = nY2 nY。 if (nY 0) nY = 0。 nY2 = lpRectbottom。 hMemDC = CreateCompatibleDC(hScrDC)。 // DIB width and height int xScrn, yScrn。 } HBITMAP CGlobal::CopyScreenToBitmap(LPRECT lpRect) { HDC hScrDC, hMemDC。 // convert the bitmap to a DIB hDIB = BitmapToDIB(hBitmap, hPalette)。 // handle to palette HDIB hDIB = NULL。 // get the DIB of the client area by calling // CopyScreenToDIB and passing it the client rect hDIB = CopyScreenToDIB(lpRect)。 lpRectleft = 。 ClientToScreen(hWnd, amp。 // convert client coords to screen coords = lpRectleft。 (hDib,())。 if(()==IDOK) { CRect NowRect。位圖的復制和剪切原理是相同的,它們不同點在于剪切的時候需要在將選定區(qū)域復制后將其重畫為白色區(qū)域。可以達到要求。得到,函數(shù)中的參數(shù) lpRect 表示客戶區(qū)域的大小。 ○ 2 將當前客戶區(qū)域拷貝為位圖操作比較復雜,這里只能將其簡略化后再加以描述。 圖形參見:圖 。y = w z 。 下面是繪制 GumowskiMira 分形圖的算法: ○ 1 假定 a=, b=, i=0, x=1, y=1。 理學學士學位論文 第二章 分形 相關(guān) 理 論 問題 11 GumowskiMira 公式 1980 年 , 工作在 CERN 的物理學家 Gumowski, I. 和 Mira, C. 嘗試計 算模擬基本粒子軌跡 (The trajectories of elementary particles) 在加速器 (Accelerator) 中的行為 。 此網(wǎng)格共有 a/2 層,設 k 為層數(shù),從 k=1 到 k=a/2,進行如下循環(huán): ○ 1 設第 k 層中任意點為 ( , )iixy ,則判斷其臨近 8 點的現(xiàn)有狀態(tài);如果 ( 1 , 1 ) ( , 1 ) ( 1 , 1 ) ( 1 , )( 1 , 1 ) ( , 1 ) ( 1 , 1 ) ( 1 , )i i i i i i i ii i i i i i iF x y F x y F x y F x yF x y F x y F x y F x y? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? 奇 數(shù) 則 ( , ) 1iiF x y ? 否則 ( , ) 0iiF x y ? 當每一層中所有點判斷完結(jié)后,進行下一步。 算法的效果圖參見圖 。 即要在前面提到的繪制Julia 集的計算機算法步驟 ○ 2 后面添加下列幾步算法: ○ A 令 t1= 0x ,t2= 0x , i=0, t3=t4=0,N=10 進行如下循環(huán)。再將 ,ttxy進行下一步運算即可實現(xiàn)對 Julia 集的旋轉(zhuǎn)。 r r r39。39。 平移對象使基準點回到其原始位置。 Julia 集的放大原理與 Mandelbrot 集的放大原理相同,就不再贅述了。tm pD oub l e = y Min。 圖形矢量移動前后效果對比參見圖 與圖 。t m pDoubl e = y Ma x y Mi n。只要將鼠標移動的位置大小轉(zhuǎn)換成參數(shù)窗口移動的位置大小就可以了。這個算法主要是為了平滑分形圖形的色彩變化,讓圖形看起來更有美感。 red, green,blue 與 0x1FF 進行 amp。 0x1FF) 0xFF) 理學學士學位論文 第二章 分形 相關(guān) 理 論 問題 7 green = green ^ 0x1FF。然后再將根據(jù)上述步驟求得的 R、 G、 B,用函數(shù) RGB(R,G,B)換成色彩,從而實現(xiàn)對 Julia 集的著色。 blue = k + m_nRed。 我們對分形圖形進行著色也使用這種色彩模型。 Mandelbrot 集圖形:見圖 。 理學學士學位論文 第二章 分形 相關(guān) 理 論 問題 6 如果 rM? ,且 maxt Time? ,則轉(zhuǎn)至步驟 ○ 3 。 Julia 集圖形:見圖 。 如果 rM? ,且 maxt Time? ,則轉(zhuǎn)至步驟 ○ 3 。 ○ 1 選 定 參 數(shù) C p qi?? , min min ? ? ? , max max ??, M=100 ,maxTime=200,令: m a x m i n( ) /( 1 )x x x w id th? ? ? ? m a x m in( ) /( 1 )y y y h e igh t? ? ? ? 逃逸區(qū) M’ 收斂區(qū)域 A 未逃逸區(qū) M 逃逸邊界 理學學士學位論文 第二章 分形 相關(guān) 理 論 問題 5 其中 C 表示復數(shù)上一個點, minx , maxx , miny , maxy 表示參數(shù)窗口大小, M 表示逃逸邊界值, maxTime 表示循環(huán)可以執(zhí)行的最大次數(shù)。 理學學士學位論文 第二章 分形 相關(guān) 理 論 問題 4 逃逸時間算法的基本思想 根據(jù)上述想法,我們將吸引域的概念進一步擴展。 于是,我們發(fā)現(xiàn),復平面上可分為兩個區(qū)域,一個區(qū)域合落在其中的點向0 收斂 ,而另一個區(qū)域合落在其中的點向 ? 逃逸,它們的分界線便是 0| ( )| 1Fz? 。先考慮 C=0 的情況, Z 是復數(shù),即 Z=x+yi,則有: 2 2 2 2 2 2( ) ( ) 2 ( ) 2z z z x y i x y i x y i x y i x y x y i? ? ? ? ? ? ? ? ? ? ? ? 我們還可以定義復數(shù) z=x+yi 的絕對值,即: 22||z x y??,而 |Z|恰好相反是從原點到 Z 的距離。目前用計算機繪制分形圖是如此流行,以致不僅使繪制分形的算法理論與程序設計已成為一個獨立的研究方向,同時繪制的分形圖也已成了一種相當時髦的藝術(shù)形式。她在純數(shù)學、物理學、材料科學、地質(zhì)勘探、疾病診斷、股價預測以及計算機和信息科學等許多領(lǐng)域中,都得到了廣泛的應用。 近幾年在流體力學不穩(wěn)定性、光學雙穩(wěn)定器件、化學震蕩反映等試驗中,都實際測得了混沌吸引子,并從實驗數(shù)據(jù)中計算出它們的分維。 有人研究了某些云彩邊界的幾何性質(zhì),發(fā)現(xiàn)存在從 1 公里到 1000 公里的無標度區(qū)。受到污染的一些流水中,粘在藻類植物上的顆粒和膠狀物,不斷因新的沉積而生長,成為帶有許多須須毛毛的枝條狀,就可以用分維。只要有足夠的分辨率,就可以發(fā)現(xiàn)原以為是直線段的部分,其實由大量更小尺度的折線連成。分形作為幾何對象,是破碎的,不規(guī)則的,但不是所有破碎的,不規(guī)則的形狀都是分形,分形一般還具有自相似性,一個對象的部分與整體有自仿射變換關(guān)系,我們也可以稱之為分形。也就是說,在分形中,每一組成部分都在特征上和整體相似,只僅僅是變小了一些而已。s creating, for example the vector move, circumvolve, zoom in, zoom out, and other vector transformation. In addition, picture parametric can be changed and picture colour can also be changed .this topic involved the GumowskiMira fractal, two dimension Cellular Automata fractal. Fractal unfurl an new world build