Thursday, September 29, 2011

Figure 30


$40 off Craftsman 5 Drawer Homeowner Tool Center with Riser and Parts Bins $99.99 on sale 10/2-10/8
Sears Deal of the Day: Thule Car Top Carrier, Quest
Wholesale Fleece Blankets
400950_BuddhaGroove.com-Culture Infused Living: Home Accents, Jewelry, Accessories from around the world!
400948_Culture Infused Living: Home Accents, Jewelry, and accessories from around the world. CulturalElemen
504427_Save up to 75% on batteries and accessories at Brooklyn Battery Works!
504080_10% OFF Orders of $75 or More from Journelle.com! Use Promo Code: NOV11 (Valid 11/1 - 11/30/11)
502239_Brand names, bargain prices at shoezoo.com. If you don't love your new shoes, return them for free!

400949_GaneshMall.com-Culture Infused Living: Home Accents, Jewelry, and accessories from around the world!



Figure 30
===========================

/*
//Author: Cheikh Drame
//To support, please do one of the following
//- Visit irap123.com many times a day
//- Join irap123.com
//- Buy my app irap123 (rhyming dictionary) available for android, and iphone. On windows phone, it is called iLyrics. If not, you can get the desktop version at www.irap123.com/apps/webstore/
//- Include irap123.com in your blogs, forums, facebook walls, email footers, comments
//- send a donation at my paypal address at cbdsigned.vevo@gmail.com
//- Buy a story at http://shop.pparzygnat.com
*/
// JuliaSet.cpp : Defines the entry point for the console application.
//

#include
#include

int height=400, width=400;

int julia(double x, double y, int n)
{
double xx, yy, p=-0.7454, q=0.1131;
int i=0;

xx=x*x;
yy=y*y;
while(++i y=2*x*y+1;
x=xx-yy+p;
xx=x*x;
yy=y*y;
if( (xx+yy)>4) return i;
}
return 0;
}
void display(void)
{
double min_a, min_b,max_a, max_b, step_a, step_b, a,b;

int c, n=180;
float scale=255.0/n;
min_a=-1.6;
max_a=1.6;
min_b=-1.2;
max_b=1.2;
step_a=(max_a-min_a)/width;
step_b=(max_b-min_b)/height;

glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
a=min_a;
for(int x=0; x b=min_b;
for(int y=0; y c=255-scale*julia(a,b,n);
glColor3ub(c,c,c);
glVertex2i(x,y);
b+=step_b;
}
a+=step_a;
}
glEnd();
glFlush();
}


void main(int argc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(400,400);
glutInitWindowPosition(200,100);
glutCreateWindow("sample Prog: Points by irap123.com");
glClearColor(0.0,0.0,0.0,0.0);
gluOrtho2D(-2.0, 2.0,-1.5,1.5);
//gluOrtho2D(-10.0, 10.0, -10, 10);
glutDisplayFunc(display);
glutMainLoop();
}

No comments:

Post a Comment