Skip to content

Commit b111464

Browse files
authored
Add files via upload
1 parent 5d89b83 commit b111464

File tree

6 files changed

+360
-0
lines changed

6 files changed

+360
-0
lines changed

Koch Curve/Koch2/Koch.cbp

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_project_file>
3+
<FileVersion major="1" minor="6" />
4+
<Project>
5+
<Option title="Koch" />
6+
<Option pch_mode="2" />
7+
<Option compiler="gcc" />
8+
<Build>
9+
<Target title="Debug">
10+
<Option output="bin/Debug/Koch" prefix_auto="1" extension_auto="1" />
11+
<Option working_dir="C:/Program Files (x86)/CodeBlocks/MinGW/bin" />
12+
<Option object_output="obj/Debug/" />
13+
<Option type="1" />
14+
<Option compiler="gcc" />
15+
<Compiler>
16+
<Add option="-g" />
17+
</Compiler>
18+
<Linker>
19+
<Add library="../../../../../Program Files (x86)/CodeBlocks/MinGW/lib/glut32.lib" />
20+
</Linker>
21+
</Target>
22+
<Target title="Release">
23+
<Option output="bin/Release/Koch" prefix_auto="1" extension_auto="1" />
24+
<Option working_dir="C:/Program Files (x86)/CodeBlocks/MinGW/bin" />
25+
<Option object_output="obj/Release/" />
26+
<Option type="0" />
27+
<Option compiler="gcc" />
28+
<Compiler>
29+
<Add option="-O2" />
30+
</Compiler>
31+
<Linker>
32+
<Add option="-s" />
33+
</Linker>
34+
</Target>
35+
</Build>
36+
<Compiler>
37+
<Add option="-Wall" />
38+
<Add directory="C:/Program Files (x86)/CodeBlocks/MinGW/include" />
39+
</Compiler>
40+
<Linker>
41+
<Add library="glut32" />
42+
<Add library="opengl32" />
43+
<Add library="glu32" />
44+
<Add library="winmm" />
45+
<Add library="gdi32" />
46+
<Add directory="C:/Program Files (x86)/CodeBlocks/MinGW/lib" />
47+
</Linker>
48+
<Unit filename="main.cpp" />
49+
<Extensions>
50+
<code_completion />
51+
<envvars />
52+
<debugger />
53+
<lib_finder disable_auto="1" />
54+
</Extensions>
55+
</Project>
56+
</CodeBlocks_project_file>

Koch Curve/Koch2/Koch.depend

