本文整理汇总了C++中MetaData::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::getWidth方法的具体用法?C++ MetaData::getWidth怎么用?C++ MetaData::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaData
的用法示例。
在下文中一共展示了MetaData::getWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: julia
int Computation::julia(int xpt , int ypt , double xmin , double xmax , double ymin , double ymax , float conx , float cony)
{
MetaData m;
int color;
int h;
double minx = xmin;
double maxx = xmax;
double miny = ymin;
double maxy = ymax;
double pixCorx = (maxx - minx) / m.getWidth();
double pixCory = (maxy - miny) / m.getHeight();
long double x = xpt * pixCorx + minx;
long double y = maxy - ypt * pixCory; //converting from pixels to points
long double xnew = 0;
long double ynew= 0;
for(h = 1 ; h <= iterations + 1; h++)
{
xnew = ((x * x) - (y * y)) + conx;
ynew = (2 * x * y) + cony;
x = xnew;
y = ynew;
if(((x * x) + (y * y)) > 4)
break;
} // for
if(h >= iterations + 1)
{
color = 0;
} // if
else
{
color = h;
} // else
return color;
} // julia()
示例2: mandel
int Computation::mandel(int xpt,int ypt,double xmin,double xmax,double ymin,double ymax , int _type)
{
MetaData m;
long double x = 0;
long double y = 0;
long double xnew = 0;
long double ynew = 0;
double ax;
double ay;
int color;
int h;
int xp = xpt;
int yp = ypt;
double minx = xmin;
double maxx = xmax;
double miny = ymin;
double maxy = ymax;
double pixCorx = (maxx - minx) / m.getWidth();
double pixCory = (maxy - miny) / m.getHeight();
ax = (xp * pixCorx) + (minx);
ay = maxy - (yp * pixCory);
for(h = 1 ; h <= iterations + 1 ; h++)
{
if( _type == MANDEL_TYPE1 )
{
xnew = ((x * x) - (y * y)) + ax;
ynew = (2 * x * y) + ay;
} // if
if( _type == MANDEL_TYPE2 )
{
xnew = ( ( x * x * x ) - ( 3 * x * y * y ) ) + ax;
ynew = ( ( 3 * x * x * y ) - ( y * y * y ) ) + ay;
} // if
if( _type == MANDEL_TYPE3 )
{
xnew = ( ( x * x * x * x ) - ( 6 * x * x * y * y ) + ( y * y * y * y ) ) + ax;
ynew = ( ( 4 * x * x * x * y ) - ( 4 * x * y * y * y ) ) + ay;
} // if
if( _type == MANDEL_TYPE4 )
{
xnew = ( ( x * x * x * x * x ) - ( 10 * x * x * x * y * y ) + ( 5 * x * y * y * y * y ) ) + ax;
ynew = ( ( 5 * x * x * x * x * y ) - ( 10 * x * x * y * y * y ) + ( y * y * y * y * y ) ) + ay;
} // if
if( _type == MANDEL_TYPE5 )
{
xnew = ( ( x * x * x * x * x * x ) - ( 15 * x * x * x * x * y * y ) + (15 * x * x * y * y * y * y ) - ( y * y * y * y * y * y ) ) + ax;
ynew = ( ( 6 * x * x * x * x * x * y ) - ( 20 * x * x * x * y * y * y ) + ( 6 * x * y * y * y * y * y ) ) + ay;
} // if
x = xnew;
y = ynew;
if(((x * x) + (y * y)) > 4)
break;
} // for
if(h >= iterations + 1 )
{
color =0 ;
} // if
else
{
color = h;
} // else
return color;
}