No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
[code] #include <conio.h> #include <graphics.h> #include <math.h> #include <stdlib.h> #include <dos.h> void serp(int level, int Ax, int Ay, int Bx, int By) { int poly[4]={Ax,Ay,Bx,By}; setfillstyle(SOLID_FILL,YELLOW); if (level>0) { serp(level-1, Ax,Ay ,(2*Ax+Bx)/3,(2*Ay+By)/3); serp(level-1,(2*Ax+Bx)/3,(2*Ay+By)/3,(Ax+Bx)/2+sqrt(3)*(Ay-By)/6,(Ay+By)/2+sqrt(3)*(Bx-Ax)/6); serp(level-1,(Ax+Bx)/2+sqrt(3)*(Ay-By)/6,(Ay+By)/2+sqrt(3)*(Bx-Ax)/6,(Ax+2*Bx)/3,(Ay+2*By)/3); serp(level-1,(Ax+2*Bx)/3,(Ay+2*By)/3,Bx,By); } else fillpoly(2,poly); } int main(void) { int graphdriver=DETECT, graphmode; initgraph(&graphdriver, &graphmode, ""); int i, … |
|
[code] #include <conio.h> #include <graphics.h> #include <math.h> #include <stdlib.h> #include <dos.h> void serp(int level, int Ax, int Ay, int Bx, int By) { int poly[4]={Ax,Ay,Bx,By}; [COLOR="red"]setfillstyle(SOLID_FILL,YELLOW);[/COLOR] not working the way i want. if (level>0) { serp(level-1, Ax,Ay ,(2*Ax+Bx)/3,(2*Ay+By)/3); serp(level-1,(2*Ax+Bx)/3,(2*Ay+By)/3,(Ax+Bx)/2+sqrt(3)*(Ay-By)/6,(Ay+By)/2+sqrt(3)*(Bx-Ax)/6); serp(level-1,(Ax+Bx)/2+sqrt(3)*(Ay-By)/6,(Ay+By)/2+sqrt(3)*(Bx-Ax)/6,(Ax+2*Bx)/3,(Ay+2*By)/3); serp(level-1,(Ax+2*Bx)/3,(Ay+2*By)/3,Bx,By); } else fillpoly(2,poly); } int main(void) { int graphdriver=DETECT, … |