+221
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
# depslib dependency file v1.0
2+
1551779660 source:c:\users\morol\documents\opengl\koch\main.cpp
3+
<bits/stdc++.h>
4+
<windows.h>
5+
<GL/glut.h>
6+
7+
1301111162 c:\program files (x86)\codeblocks\mingw\include\windows.h
8+
<winresrc.h>
9+
<stdarg.h>
10+
<windef.h>
11+
<wincon.h>
12+
<winbase.h>
13+
<wingdi.h>
14+
<winuser.h>
15+
<winnls.h>
16+
<winver.h>
17+
<winnetwk.h>
18+
<winreg.h>
19+
<winsvc.h>
20+
<cderr.h>
21+
<dde.h>
22+
<ddeml.h>
23+
<dlgs.h>
24+
<imm.h>
25+
<lzexpand.h>
26+
<mmsystem.h>
27+
<nb30.h>
28+
<rpc.h>
29+
<shellapi.h>
30+
<winperf.h>
31+
<commdlg.h>
32+
<winspool.h>
33+
<winsock2.h>
34+
<winsock.h>
35+
<ole2.h>
36+
37+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winresrc.h
38+
<winuser.h>
39+
<winnt.h>
40+
<winver.h>
41+
<dde.h>
42+
<dlgs.h>
43+
<commctrl.h>
44+
45+
1301111164 c:\program files (x86)\codeblocks\mingw\include\winuser.h
46+
47+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winnt.h
48+
<winerror.h>
49+
<string.h>
50+
<basetsd.h>
51+
<pshpack4.h>
52+
<poppack.h>
53+
54+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winerror.h
55+
56+
1341006776 c:\program files (x86)\codeblocks\mingw\include\string.h
57+
<_mingw.h>
58+
<stddef.h>
59+
60+
1341006770 c:\program files (x86)\codeblocks\mingw\include\_mingw.h
61+
62+
1301111148 c:\program files (x86)\codeblocks\mingw\include\basetsd.h
63+
64+
1301111156 c:\program files (x86)\codeblocks\mingw\include\pshpack4.h
65+
66+
1301111156 c:\program files (x86)\codeblocks\mingw\include\poppack.h
67+
68+
1301111164 c:\program files (x86)\codeblocks\mingw\include\winver.h
69+
70+
1301111148 c:\program files (x86)\codeblocks\mingw\include\dde.h
71+
72+
1301111150 c:\program files (x86)\codeblocks\mingw\include\dlgs.h
73+
74+
1301111148 c:\program files (x86)\codeblocks\mingw\include\commctrl.h
75+
<prsht.h>
76+
77+
1301111156 c:\program files (x86)\codeblocks\mingw\include\prsht.h
78+
79+
1301111162 c:\program files (x86)\codeblocks\mingw\include\windef.h
80+
<winnt.h>
81+
82+
1301111162 c:\program files (x86)\codeblocks\mingw\include\wincon.h
83+
84+
1301111160 c:\program files (x86)\codeblocks\mingw\include\winbase.h
85+
86+
1301111162 c:\program files (x86)\codeblocks\mingw\include\wingdi.h
87+
88+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winnls.h
89+
90+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winnetwk.h
91+
92+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winreg.h
93+
94+
1301111164 c:\program files (x86)\codeblocks\mingw\include\winsvc.h
95+
96+
1301111148 c:\program files (x86)\codeblocks\mingw\include\cderr.h
97+
98+
1301111148 c:\program files (x86)\codeblocks\mingw\include\ddeml.h
99+
100+
1301111150 c:\program files (x86)\codeblocks\mingw\include\imm.h
101+
102+
1301111154 c:\program files (x86)\codeblocks\mingw\include\lzexpand.h
103+
104+
1301111154 c:\program files (x86)\codeblocks\mingw\include\mmsystem.h
105+
106+
1301111154 c:\program files (x86)\codeblocks\mingw\include\nb30.h
107+
108+
1301111158 c:\program files (x86)\codeblocks\mingw\include\rpc.h
109+
<windows.h>
110+
<rpcdce.h>
111+
<rpcnsi.h>
112+
<rpcnterr.h>
113+
<winerror.h>
114+
<excpt.h>
115+
116+
1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcdce.h
117+
<basetyps.h>
118+
<rpcdcep.h>
119+
120+
1301111148 c:\program files (x86)\codeblocks\mingw\include\basetyps.h
121+
122+
1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcdcep.h
123+
124+
1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcnsi.h
125+
126+
1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcnterr.h
127+
128+
1341006772 c:\program files (x86)\codeblocks\mingw\include\excpt.h
129+
<_mingw.h>
130+
<windef.h>
131+
132+
1301111160 c:\program files (x86)\codeblocks\mingw\include\shellapi.h
133+
<pshpack2.h>
134+
<poppack.h>
135+
136+
1301111156 c:\program files (x86)\codeblocks\mingw\include\pshpack2.h
137+
138+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winperf.h
139+
140+
1301111148 c:\program files (x86)\codeblocks\mingw\include\commdlg.h
141+
<unknwn.h>
142+
<prsht.h>
143+
144+
1301111160 c:\program files (x86)\codeblocks\mingw\include\unknwn.h
145+
<windows.h>
146+
<objfwd.h>
147+
<wtypes.h>
148+
149+
1301111156 c:\program files (x86)\codeblocks\mingw\include\objfwd.h
150+
<basetyps.h>
151+
152+
1301111164 c:\program files (x86)\codeblocks\mingw\include\wtypes.h
153+
<rpc.h>
154+
<rpcndr.h>
155+
156+
1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcndr.h
157+
<rpcnsip.h>
158+
<objfwd.h>
159+
160+
1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcnsip.h
161+
162+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winspool.h
163+
164+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winsock2.h
165+
<windows.h>
166+
167+
1301111162 c:\program files (x86)\codeblocks\mingw\include\winsock.h
168+
<windows.h>
169+
<mswsock.h>
170+
171+
1301111154 c:\program files (x86)\codeblocks\mingw\include\mswsock.h
172+
173+
1301111156 c:\program files (x86)\codeblocks\mingw\include\ole2.h
174+
<winerror.h>
175+
<objbase.h>
176+
<olectlid.h>
177+
<oleauto.h>
178+
<oleidl.h>
179+
180+
1301111154 c:\program files (x86)\codeblocks\mingw\include\objbase.h
181+
<rpc.h>
182+
<rpcndr.h>
183+
<stdlib.h>
184+
<basetyps.h>
185+
<wtypes.h>
186+
<unknwn.h>
187+
<objidl.h>
188+
<cguid.h>
189+
190+
1341006776 c:\program files (x86)\codeblocks\mingw\include\stdlib.h
191+
<_mingw.h>
192+
<stddef.h>
193+
194+
1301111156 c:\program files (x86)\codeblocks\mingw\include\objidl.h
195+
<objfwd.h>
196+
197+
1301111148 c:\program files (x86)\codeblocks\mingw\include\cguid.h
198+
199+
1301111156 c:\program files (x86)\codeblocks\mingw\include\olectlid.h
200+
201+
1301111156 c:\program files (x86)\codeblocks\mingw\include\oleauto.h
202+
<oaidl.h>
203+
204+
1301111154 c:\program files (x86)\codeblocks\mingw\include\oaidl.h
205+
<windows.h>
206+
<ole2.h>
207+
208+
1301111156 c:\program files (x86)\codeblocks\mingw\include\oleidl.h
209+
<objfwd.h>
210+
211+
976645372 c:\program files (x86)\codeblocks\mingw\include\gl\glut.h
212+
<windows.h>
213+
<GL/gl.h>
214+
<GL/glu.h>
215+
216+
1301111164 c:\program files (x86)\codeblocks\mingw\include\gl\gl.h
217+
218+
1301111164 c:\program files (x86)\codeblocks\mingw\include\gl\glu.h
219+
<stddef.h>
220+
<GL/gl.h>
221+

