From eb2b9b3425d6efeec808283c6593e4237eafb004 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 15:47:28 -0500 Subject: [PATCH 01/17] Create Code --- Code | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Code diff --git a/Code b/Code new file mode 100644 index 0000000..10dc4df --- /dev/null +++ b/Code @@ -0,0 +1,16 @@ +void setup() +{ +} + +void draw() +{ + println(whenXDoesYouWrong(1,9,-10)); +} + +float[] whenXDoesYouWrong(float a, float b, float c) +{ + float[]x = new float[2]; + x[0] = -b + (sqrt(sq(b) - 4*a*c))/2*a; + x[1] = -b - (sqrt(sq(b) - 4*a*c))/2*a; + return x; +} From e909a804cd8b250afa2d4209907fb161481affd0 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 16:03:42 -0500 Subject: [PATCH 02/17] Update Documentation1.md --- Documentation1.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Documentation1.md b/Documentation1.md index 28f94fa..de3acbb 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -1,19 +1,21 @@ -# Name: +# Name: whenXDoesYouWrong ## Examples: -Insert examples here. +whenXDoesYouWrong(1,9,-10) ## Description: -Insert description here +Solves for the negative and positive values of x in the equation x = -b + (sqrt(sq(b) - 4*a*c))/2*a given the values a, b, and c. ## Syntax: -Demonstrate syntax here +whenXDoesYouWrong(a, b, c) ##Parameters: -Name and describe parameters here +a float: the a value in the quadratic formula +b float: the b value in the quadratic formula +c float: the c value in the quadratic formula ##Returns: -What type of data does it return? +Returns float for x[0] (positive value of x) and x[1] (negative value of x) ##Other notes: -Anything else? +The name is a result of my hatred for the quadratic formula. From 9d967cb7f3c1a0269b2fb5bcfd43a08c05c1ccb0 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 16:05:05 -0500 Subject: [PATCH 03/17] Update Documentation1.md --- Documentation1.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation1.md b/Documentation1.md index de3acbb..89d5d8d 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -11,7 +11,9 @@ whenXDoesYouWrong(a, b, c) ##Parameters: a float: the a value in the quadratic formula + b float: the b value in the quadratic formula + c float: the c value in the quadratic formula ##Returns: From 753bda5211dab1089145ad0cd71572a95b1d2528 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 16:05:30 -0500 Subject: [PATCH 04/17] Update Documentation1.md --- Documentation1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation1.md b/Documentation1.md index 89d5d8d..ae3638d 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -17,7 +17,7 @@ b float: the b value in the quadratic formula c float: the c value in the quadratic formula ##Returns: -Returns float for x[0] (positive value of x) and x[1] (negative value of x) +Returns float for x[ 0 ] (positive value of x) and x[ 1 ] (negative value of x) ##Other notes: The name is a result of my hatred for the quadratic formula. From 546b97e3db40b2e78ba61c1d0787906214c50072 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 16:06:05 -0500 Subject: [PATCH 05/17] Update Documentation1.md --- Documentation1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation1.md b/Documentation1.md index ae3638d..6ec67f9 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -17,7 +17,7 @@ b float: the b value in the quadratic formula c float: the c value in the quadratic formula ##Returns: -Returns float for x[ 0 ] (positive value of x) and x[ 1 ] (negative value of x) +Returns float for positive and negative values of x. ##Other notes: The name is a result of my hatred for the quadratic formula. From d86449b70372c14bf09cda574492d30f887bda3d Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 18:39:22 -0500 Subject: [PATCH 06/17] Update Code --- Code | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Code b/Code index 10dc4df..38dd066 100644 --- a/Code +++ b/Code @@ -5,6 +5,9 @@ void setup() void draw() { println(whenXDoesYouWrong(1,9,-10)); + println(springInMyStep(807.7,0.13,'w')); + println(springInMyStep(8.32,600,'x')); + println(springInMyStep(10,3.56,'k')); } float[] whenXDoesYouWrong(float a, float b, float c) @@ -14,3 +17,23 @@ float[] whenXDoesYouWrong(float a, float b, float c) x[1] = -b - (sqrt(sq(b) - 4*a*c))/2*a; return x; } + +//physics function + +float springInMyStep (float a, float b, char isolate) //work in a spring +{ + float result = 0; + if(isolate == 'w') + { + result = 0.5*a*sq(b); + } + if(isolate == 'x') + { + result = sqrt((2*b)/a); + } + if(isolate == 'k') + { + result = (2*b)/sq(a); + } + return result; +} From 4b07e2fb1adc1744f0d43fde087cc4c288fbdf7b Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 18:57:20 -0500 Subject: [PATCH 07/17] Update Code --- Code | 2 -- 1 file changed, 2 deletions(-) diff --git a/Code b/Code index 38dd066..a0dd87c 100644 --- a/Code +++ b/Code @@ -18,8 +18,6 @@ float[] whenXDoesYouWrong(float a, float b, float c) return x; } -//physics function - float springInMyStep (float a, float b, char isolate) //work in a spring { float result = 0; From 664b607eb304ce36d572fb424b502833776c2b8b Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 18:58:28 -0500 Subject: [PATCH 08/17] Update Code --- Code | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code b/Code index a0dd87c..3a33f97 100644 --- a/Code +++ b/Code @@ -18,7 +18,7 @@ float[] whenXDoesYouWrong(float a, float b, float c) return x; } -float springInMyStep (float a, float b, char isolate) //work in a spring +float springInMyStep (float a, float b, char isolate) { float result = 0; if(isolate == 'w') From d9afd251882e867536f22491bcc37f2929ada197 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 19:02:47 -0500 Subject: [PATCH 09/17] Update Documentation1.md --- Documentation1.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation1.md b/Documentation1.md index 6ec67f9..f15b093 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -7,14 +7,14 @@ whenXDoesYouWrong(1,9,-10) Solves for the negative and positive values of x in the equation x = -b + (sqrt(sq(b) - 4*a*c))/2*a given the values a, b, and c. ## Syntax: -whenXDoesYouWrong(a, b, c) +whenXDoesYouWrong(value1, value2, value3) ##Parameters: -a float: the a value in the quadratic formula +value1 float: the a value in the quadratic formula -b float: the b value in the quadratic formula +value2 float: the b value in the quadratic formula -c float: the c value in the quadratic formula +value3 float: the c value in the quadratic formula ##Returns: Returns float for positive and negative values of x. From 47a8cd5211bd0e1e6f271ff2e4969b87e256988f Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 19:03:16 -0500 Subject: [PATCH 10/17] Update Documentation1.md --- Documentation1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation1.md b/Documentation1.md index f15b093..a2a268b 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -20,4 +20,4 @@ value3 float: the c value in the quadratic formula Returns float for positive and negative values of x. ##Other notes: -The name is a result of my hatred for the quadratic formula. +The name is a result of my dislike of the quadratic formula. From 1dfd133fe75f5d08059f0d457ab90a8fc97df456 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 19:11:58 -0500 Subject: [PATCH 11/17] Update Documentation2.md --- Documentation2.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Documentation2.md b/Documentation2.md index 28f94fa..ef4dad0 100644 --- a/Documentation2.md +++ b/Documentation2.md @@ -1,19 +1,23 @@ -# Name: +# Name: springInMyStep ## Examples: -Insert examples here. +springInMyStep(807.7,0.13,'w') +springInMyStep(8.32,600,'x') +springInMyStep(10,3.56,'k') ## Description: -Insert description here +Solves for the indicated variable (w, k, or x) using variations of the physics equation for work done to a spring: w = 0.5*k*sq(x). ## Syntax: -Demonstrate syntax here +springInMyStep (value1, value2, character) ##Parameters: -Name and describe parameters here +value1 float: first numerical value +value2 float: second numerical value +character float: the letter corresponding to what variable is being solved for ##Returns: -What type of data does it return? +Returns float for isolated variable. ##Other notes: -Anything else? +value1 and value2 can represent any one of the three variables because they stand for the known values, not w, k, or x individually. From aa5e2a198ce433e9a308d3806cccbd4f1591e3f4 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 19:12:27 -0500 Subject: [PATCH 12/17] Update Documentation2.md --- Documentation2.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation2.md b/Documentation2.md index ef4dad0..bd564ae 100644 --- a/Documentation2.md +++ b/Documentation2.md @@ -2,7 +2,9 @@ ## Examples: springInMyStep(807.7,0.13,'w') + springInMyStep(8.32,600,'x') + springInMyStep(10,3.56,'k') ## Description: @@ -13,7 +15,9 @@ springInMyStep (value1, value2, character) ##Parameters: value1 float: first numerical value + value2 float: second numerical value + character float: the letter corresponding to what variable is being solved for ##Returns: From e0f1965cf9b1feb47c268c8fd1310696cbdde271 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 20:23:18 -0500 Subject: [PATCH 13/17] Update Code --- Code | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Code b/Code index 3a33f97..eb0f047 100644 --- a/Code +++ b/Code @@ -1,13 +1,28 @@ +int diam; +PVector loc1; +PVector vel1; +PVector loc2; +PVector vel2; + void setup() { + background(0); + size(400,400); + diam = 15; + loc1 = new PVector (mouseX, mouseY); + loc2 = new PVector (mouseX, mouseY); + vel1 = new PVector (5,5); + vel2 = new PVector (-5,-5); } void draw() { + background(0); println(whenXDoesYouWrong(1,9,-10)); println(springInMyStep(807.7,0.13,'w')); println(springInMyStep(8.32,600,'x')); println(springInMyStep(10,3.56,'k')); + followMrMouse(); } float[] whenXDoesYouWrong(float a, float b, float c) @@ -35,3 +50,39 @@ float springInMyStep (float a, float b, char isolate) } return result; } + +void followMrMouse() +{ + noStroke(); + fill(random(255),random(255),random(255)); + ellipse(loc1.x,loc1.y, diam, diam); + ellipse(loc2.x,loc2.y,diam,diam); + loc1.add(vel1); + loc2.add(vel2); + if (loc1.x > mouseX+20) + { + vel1.x = -abs(vel1.x); + } else if (loc1.x < mouseX-20) { + vel1.x = abs(vel1.x); + } + if (loc1.y > mouseY+20) + { + vel1.y = -abs(vel1.y); + } else if (loc1.y < mouseY-20) { + vel1.y = abs(vel1.y); + +} +if (loc2.x > mouseX+20) + { + vel2.x = -abs(vel2.x); + } else if (loc2.x < mouseX-20) { + vel2.x = abs(vel2.x); + } + if (loc2.y > mouseY+20) + { + vel2.y = -abs(vel2.y); + } else if (loc2.y < mouseY-20) { + vel2.y = abs(vel2.y); + +} +} From c005d9ddf69c92abaf79a020b9ef3d9a53547426 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 20:38:28 -0500 Subject: [PATCH 14/17] Update Code --- Code | 54 +++++++++++++++--------------------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/Code b/Code index eb0f047..d5a0853 100644 --- a/Code +++ b/Code @@ -1,23 +1,17 @@ int diam; -PVector loc1; -PVector vel1; -PVector loc2; -PVector vel2; +PVector loc; +PVector vel; void setup() { - background(0); size(400,400); diam = 15; - loc1 = new PVector (mouseX, mouseY); - loc2 = new PVector (mouseX, mouseY); - vel1 = new PVector (5,5); - vel2 = new PVector (-5,-5); + loc = new PVector (mouseX, mouseY); + vel = new PVector (5,5); } void draw() { - background(0); println(whenXDoesYouWrong(1,9,-10)); println(springInMyStep(807.7,0.13,'w')); println(springInMyStep(8.32,600,'x')); @@ -33,7 +27,7 @@ float[] whenXDoesYouWrong(float a, float b, float c) return x; } -float springInMyStep (float a, float b, char isolate) +float springInMyStep (float a, float b, char isolate) { float result = 0; if(isolate == 'w') @@ -53,36 +47,18 @@ float springInMyStep (float a, float b, char isolate) void followMrMouse() { - noStroke(); - fill(random(255),random(255),random(255)); - ellipse(loc1.x,loc1.y, diam, diam); - ellipse(loc2.x,loc2.y,diam,diam); - loc1.add(vel1); - loc2.add(vel2); - if (loc1.x > mouseX+20) + ellipse(loc.x,loc.y, diam, diam); + loc.add(vel); + if (loc.x > mouseX+20) { - vel1.x = -abs(vel1.x); - } else if (loc1.x < mouseX-20) { - vel1.x = abs(vel1.x); + vel.x = -abs(vel.x); + } else if (loc.x < mouseX-20) { + vel.x = abs(vel.x); } - if (loc1.y > mouseY+20) + if (loc.y > mouseY+20) { - vel1.y = -abs(vel1.y); - } else if (loc1.y < mouseY-20) { - vel1.y = abs(vel1.y); - -} -if (loc2.x > mouseX+20) - { - vel2.x = -abs(vel2.x); - } else if (loc2.x < mouseX-20) { - vel2.x = abs(vel2.x); - } - if (loc2.y > mouseY+20) - { - vel2.y = -abs(vel2.y); - } else if (loc2.y < mouseY-20) { - vel2.y = abs(vel2.y); - + vel.y = -abs(vel.y); + } else if (loc.y < mouseY-20) { + vel.y = abs(vel.y); } } From c25f488697a824b0ac3b14970674fdf92f61e9e0 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 20:45:17 -0500 Subject: [PATCH 15/17] Update Documentation3.md --- Documentation3.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation3.md b/Documentation3.md index 28f94fa..e64537c 100644 --- a/Documentation3.md +++ b/Documentation3.md @@ -1,7 +1,7 @@ -# Name: +# Name: followMrMouse() ## Examples: -Insert examples here. + ## Description: Insert description here From 2caa3d3e34cae52af7c35e586228b746cb05388e Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 20:53:27 -0500 Subject: [PATCH 16/17] Update Documentation3.md --- Documentation3.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Documentation3.md b/Documentation3.md index e64537c..5349f64 100644 --- a/Documentation3.md +++ b/Documentation3.md @@ -1,19 +1,18 @@ # Name: followMrMouse() ## Examples: - +followMrMouse(); ## Description: -Insert description here +Creates an ellipse that follows the mouse in a zigzag pattern. ## Syntax: -Demonstrate syntax here +followMrMouse() ##Parameters: -Name and describe parameters here + ##Returns: -What type of data does it return? +Does not return data. ##Other notes: -Anything else? From 93707571a87054ba13233346dcd033e9f484a137 Mon Sep 17 00:00:00 2001 From: Timber Wolfe Date: Mon, 14 Dec 2015 20:53:45 -0500 Subject: [PATCH 17/17] Update Documentation3.md --- Documentation3.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation3.md b/Documentation3.md index 5349f64..9f3d326 100644 --- a/Documentation3.md +++ b/Documentation3.md @@ -13,6 +13,5 @@ followMrMouse() ##Returns: -Does not return data. ##Other notes: