Home
News
Forum
Wiki
Blog
Contents
Gallery
Movies
Downloads
About NSL
[
List of Titles
|
List of Pages
|
New
|
Search
|
Recent changes
|
Help
]
CTView/Mandel.cpp
[
Front page
]
[ ]
Start:
*** mandel_proc
MANDEL_API MSGraph<sWord>* mandel_proc(MSGraph<sWord>* vp)
{
MSGraph<sWord>* xp = NULL;
int Xsize = 600; // スクリーンのXサイズ
double Infnty = 1.0e8; // 無限大
double Xmin = -2.5; // X軸(実数部)の最小値の...
double Xmax = 1.0; // X軸(実数部)の最大値の...
double Ymin = -1.5; // Y軸(虚数部)の最小値の...
double Ymax = 1.5; // Y軸(虚数部)の最大値の...
double val = 200; // 最大繰り返し回数の初期値
// 数値入力用ダイアログ
BOOL isok = InputMultiNumDLG("X軸の最小値", &Xmin, "X...
"Y軸の最小値", &Ymin, "Y...
"最大繰り返し回数", &val);
if (!isok) {
xp = new MSGraph<sWord>();
xp->state = ERROR_GRAPH_CANCEL;
return xp;
}
/////////////////////////////////////////
// 以下に処理コードを書く
// 入力 vp, 出力 xp
/////////////////////////////////////////
int xsize = Xsize;
int ysize = (int)(xsize*(Ymax-Ymin)/(Xmax-Xmin) + 0.5);
double dC = (Xmax-Xmin)/xsize; // 刻み幅
xp = new MSGraph<sWord>(xsize, ysize); // (xsize ×...
int i, j, k;
double Cr, Ci, Zr, Zi, Zrp, Zip;
Ci = Ymax;
for (j=0; j<xp->ys; j++) {
Cr = Xmin;
for (i=0; i<xp->xs; i++) {
Zrp = 0.0;
Zip = 0.0;
k = 0;
// 漸化式の計算 Z(n+1) = Z(n) + C
do {
Zr = Zrp*Zrp - Zip*Zip + Cr;
Zi = 2.*Zrp*Zip + Ci;
Zrp = Zr;
Zip = Zi;
k++;
} while (Zr<Infnty && Zi<Infnty && k<=(int)va...
xp->point(i, j) = (sWord)((double)(val-k+1)*4...
Cr += dC;
}
Ci -= dC;
}
xp->color = GRAPH_COLOR_ARGB16; // カラーモード
/////////////////////////////////////////
// 処理コードはここまで
/////////////////////////////////////////
return xp;
}
End:
*** mandel_proc
MANDEL_API MSGraph<sWord>* mandel_proc(MSGraph<sWord>* vp)
{
MSGraph<sWord>* xp = NULL;
int Xsize = 600; // スクリーンのXサイズ
double Infnty = 1.0e8; // 無限大
double Xmin = -2.5; // X軸(実数部)の最小値の...
double Xmax = 1.0; // X軸(実数部)の最大値の...
double Ymin = -1.5; // Y軸(虚数部)の最小値の...
double Ymax = 1.5; // Y軸(虚数部)の最大値の...
double val = 200; // 最大繰り返し回数の初期値
// 数値入力用ダイアログ
BOOL isok = InputMultiNumDLG("X軸の最小値", &Xmin, "X...
"Y軸の最小値", &Ymin, "Y...
"最大繰り返し回数", &val);
if (!isok) {
xp = new MSGraph<sWord>();
xp->state = ERROR_GRAPH_CANCEL;
return xp;
}
/////////////////////////////////////////
// 以下に処理コードを書く
// 入力 vp, 出力 xp
/////////////////////////////////////////
int xsize = Xsize;
int ysize = (int)(xsize*(Ymax-Ymin)/(Xmax-Xmin) + 0.5);
double dC = (Xmax-Xmin)/xsize; // 刻み幅
xp = new MSGraph<sWord>(xsize, ysize); // (xsize ×...
int i, j, k;
double Cr, Ci, Zr, Zi, Zrp, Zip;
Ci = Ymax;
for (j=0; j<xp->ys; j++) {
Cr = Xmin;
for (i=0; i<xp->xs; i++) {
Zrp = 0.0;
Zip = 0.0;
k = 0;
// 漸化式の計算 Z(n+1) = Z(n) + C
do {
Zr = Zrp*Zrp - Zip*Zip + Cr;
Zi = 2.*Zrp*Zip + Ci;
Zrp = Zr;
Zip = Zi;
k++;
} while (Zr<Infnty && Zi<Infnty && k<=(int)va...
xp->point(i, j) = (sWord)((double)(val-k+1)*4...
Cr += dC;
}
Ci -= dC;
}
xp->color = GRAPH_COLOR_ARGB16; // カラーモード
/////////////////////////////////////////
// 処理コードはここまで
/////////////////////////////////////////
return xp;
}
Page:
Site Search
Advanced Search
Login
Username:
Password:
Lost Password?
Register now!!
Sub Menu
New Arrivals
Books
Web Links
Site Map
e-Learning
TUIS Certificate
mini Calendar
May 2025
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Today
Who's Online
105 user(s) are online (6 user(s) are browsing xpwiki)
Members: 0
Guests: 105
more...
Access Counter
Today :
Yesterday :
Total :
Powered by XOOPS Cube 2.1© 2001-2006
XOOPS Cube Project
Design by
XoopsDesign.com