Koch Curve/Koch2/Koch.layout

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_layout_file>
3+
<FileVersion major="1" minor="0" />
4+
<ActiveTarget name="Debug" />
5+
<File name="main.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
6+
<Cursor>
7+
<Cursor1 position="576" topLine="20" />
8+
</Cursor>
9+
</File>
10+
</CodeBlocks_layout_file>

Koch Curve/Koch2/bin/Debug/Koch.exe

1.02 MB
Binary file not shown.

Koch Curve/Koch2/main.cpp

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#include <bits/stdc++.h>
2+
#include <windows.h>
3+
#include <GL/glut.h>
4+
using namespace std;
5+
int n;
6+
double xx, yy, lngth, aalpha;
7+
8+
9+
void line(double x1, double y1, double x2, double y2){
10+
glBegin(GL_LINES);
11+
glVertex2f(x1, y1);
12+
glVertex2f(x2, y2);
13+
glEnd();
14+
glFlush();
15+
}
16+
double radian(double degree){
17+
return acos(-1)*degree/180.0;
18+
}
19+
double cosine(double alpha){
20+
return cos(radian(alpha));
21+
}
22+
double sine(double alpha){
23+
return sin(radian(alpha));
24+
}
25+
void Koch_Curve(double x, double y, double len, double alpha, int n){
26+
if(n>0){
27+
len=len/3.0;
28+
Koch_Curve(x, y, len, alpha, n-1);
29+
x=x+len*cosine(alpha); y=y+len*sine(alpha);
30+
Koch_Curve(x, y, len, alpha-60, n-1);
31+
x=x+len*cosine(alpha-60); y=y+len*sine(alpha-60);
32+
Koch_Curve(x, y, len, alpha+60, n-1);
33+
x=x+len*cosine(alpha+60); y=y+len*sine(alpha+60);
34+
Koch_Curve(x, y, len, alpha, n-1);
35+
}
36+
else line(x, y, x+len*cosine(alpha), y+len*sine(alpha));
37+
}
38+
39+
void display(void){
40+
//glClearColor(0, 0.0, 0.0, 0);
41+
glClear(GL_COLOR_BUFFER_BIT);
42+
Koch_Curve(xx, yy, lngth, aalpha, n);
43+
}
44+
void init(void){
45+
glClear(GL_COLOR_BUFFER_BIT);
46+
glClearColor(0.0, 1.0, 1.0, 0.0);
47+
glColor3f(1.0f,0.0f,0.0f);
48+
//glPointSize(2.0);
49+
glMatrixMode(GL_PROJECTION);
50+
glLoadIdentity();
51+
gluOrtho2D(0.0,800.0,0.0,600.0);
52+
}
53+
int main(int argc, char** argv)
54+
{
55+
cout<<"Enter Co-ordinate of (x,y): ";
56+
cin>>xx>>yy;
57+
cout<<"\nEnter Length: ";
58+
cin>>lngth;
59+
cout<<"\nEnter Degree of Angle: ";
60+
cin>>aalpha;
61+
cout<<"\nEnter No. of Iteration: ";
62+
cin>>n;
63+
glutInit(&argc, argv);
64+
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
65+
glutInitWindowSize(800, 600);
66+
glutInitWindowPosition(100, 50);
67+
glutCreateWindow("Koch Curve");
68+
init();
69+
glutDisplayFunc(display);
70+
glutMainLoop();
71+
72+
return 0;
73+
}

Koch Curve/Koch2/obj/Debug/main.o

21.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)