From 5d60921a275fa93a0dc54922b749adb0430f3fd5 Mon Sep 17 00:00:00 2001 From: Keyron Linarez Date: Mon, 6 Nov 2023 15:23:57 -0800 Subject: [PATCH 1/6] dst file for my computer --- demo/demo.dst | Bin 0 -> 2525 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 demo/demo.dst diff --git a/demo/demo.dst b/demo/demo.dst new file mode 100644 index 0000000000000000000000000000000000000000..9a02aaac9d01c8cc70b977bfd72b476cd2b8ade8 GIT binary patch literal 2525 zcmeZqvnythB&@R|=$j6bxtxFfcR+Ffa!!U|tYNTXG?d&8M~d zA?DM;7Yi7exqyh3nbnK7q$`chr?vYb=8yV<$Z%$5USc!80^%EippN?Wpv#^%%7{Sfm Date: Mon, 6 Nov 2023 16:13:28 -0800 Subject: [PATCH 2/6] edited demo file --- demo/demo.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/demo/demo.cpp b/demo/demo.cpp index eca9fc1..a636fc5 100644 --- a/demo/demo.cpp +++ b/demo/demo.cpp @@ -9,13 +9,13 @@ using namespace std; void rect(Turtle& t, float width, float height) { t.forward(width); - t.right(90); - t.forward(height); - t.right(90); - t.forward(width); - t.right(90); - t.forward(height); - t.right(90); + // t.right(90); + // t.forward(height); + // t.right(90); + // t.forward(width); + // t.right(90); + // t.forward(height); + // t.right(90); } From c168ea5544c5d57e5e32b513d256df639ec4d379 Mon Sep 17 00:00:00 2001 From: Keyron Linarez Date: Mon, 6 Nov 2023 16:19:53 -0800 Subject: [PATCH 3/6] New dst file --- demo/demo.dst | Bin 2525 -> 923 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/demo/demo.dst b/demo/demo.dst index 9a02aaac9d01c8cc70b977bfd72b476cd2b8ade8..4306b106d8c9bd1bbd03d8310f3cef521acf2933 100644 GIT binary patch delta 62 zcmcaBJez%jw2q;%8LzXym4bpHuXY5GGBPmW)devW6byK^BS8#9pa__;(cO=kje+6w HLIwr^sq+m2 literal 2525 zcmeZqvnythB&@R|=$j6bxtxFfcR+Ffa!!U|tYNTXG?d&8M~d zA?DM;7Yi7exqyh3nbnK7q$`chr?vYb=8yV<$Z%$5USc!80^%EippN?Wpv#^%%7{Sfm Date: Thu, 9 Nov 2023 23:17:57 -0800 Subject: [PATCH 4/6] Added a polygon function. --- demo/demo.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/demo/demo.cpp b/demo/demo.cpp index a636fc5..de5e34b 100644 --- a/demo/demo.cpp +++ b/demo/demo.cpp @@ -9,13 +9,26 @@ using namespace std; void rect(Turtle& t, float width, float height) { t.forward(width); - // t.right(90); - // t.forward(height); - // t.right(90); - // t.forward(width); - // t.right(90); - // t.forward(height); - // t.right(90); + t.right(90); + t.forward(height); + t.right(90); + t.forward(width); + t.right(90); + t.forward(height); + t.right(90); +} + +void poly(Turtle& t, float size, int sides) { + + if (sides < 3){ + std::cout << "Polygon must be at least 3 sides"; + } else{ + for (int x = 0; x < sides; ++x){ + t.forward(size); + degree = 360.0 / sides; + t.left(degree); + } + } } @@ -23,7 +36,8 @@ void meetTurtle() { Turtle t; t.satinon(0.3); t.pendown(); - rect(t, 20, 30); + //rect(t, 20, 30); + poly(t, 20, 3); t.end(); t.save("demo.dst"); } From b72b95e28b2c59ecc58e8c413ae076ed3daee802 Mon Sep 17 00:00:00 2001 From: KeyronLinarez Date: Thu, 9 Nov 2023 23:33:35 -0800 Subject: [PATCH 5/6] bug fix --- demo/demo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/demo.cpp b/demo/demo.cpp index de5e34b..eeea98d 100644 --- a/demo/demo.cpp +++ b/demo/demo.cpp @@ -25,7 +25,7 @@ void poly(Turtle& t, float size, int sides) { } else{ for (int x = 0; x < sides; ++x){ t.forward(size); - degree = 360.0 / sides; + float degree = 360.0 / sides; t.left(degree); } } From 6e9eb77a4749386a0aae753f4d658a628c4c054e Mon Sep 17 00:00:00 2001 From: KeyronLinarez Date: Thu, 9 Nov 2023 23:37:56 -0800 Subject: [PATCH 6/6] Added polygon to list of disabled funtions --- demo/demo.cpp | 17 +---------------- src/turtle.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/demo/demo.cpp b/demo/demo.cpp index eeea98d..bf63961 100644 --- a/demo/demo.cpp +++ b/demo/demo.cpp @@ -18,26 +18,11 @@ void rect(Turtle& t, float width, float height) { t.right(90); } -void poly(Turtle& t, float size, int sides) { - - if (sides < 3){ - std::cout << "Polygon must be at least 3 sides"; - } else{ - for (int x = 0; x < sides; ++x){ - t.forward(size); - float degree = 360.0 / sides; - t.left(degree); - } - } -} - - void meetTurtle() { Turtle t; t.satinon(0.3); t.pendown(); - //rect(t, 20, 30); - poly(t, 20, 3); + rect(t, 20, 30); t.end(); t.save("demo.dst"); } diff --git a/src/turtle.cpp b/src/turtle.cpp index 19f87d2..5f09256 100644 --- a/src/turtle.cpp +++ b/src/turtle.cpp @@ -436,6 +436,19 @@ void Turtle::tree(int level) { } } +void polygon(Turtle& t, float size, int sides) { + + if (sides < 3){ + std::cout << "Polygon must be at least 3 sides"; + } else{ + for (int x = 0; x < sides; ++x){ + t.forward(size); + float degree = 360.0 / sides; + t.left(degree); + } + } +} + void Turtle::svtree(float trunklength, int levels, float trunkwidth) { if (trunklength < 1 || levels <= 0) return; bool satin_was_on = satin_is_on_;