From aacc607621cf3accb897b9e4ddd9694ac25ce0a6 Mon Sep 17 00:00:00 2001 From: penguintyler Date: Tue, 8 Dec 2015 14:20:15 -0500 Subject: [PATCH 1/9] Math Function This is a function used to solve the Pythagorean Theorem. --- Pythagorean_Theorem/Pythagorean_Theorem.pde | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Pythagorean_Theorem/Pythagorean_Theorem.pde diff --git a/Pythagorean_Theorem/Pythagorean_Theorem.pde b/Pythagorean_Theorem/Pythagorean_Theorem.pde new file mode 100644 index 0000000..a03bbf2 --- /dev/null +++ b/Pythagorean_Theorem/Pythagorean_Theorem.pde @@ -0,0 +1,14 @@ +void setup() { + size(600, 600); //setup for size and background color + background(0); +} + +void draw() { + PythagoreanTheorem(25, 16, 0); //function is put into void draw +} + +void PythagoreanTheorem(float a, float b, float c) { //name of function is PythagoreanTheorem and requires 3 variables to solve the equation (a,b,c) + c = sqrt(a*a + b*b); //this is the equation that will solve for c + textSize(50); //textSize and text displays the answer + text(c, 200, 300); +} \ No newline at end of file From 9876ee5cca8450ec1d9262ca8f87431c5321dd2d Mon Sep 17 00:00:00 2001 From: penguintyler Date: Tue, 8 Dec 2015 14:28:56 -0500 Subject: [PATCH 2/9] Physics Function Start --- Physics_Function/Physics_Function.pde | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Physics_Function/Physics_Function.pde diff --git a/Physics_Function/Physics_Function.pde b/Physics_Function/Physics_Function.pde new file mode 100644 index 0000000..fb77751 --- /dev/null +++ b/Physics_Function/Physics_Function.pde @@ -0,0 +1,11 @@ +void setup(){ + + +} + +void draw(){ + + +} + +void floatingball(){ \ No newline at end of file From a220af48394771b6f4f4f35b634437267a4f2748 Mon Sep 17 00:00:00 2001 From: penguintyler Date: Tue, 8 Dec 2015 14:34:27 -0500 Subject: [PATCH 3/9] Visual Function --- Visual_Function/Visual_Function.pde | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Visual_Function/Visual_Function.pde diff --git a/Visual_Function/Visual_Function.pde b/Visual_Function/Visual_Function.pde new file mode 100644 index 0000000..8c7eabd --- /dev/null +++ b/Visual_Function/Visual_Function.pde @@ -0,0 +1,22 @@ +float x; +float y; +float vx; +float vy; +void setup() { + background(0); + size(800, 600); + x=0; + y=200; + vx=10; + vy=10; +} + +void draw() { + Pretzel(50,50); +} + + +void Pretzel(float a,float b) { + ellipse(x,y,a,b); + +} \ No newline at end of file From 2022c273281378cbdaf894be7faca9b0f552670b Mon Sep 17 00:00:00 2001 From: penguintyler Date: Tue, 8 Dec 2015 14:36:01 -0500 Subject: [PATCH 4/9] Visual Function --- Visual_Function/Visual_Function.pde | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Visual_Function/Visual_Function.pde b/Visual_Function/Visual_Function.pde index 8c7eabd..5d525cc 100644 --- a/Visual_Function/Visual_Function.pde +++ b/Visual_Function/Visual_Function.pde @@ -18,5 +18,13 @@ void draw() { void Pretzel(float a,float b) { ellipse(x,y,a,b); + x=x+vx; + y=y+vy; + if (y>=height) { + vy=-vy; + fill(random(255), random(255), random(255)); + } + + } \ No newline at end of file From efc0c49cc7f358513c7867b7354a0fd1e0155c3b Mon Sep 17 00:00:00 2001 From: penguintyler Date: Tue, 8 Dec 2015 14:38:07 -0500 Subject: [PATCH 5/9] Visual Function This function will creating a moving drawing similar to the shape of a pretzel. --- Visual_Function/Visual_Function.pde | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Visual_Function/Visual_Function.pde b/Visual_Function/Visual_Function.pde index 5d525cc..f1379a1 100644 --- a/Visual_Function/Visual_Function.pde +++ b/Visual_Function/Visual_Function.pde @@ -24,7 +24,18 @@ void Pretzel(float a,float b) { vy=-vy; fill(random(255), random(255), random(255)); } - + if (x>=width) { + vx=-vx; + fill(random(255), random(255), random(255)); + } + if (y<=0) { + vy=-vy; + fill(random(255), random(255), random(255)); + } + if (x<=0) { + vx=-vx; + fill(random(255), random(255), random(255)); + } } \ No newline at end of file From 39f2fad7d7fa73512d545fd2185b9b98d3e85f9f Mon Sep 17 00:00:00 2001 From: penguintyler Date: Tue, 8 Dec 2015 14:40:18 -0500 Subject: [PATCH 6/9] Visual Function Added noStroke --- Visual_Function/Visual_Function.pde | 1 + 1 file changed, 1 insertion(+) diff --git a/Visual_Function/Visual_Function.pde b/Visual_Function/Visual_Function.pde index f1379a1..d05056b 100644 --- a/Visual_Function/Visual_Function.pde +++ b/Visual_Function/Visual_Function.pde @@ -17,6 +17,7 @@ void draw() { void Pretzel(float a,float b) { + noStroke(); ellipse(x,y,a,b); x=x+vx; y=y+vy; From dc899d8e0bbfbbc51d5336cd8afdc3c2b4f782e3 Mon Sep 17 00:00:00 2001 From: penguintyler Date: Tue, 8 Dec 2015 14:46:28 -0500 Subject: [PATCH 7/9] Visual Functions Final Commented. --- Visual_Function/Visual_Function.pde | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Visual_Function/Visual_Function.pde b/Visual_Function/Visual_Function.pde index d05056b..b7f6a18 100644 --- a/Visual_Function/Visual_Function.pde +++ b/Visual_Function/Visual_Function.pde @@ -1,27 +1,27 @@ -float x; +float x; // delcares variables for location and velocity float y; float vx; float vy; void setup() { - background(0); + background(0); //setup for background color and size size(800, 600); - x=0; + x=0; //gives the variables a value y=200; vx=10; vy=10; } void draw() { - Pretzel(50,50); + Pretzel(50,50); //the function is put here. variables can be used to change size of the ellipse } void Pretzel(float a,float b) { - noStroke(); + noStroke(); //setup for ellipse ellipse(x,y,a,b); - x=x+vx; + x=x+vx; //setup for velocity y=y+vy; - if (y>=height) { + if (y>=height) { //the changes in velocity make the ellipse travel in the shape of a pretzel vy=-vy; fill(random(255), random(255), random(255)); } From 4e8522ef2761d397b6412375822c456aba4edd14 Mon Sep 17 00:00:00 2001 From: penguintyler Date: Wed, 9 Dec 2015 14:32:02 -0500 Subject: [PATCH 8/9] Physics Function This function is used to determine mass with a given weight in kilograms. --- Physics_Function/Physics_Function.pde | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Physics_Function/Physics_Function.pde b/Physics_Function/Physics_Function.pde index fb77751..248ac54 100644 --- a/Physics_Function/Physics_Function.pde +++ b/Physics_Function/Physics_Function.pde @@ -1,11 +1,19 @@ -void setup(){ - - +float m; //declare variables for mass and acceleration, acceleration equals 9.81 m/s^2 on Earth +float a = 9.81; +void setup() { + background(0); //setup size and background + size(600, 600); } -void draw(){ - - +void draw() { + Mass(0); //insert function and weight in parentheses (in kilograms) } -void floatingball(){ \ No newline at end of file + + + +void Mass(float w) { //function is called Mass + m = w/a; // equation for mass is weight divided by acceleration + textSize(50); //setup for text size and location + text(m + " kg", 150, 300); +} \ No newline at end of file From a8e9368886f027b8c4409ef83acb8f7e85d273cd Mon Sep 17 00:00:00 2001 From: penguintyler Date: Mon, 14 Dec 2015 11:13:29 -0500 Subject: [PATCH 9/9] Documentations --- Documentation1.md | 19 ------------------- Documentation2.md | 19 ------------------- Documentation3.md | 19 ------------------- Mass.md | 18 ++++++++++++++++++ Pretzel.md | 19 +++++++++++++++++++ PythagoreanTheorem.md | 21 +++++++++++++++++++++ 6 files changed, 58 insertions(+), 57 deletions(-) delete mode 100644 Documentation1.md delete mode 100644 Documentation2.md delete mode 100644 Documentation3.md create mode 100644 Mass.md create mode 100644 Pretzel.md create mode 100644 PythagoreanTheorem.md diff --git a/Documentation1.md b/Documentation1.md deleted file mode 100644 index 28f94fa..0000000 --- a/Documentation1.md +++ /dev/null @@ -1,19 +0,0 @@ -# Name: - -## Examples: -Insert examples here. - -## Description: -Insert description here - -## Syntax: -Demonstrate syntax here - -##Parameters: -Name and describe parameters here - -##Returns: -What type of data does it return? - -##Other notes: -Anything else? diff --git a/Documentation2.md b/Documentation2.md deleted file mode 100644 index 28f94fa..0000000 --- a/Documentation2.md +++ /dev/null @@ -1,19 +0,0 @@ -# Name: - -## Examples: -Insert examples here. - -## Description: -Insert description here - -## Syntax: -Demonstrate syntax here - -##Parameters: -Name and describe parameters here - -##Returns: -What type of data does it return? - -##Other notes: -Anything else? diff --git a/Documentation3.md b/Documentation3.md deleted file mode 100644 index 28f94fa..0000000 --- a/Documentation3.md +++ /dev/null @@ -1,19 +0,0 @@ -# Name: - -## Examples: -Insert examples here. - -## Description: -Insert description here - -## Syntax: -Demonstrate syntax here - -##Parameters: -Name and describe parameters here - -##Returns: -What type of data does it return? - -##Other notes: -Anything else? diff --git a/Mass.md b/Mass.md new file mode 100644 index 0000000..7ef3b0c --- /dev/null +++ b/Mass.md @@ -0,0 +1,18 @@ +# Name: +Mass() + +## Examples: +Mass(20); +Mass(110); + +## Description: +This function converts weight to mass in kilograms. + +## Syntax: +Mass(w) + +##Parameters: +w float: the weight the user wishes to convert + +##Returns: +none diff --git a/Pretzel.md b/Pretzel.md new file mode 100644 index 0000000..bdcacbb --- /dev/null +++ b/Pretzel.md @@ -0,0 +1,19 @@ +# Name: +Pretzel() + +## Examples: +Preztel(75,60); +Pretzel(20,20); + +## Description: +An ellipse creates the shape of a pretzel. + +## Syntax: +Pretzel(width,height); + +##Parameters: +width float: makes preztel wider +height float: makes pretzel taller + +##Returns: +none diff --git a/PythagoreanTheorem.md b/PythagoreanTheorem.md new file mode 100644 index 0000000..08b29d6 --- /dev/null +++ b/PythagoreanTheorem.md @@ -0,0 +1,21 @@ +# Name: +PythagoreanTheorem() + +## Examples: +PythagoreanTheorem(12,4,0); +PythagoreanTheorem(40,18,0); + +## Description: +The function solves for c in the equation a^2+b^2=c^2. + +## Syntax: +PythagoreanTheorem(a,b,c); + +##Parameters: +a float: side a +b float: side b +c float: side c, must be zero + + +##Returns: +none