Escolar Documentos
Profissional Documentos
Cultura Documentos
SUBMITTED BY ,
S.RAJA PRABHA
[951712205036]
S.SINDHU PARKAVI
[951712205049]
C.VAISHNAVI
[951712205061]
CERTIFICATE
This
is
work
done by S.RAJA
Staff in charge
ACKNOWLEDGEMENT
We have taken efforts in this project. However, it would not have been possible
without the kind support and help of many individuals and our reputed
institution Mepco Schlenk Engineering College, Sivakasi. We would like to
extend our sincere thanks to our Principal Dr. S. Arivazhagan ME., PhD.
We would like to express my special gratitude and thanks to Dr.T.Revathi ME.,
PhD. Senior Professor & Head of the Department for giving us such a
wonderful experience.
We are highly indebted to, Mrs.R.Venitta Raj AP(Sr.Grade)/IT , Mr.B.D.Deebak
AP/IT for their guidance and constant supervision as well as for providing
necessary information regarding the project & also for their support in
completing the project.
We would like to express our gratitude towards our parents and members of IT
Department of this prestigious institution for their kind co-operation and
encouragement which help us in completion of this project.
ABSTRACT
TABLE OF CONTENTS
1.Program statement
2.Program Description
3.Language Used
4. Algorithm
12
5. Procedure
19
6. Code
23
7.ScreenShots
37
8.Conclusion
38
PROGRAM STATEMENT
PROGRAM DESCRIPTION
LANGUAGE USED
OPENGL:
The OpenGL graphics system is a software interface to graphics hardware.
(GL stands for Graphics Library.) It allows you to create interactive
programs that produce color images of moving, three dimensional objects.
With OpenGL, you can control computer-graphics technology to produce
realistic pictures, or ones that depart from reality in imaginative ways. OpenGL
is a software interface to graphics hardware.
This interface consists of more than 700 distinct commands (about 670
commands as specified for OpenGL Version 3.0 and another 50 in the OpenGL
Utility Library) that you use to specify the objects and operations needed to
produce interactive three-dimensional applications. OpenGL is designed as a
streamlined, hardware-independent interface to be implemented on many
different hardware platforms. To achieve these qualities, no commands for
performing windowing tasks or obtaining user input are included in OpenGL;
instead, you must work through whatever windowingsystem controls the
particular hardware youre using. Similarly,OpenGL doesnt provide high-level
commands for describing models of three-dimensional objects. Such commands
might allow you to specify relatively complicated shapes such as automobiles,
parts of the body, airplanes, or molecules. With OpenGL, you must build your
desired model from a small set of geometric primitivespoints, lines, and
polygons. The OpenGL specification describes an abstract API for drawing 2D
want
the
typedefs
you
for
can
get
Windows-
specific extensions, and glext.h is the header which holds mostly platformagnostic extensions and OpenGL core functionality which is later than OpenGL
version 1.1.
Linux
On Linux you need to link against libGL.so, which is usually a symlink to
libGL.so.1, which is yet a symlink to the actual library/driver which is a part of
your graphics driver. For example, on my system the actual driver library is
named libGL.so.256.53, which is the version number of the nvidia driver I use.
You also need to include the gl.h header, which is usually a part of a Mesa or
9
Xorg
package.
Again,
you
might
11
numbered from 0 }
iMaxBound : Integer; { e.g.=1000 }
fMaxSolution : Real; { e.g.=1000000.0f }
{ Calculate current solution for x, y and z. Increment. }
procedure AdvanceXY;
var
xnew, ynew : Real;
begin
xnew:a[0]+x_a[1]+y_a[2]+z_a[3]+
x_x_a[4]+y_y_a[5]+z_z_a[6]+
x_y_a[7]+x_z_a[8]+y_z_a[9];
ynew:a[10]+x_a[11]+y_a[12]+z_a[13]+
x_x_a[14]+y_y_a[15]+z_z_a[16]+
x_y_a[17]+x_z_a[18]+y_z_a[19];
z:a[20]+x_a[21]+y_a[22]+z_a[23]+
12
x_x_a[24]+y_y_a[25]+z_z_a[26]+
x_y_a[27]+x_z_a[28]+y_z_a[29];
x:xnew;
y:ynew;
n:n+1;
end;
{ Generates points of fractal. Display. }
procedure GeneratePoints;
var
k, i, j : Integer;
fScreenX, fScreenY, fScreenZ : Real;
begin
fWidthDiv:iWidth/fScaleX; fHeightDiv:iHeight/fScaleY;
fDepthDiv:iDepth/fScaleZ;
for k:0 to iSizeZ do
13
14
fScreenZ:k_iSizeZ _ 0.5;
PutPoint3D( fScreenX, fScreenY, fScreenZ );
end;
end;
end;
{ Set parameters of a fractal (from _1.2 to 1.2). Prepare fractal environment
}
procedure SetParams;
var
i : Integer;
begin
x:0; y:0; z:0;
{ randomly chosen parameters }
For i:0 to 30 do
a[i]:(random(25)_12 )/10.0;
15
end;
{ Test the solution. See Pickover and Sprott for details }
procedure TestSoln;
begin
If n=iMaxBound then n:0; { solution is bounded }
if ( x_x+y_y+z_z )>fMaxSolution then { solution escaped }
begin
if n>100 then n:iMaxBound
else n:0;
end;
end;
begin
randomize;
{ set some initial values }
iSizeX :100; iSizeY :100; iSizeZ:100;
16
Then choose Win32 Console Application and give its name and loaction.
18
19
20
PROGRAM CODE:
#include "stdafx.h"
#include<math.h>
#include<stdlib.h>
#include<GL/gl.h>
#include<GL/glu.h>
21
#include<GL/glut.h>
#include<conio.h>
const int MaxColors=80;
float x=0.0, y=0.0, z=0.0 ;
float a[30];
float fDimX=8.0, fDimY=8.0, fDimZ=8.0;
int iSizeX=40, iSizeY=40, iSizeZ=40,iDepth=140,iHeight=140,iWidth=140;
float fScaleX=-4.0, fScaleY=4.0,
fScaleZ=4.0,fWidthDiv,fHeightDiv,fDepthDiv;
int iKernelColor=6,iMaxBound=1000;
static int n=0;
float fMaxSolution=1000000.0;
void AdvanceXY()
{
float xnew, ynew;
22
xnew=a[0]+x*a[1]+y*a[2]+z*a[3]+
x*x*a[4]+y*y*a[5]+z*z*a[6]+
x*y*a[7]+x*z*a[8]+y*z*a[9];
ynew=a[10]+x*a[11]+y*a[12]+z*a[13]+
x*x*a[14]+y*y*a[15]+z*z*a[16]+
x*y*a[17]+x*z*a[18]+y*z*a[19];
z=a[20]+x*a[21]+y*a[22]+z*a[23]+
x*x*a[24]+y*y*a[25]+z*z*a[26]+
x*y*a[27]+x*z*a[28]+y*z*a[29];
x=xnew;
y=ynew;
printf("\n%d",n);
n=n+10;
}
void GeneratePoints()
23
{
int k=0, i=0, j=0;
float fScreenX, fScreenY, fScreenZ;
fWidthDiv=iWidth/fScaleX;
fHeightDiv=iHeight/fScaleY;
fDepthDiv=iDepth/fScaleZ;
for (k=0;k<=iSizeZ;k++)
{
printf("OUTER FOR %d ",k);
for (i=0;i<=iSizeX;i++)
{
for (j=0;j<=iSizeY;j++)
{
x=fDimX+i/fWidthDiv;
y=fDimY-j/fHeightDiv;
24
z=fDimZ-k/fDepthDiv;
n=0;
while ((n<MaxColors) && (((x*x)+(y*y)+(z*z))<fMaxSolution))
AdvanceXY();
if(n>=iKernelColor )
{
fScreenX=i-iSizeX * 0.5;
fScreenY=j-iSizeY * 0.5;
fScreenZ=k-iSizeZ * 0.5;
glBegin(GL_POINTS);
printf("\n POINTS:");
glColor3f(1.0f,0.0f,1.0f);
glVertex3f(fScreenX,fScreenY,fScreenZ);
glColor3f(0.0f,0.0f,1.0f);
printf("\nScreen inside pixel x,y,z %f %f
%f",fScreenX,fScreenY,fScreenZ);
25
glEnd();
glFlush();
}
}
}
}
glFlush();
}
void SetParams()
{
int i;
x=0; y=0; z=0;
for (i=0;i<30;i++){
float random=rand()%25;
26
float r=random-12.0;
//printf("\nrandom%f and %f",random,r);
a[i]=(((random)-12.0 ))/(10.0);
//printf("\nfractal%f",a[i]);
}
}
void TestSoln()
{
if (n==iMaxBound )
n=0;
// printf("\t X,Y,Z %d %d %d %d",x,y,z,fMaxSolution);
if (( x*x+y*y+z*z )>fMaxSolution){
if (n>100)
{
printf("\t\tFRAINMAX");
27
n=iMaxBound;
}
else
n=0;
}
}
void callm()
{
int ch=10000;
/*iSizeX =100; iSizeY =100; iSizeZ=100;
fDimX=8.0; fDimY =8.0; fDimZ=8.0;
fScaleX=-4.0; fScaleY=4.0; fScaleZ=4.0;
n=0; iKernelColor=6; iMaxBound=1000; fMaxSolution=1000000.0;*/
do
{
28
if (n==0)
SetParams();
AdvanceXY();
// GeneratePoints();
printf("\t%d",n);
TestSoln();
if (n==iMaxBound)
{
printf("INSIDE LOOP");
GeneratePoints();
n=0;
}
// printf("%d",ch);
ch--;
}while(ch>=0);
29
}
void mydisplay()
{
glClear(GL_COLOR_BUFFER_BIT);
callm();
glColor3f(2.0f,0.0f,2.0f);
glBegin(GL_POINTS);
printf("\nPOINTS");
glVertex3f(0.5,-0.7,-1.7);
// glVertex3f(50.0f,50.0f,50.0f);
glEnd();
glFlush();
}
/*void mydisplay(int button,int state,int x,int y)
{
30
callm();
glColor3f(1.0f,1.0f,0.0f);
glBegin(GL_POINTS);
glVertex3f(0.5,0.5,0.5);
glVertex3f(50.0,50.0,50.0);
// printf("%f %f %f",fScreenX,fScreenY,fScreenZ);
glEnd();
glFlush();
}
}*/
void init()
{
31
glClearColor(0.0,0.0,0.0,0.0);
glColor3f(0.0,1.0,0.0);
//callm();
}
void reshape (int w, int h)
{
glViewport (0,0,(GLsizei)w,(GLsizei)h);
// glViewport(200,200,100,100);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-4.25, 4.25, -5.0, 5.0, 2.5, 25.0);
glMatrixMode (GL_MODELVIEW);
}
int main(int argc,char **argv)
{
32
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(400,400);
glutInitWindowPosition(100,100);
glutCreateWindow("3d fractals");
init();
printf("3dFRACTALS");
glutDisplayFunc(mydisplay);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}
33
34
CONCLUTION:
Thus Generation of volumetric escape time fractals has been
implemented General quadratic mappings, when extended to the third
dimension, produce a wide range of visually striking objects. From our
observations, the most visually interesting forms are relatively smooth and have
balanced (symmetrical) shapes.
35