/*
* main.cpp
*
* Created on: 2009年9月26日
* Author: hkng
*/
#include<iostream>
using namespace std;
#include "svg2.h"
void p_1 (int x, int y, double r, double c_1, double c_2, double c_3, double c_4, char color[] )
{
svgout << "circle" << x << y << r*c_1 << 0 << "none" << color;
svgout << "circle" << x << y << r*c_2 << 0 << "none white";
svgout << "circle" << x << y << r*c_3 << 0 << "none" << color;
svgout << "circle" << x << y << r*c_4 << 0 << "none white";
}
void p_2 (int x, int y, int r, int num_of_circle, char color[])
{
int x_1[num_of_circle];
int y_1[num_of_circle];
int r_1[num_of_circle];
svgout << "circle" << x << y << r << 2 << "none" << color;
int temp=--num_of_circle;
while (temp>=0)
{
x_1 [temp] = x+100+rand()%150;
y_1 [temp] = y-50+rand()%100;
r_1 [temp] = rand()%(r/2)+r/2;
temp--;
}
for (int temp=num_of_circle;temp>=0;temp--)
{
svgout << "circle" << x_1[temp] << y_1[temp] << r_1[temp] << 2 << "none" << color;
}
for (int temp=num_of_circle;temp>=0;temp--)
{
svgout << "circle" << x_1[temp] << y_1[temp] << r_1[temp]*0.6 << 2 << "none" << "white";
}
for (int temp=num_of_circle;temp>=0;temp--)
{
svgout << "circle" << x_1[temp] << y_1[temp] << r_1[temp]*0.4 << 2 << "none" << color;
}
}
int main ()
{
//Circle patterns and designs(1)
p_1(100,100,20,1,0.75,0.5,0.25,"blue");
srand(435);
int a,b,i;
a=b=i=0;
while (i<=12)
{
p_1(200+a*30+rand()%10,50+b*30+rand()%10,10+rand()%20,1,0.75,0.5,0.25,"blue");
if (a==3)
{
a=0;b++;
}
else
a++;
i++;
}
//Circle patterns and designs(2)
p_1(100,300,20,1,0.95,0.7,0.25,"green");
i=0;
while (i<=1024)
{
p_1(200+rand()%150,250+rand()%100,rand()%20,1,0.95,0.7,0.25,"green");
i++;
}
//Circle patterns and designs(3)
srand (99);
p_2(100,500,20,1024,"red");
return 0;
}
相信還有人在看這BLOG吧....
這是大約在下個Comp Lab要寫ga 野,
有讀C++能力的人可以試試compile and run上面ga programme睇.
當然,上面缺了svg2.h,正常都不明白我係度做咩......
活在一堆Code的日子跟自閉有何分別?
最近一直係UST 摺埋一角,
但又唔係努力温書,又唔係努力識朋友,更唔係努力溝女,
只係隨時隨地等待假期,
但在假期時我卻等待返學的日子.....
其實,我正等待的,是尚未出現,還是已經失去了?
我都唔清楚啦.
係notebook打速成真的好辛苦,
下次再打吧.
Chatboard (0)