fixed minor mistake in main function when calling koch curve, not it should make correct snowflake
This commit is contained in:
parent
b317b6137b
commit
dedaabbd24
@ -16,7 +16,7 @@ void koch(int x1,int y1,int x2,int y2,int it)
|
|||||||
int y3 = (2*y1 + y2)/3;
|
int y3 = (2*y1 + y2)/3;
|
||||||
int x4 = (2*x2 + x1)/3;
|
int x4 = (2*x2 + x1)/3;
|
||||||
int y4 = (2*y2 + y1)/3;
|
int y4 = (2*y2 + y1)/3;
|
||||||
int x = x3+ (x4-x3)*cos(angle) + (y4-y3)*sin(angle);
|
int x = x3 + (x4-x3)*cos(angle) + (y4-y3)*sin(angle);
|
||||||
int y = y3 - (x4-x3)*sin(angle) + (y4-y3)*cos(angle);
|
int y = y3 - (x4-x3)*sin(angle) + (y4-y3)*cos(angle);
|
||||||
if(it>0)
|
if(it>0)
|
||||||
{
|
{
|
||||||
@ -51,8 +51,8 @@ int main()
|
|||||||
cout<<"Enter order of curve: ";
|
cout<<"Enter order of curve: ";
|
||||||
cin>>order;
|
cin>>order;
|
||||||
int x3 = x1 + (x2-x1)*cos(angle) + (y2-y1)*sin(angle);
|
int x3 = x1 + (x2-x1)*cos(angle) + (y2-y1)*sin(angle);
|
||||||
int y3 = y1 - (x2-x1)*sin(angle) + (y2-y1)*cos(angle);
|
int y3 = y1 - (x2-x1)*sin(angle) + (y2-y1)*cos(angle);
|
||||||
koch(x1,y1,x2,y2,order);
|
koch(x2,y2,x1,y1,order);
|
||||||
koch(x1,y1,x3,y3,order);
|
koch(x1,y1,x3,y3,order);
|
||||||
koch(x3,y3,x2,y2,order);
|
koch(x3,y3,x2,y2,order);
|
||||||
delay(10000);
|
delay(10000);
|
||||||
|
Loading…
Reference in New Issue
Block a user