Develop and Download Open Source Software

Browse Subversion Repository

Contents of /Plugin/Mandelbrot.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download) (as text)
Wed Feb 10 18:21:00 2010 UTC (14 years ago) by sho1get
File MIME type: text/x-c++src
File size: 1046 byte(s)


1 #include "StdAfx.h"
2 #include "Flactale.h"
3
4 //////////////////////////////////////////////////////////////////////////
5
6 CMandelbrot::CMandelbrot()
7 {
8 }
9
10 CMandelbrot::~CMandelbrot()
11 {
12 }
13
14 void CMandelbrot::Calculation(int nYPoint, LPCOLORREF lpColor)
15 {
16 double cy, cx, zx, zy, work;
17 double dbImgMin, dbSide, dbRealMin;
18 int nWidth, nHeight, nCountMax;
19 int i, j;
20
21 nWidth = m_Flactale.nWidth;
22 nHeight = m_Flactale.nHeigth;
23 nCountMax = m_Flactale.nCountMax;
24 dbImgMin = m_Flactale.dbImgMin;
25 dbSide = m_Flactale.dbSide;
26 dbRealMin = m_Flactale.dbRealMin;
27
28 cy = dbImgMin + dbSide * nYPoint / nHeight;
29
30 for (i = 0; i < nWidth; i++)
31 {
32 cx = dbRealMin + dbSide * i / nWidth;
33 zx = cx;
34 zy = cy;
35
36 for (j = 0; j < nCountMax; j++)
37 {
38 if (4.0 < (zx * zx + zy * zy))
39 {
40 break;
41 }
42
43 work = zx * zx - zy * zy + cx;
44 zy = 2.0 * zx * zy + cy;
45 zx = work;
46 }
47
48 lpColor[i] = m_nPal[j];
49 }
50 }
51
52 //////////////////////////////////////////////////////////////////////////

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26