fixed minor mistake in main function when calling koch curve, not it should make correct snowflake

This commit is contained in:
K 2023-12-14 15:33:35 +05:30
parent b317b6137b
commit dedaabbd24
Signed by: notkshitij
GPG Key ID: C5B8BC7530F8F43F

View File

@ -16,7 +16,7 @@ void koch(int x1,int y1,int x2,int y2,int it)
int y3 = (2*y1 + y2)/3;
int x4 = (2*x2 + x1)/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);
if(it>0)
{
@ -51,8 +51,8 @@ int main()
cout<<"Enter order of curve: ";
cin>>order;
int x3 = x1 + (x2-x1)*cos(angle) + (y2-y1)*sin(angle);
int y3 = y1 - (x2-x1)*sin(angle) + (y2-y1)*cos(angle);
koch(x1,y1,x2,y2,order);
int y3 = y1 - (x2-x1)*sin(angle) + (y2-y1)*cos(angle);
koch(x2,y2,x1,y1,order);
koch(x1,y1,x3,y3,order);
koch(x3,y3,x2,y2,order);
delay(10000);