本文整理汇总了C++中Complex::modul方法的典型用法代码示例。如果您正苦于以下问题:C++ Complex::modul方法的具体用法?C++ Complex::modul怎么用?C++ Complex::modul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Complex
的用法示例。
在下文中一共展示了Complex::modul方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Julia
void Julia(double xmin,double xmax,double ymin,double ymax, double resolution,
int maxsteps,int* matrix,int height,int width,double compp1,double compp2,int lines,int rank,int notask){
int i = rank * lines,j = 0;
double x = xmin;
double y = ymin + resolution*rank*lines;
// cout<<"Am aici commp1 si compp2"<<compp1<<" "<<compp2<<"\n";
Complex *c = new Complex(compp1,compp2);
// cout<<"\t Julia sunt in threadul"<<rank<<"si am x de inceput: "<<x<<" si y de inceput "<<y<<"\n";
Complex *z;
int k = 0;
if(rank != notask -1){
while(i < (rank*lines + lines)){
x = xmin;
j = 0;
while(j < width){
z = new Complex(x,y);
int step = 0;
while( z->modul() < 4 && step < maxsteps){
z->inmultire(z);
z->plus(c);
step++;
}
int color = step % 256;
matrix[k] = color;
x += resolution;
j++;
k++;
}
y+= resolution;
i++;
}
}else{
while(i < height){
x = xmin;
j = 0;
while(j < width){
z = new Complex(x,y);
int step = 0;
while( z->modul() < 4 && step < maxsteps){
z->inmultire(z);
z->plus(c);
step++;
}
int color = step % 256;
matrix[k] = color;
x += resolution;
j++;
k++;
}
y+= resolution;
i++;
}
}
// cout<<"Si am scris aici in Julia "<< k <<" chestii \n";
}