From 49c45ebac3de75833c58b9478affe2c97e82bf90 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Wed, 9 Dec 2015 13:46:18 -0500 Subject: [PATCH 01/15] Update and rename Documentation1.md to mathfunctiondescription.md trial for committing changes to documentation online --- Documentation1.md => mathfunctiondescription.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Documentation1.md => mathfunctiondescription.md (93%) diff --git a/Documentation1.md b/mathfunctiondescription.md similarity index 93% rename from Documentation1.md rename to mathfunctiondescription.md index 28f94fa..ea289b1 100644 --- a/Documentation1.md +++ b/mathfunctiondescription.md @@ -1,5 +1,5 @@ # Name: - +Christian Bondalo ## Examples: Insert examples here. From d2a50f0522a4c625a448f8ae18c7507a384ed9bc Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Wed, 9 Dec 2015 13:53:31 -0500 Subject: [PATCH 02/15] inserted math, physics, and visual functions --- math_function/math_function.pde | 20 ++++++++++++++++++++ physics_function/physics_function.pde | 13 +++++++++++++ visual_function/visual_finction.pde | 9 +++++++++ 3 files changed, 42 insertions(+) create mode 100644 math_function/math_function.pde create mode 100644 physics_function/physics_function.pde create mode 100644 visual_function/visual_finction.pde diff --git a/math_function/math_function.pde b/math_function/math_function.pde new file mode 100644 index 0000000..d892f74 --- /dev/null +++ b/math_function/math_function.pde @@ -0,0 +1,20 @@ +void setup () { + size(600, 600); //draw canvas for mouseX and mouseY inputs +} + +void draw () { + background(255); //draw a white background + println(convertmeterstomiles(10)); //print out resulting miles from meters + println(convertinchestokm(10)); //print out resulting kilometers from inches +} + + +float convertmeterstomiles (float x) { //convert meters to miles + float result = mouseX * 1000 * .625; + return result; +} + +float convertinchestokm (float y) { //convert inches to kilometers + float result = mouseY * .0833 * .0001 * .625; + return result; +} \ No newline at end of file diff --git a/physics_function/physics_function.pde b/physics_function/physics_function.pde new file mode 100644 index 0000000..cdf56fc --- /dev/null +++ b/physics_function/physics_function.pde @@ -0,0 +1,13 @@ +void setup () { + size(800,800); //make a canvas +} + + +void draw () { + println(finalspeed(2,4,8)); //input displacement of 2m, initial velocity of 4m/s, and acceleration of 8m/s^2 +} + +float finalspeed (float x, float Vo, float a) { //finding final speed given displacement, initial velocity, and acceleration + float result = sqrt(pow(Vo,2) + 2*x*a); //using formula Vf^2=Vo^2+2ax + return result; +} \ No newline at end of file diff --git a/visual_function/visual_finction.pde b/visual_function/visual_finction.pde new file mode 100644 index 0000000..5172769 --- /dev/null +++ b/visual_function/visual_finction.pde @@ -0,0 +1,9 @@ +void setup () { + +} + + +void draw () { + + +} \ No newline at end of file From 5347141639f6559959856763b57ba023ce8c2d52 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 15:54:12 -0500 Subject: [PATCH 03/15] Rename Documentation2.md to physicsfunctiondescription.md --- Documentation2.md => physicsfunctiondescription.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation2.md => physicsfunctiondescription.md (100%) diff --git a/Documentation2.md b/physicsfunctiondescription.md similarity index 100% rename from Documentation2.md rename to physicsfunctiondescription.md From ef92c831a144fdc85354c20c1dc19bedb9826ef9 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 15:56:22 -0500 Subject: [PATCH 04/15] Rename Documentation3.md to visualfunctiondescriptionDocumentation3.md --- Documentation3.md => visualfunctiondescriptionDocumentation3.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation3.md => visualfunctiondescriptionDocumentation3.md (100%) diff --git a/Documentation3.md b/visualfunctiondescriptionDocumentation3.md similarity index 100% rename from Documentation3.md rename to visualfunctiondescriptionDocumentation3.md From fb3c050c54d7b9d37fe406126486254ec9b74777 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 17:26:35 -0500 Subject: [PATCH 05/15] Update visual_finction.pde added cool background with tint at keyPressed --- visual_function/visual_finction.pde | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/visual_function/visual_finction.pde b/visual_function/visual_finction.pde index 5172769..29270e6 100644 --- a/visual_function/visual_finction.pde +++ b/visual_function/visual_finction.pde @@ -1,9 +1,14 @@ +PImage images; //declare image variables + void setup () { - + size(800,800); + images = loadImage("images.jpg"); } - void draw () { + image(images, 250, 250); + if (keyPressed) { + tint(random(255),random(255),random(255)); + } +} - -} \ No newline at end of file From 006daa9b9f9900df067a47cf3577b3c9ef7a5349 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 17:37:33 -0500 Subject: [PATCH 06/15] Update visual_finction.pde added array of circles function (end result is here but PImage function is needed) --- visual_function/visual_finction.pde | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/visual_function/visual_finction.pde b/visual_function/visual_finction.pde index 29270e6..8049f63 100644 --- a/visual_function/visual_finction.pde +++ b/visual_function/visual_finction.pde @@ -1,14 +1,31 @@ PImage images; //declare image variables +int count = 600; //max # of balls to appear +float [] x = new float[count]; //declare variables for x & y location and diameter +float [] y = new float[count]; +float [] diam = new float[count]; void setup () { size(800,800); - images = loadImage("images.jpg"); + images = loadImage("images.jpg"); //bring the image into the processing file + for (int i = 0; i < count; i++) { //set random values for x & y location and diameter + x[i] = random(0,800); + y[i] = random(0,800); + diam[i] = random(0,10); + } } void draw () { - image(images, 250, 250); - if (keyPressed) { + background(56, 255, 221); //give a light blue background + image(images, 250, 250); //draw the chosen image and establish its location + if (keyPressed) { //if any key is pressed, give a random tint tint(random(255),random(255),random(255)); } + DrawArrayofCircles(); //use this function to draw an array of circles } +void DrawArrayofCircles () { + for (int i = 0; i < count; i++) { + fill(random(255),random(255),random(255)); //give each new ball a random fill + ellipse(x[i], y[i], diam[i], diam[i]); //draw circles randomly + } +} From 69a42a04e5604348d4e8ed8a375720e8a8c7df00 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 17:47:03 -0500 Subject: [PATCH 07/15] Update visual_finction.pde changed it up so that Pimage is a function to use --- visual_function/visual_finction.pde | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/visual_function/visual_finction.pde b/visual_function/visual_finction.pde index 8049f63..cb43c4b 100644 --- a/visual_function/visual_finction.pde +++ b/visual_function/visual_finction.pde @@ -17,9 +17,7 @@ void setup () { void draw () { background(56, 255, 221); //give a light blue background image(images, 250, 250); //draw the chosen image and establish its location - if (keyPressed) { //if any key is pressed, give a random tint - tint(random(255),random(255),random(255)); - } + Pimage(); DrawArrayofCircles(); //use this function to draw an array of circles } @@ -29,3 +27,10 @@ void DrawArrayofCircles () { ellipse(x[i], y[i], diam[i], diam[i]); //draw circles randomly } } + +void Pimage () { + image(images, 250, 250); //draw the chosen image and establish its location + if (keyPressed) { //if any key is pressed, give a random tint + tint(random(255),random(255),random(255)); + } +} From 50c2a65deb8b65fc65d391d45b7bfeaaa3245778 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 18:16:25 -0500 Subject: [PATCH 08/15] Update math_function.pde I just discovered that the use of the mouse's location is not practical for this assignment so i changed it --- math_function/math_function.pde | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/math_function/math_function.pde b/math_function/math_function.pde index d892f74..806516e 100644 --- a/math_function/math_function.pde +++ b/math_function/math_function.pde @@ -10,11 +10,11 @@ void draw () { float convertmeterstomiles (float x) { //convert meters to miles - float result = mouseX * 1000 * .625; + float result = x * 1000 * .625; return result; } float convertinchestokm (float y) { //convert inches to kilometers - float result = mouseY * .0833 * .0001 * .625; + float result = y * .0833 * .0001 * .625; return result; -} \ No newline at end of file +} From 9ffc4efd7c62c3cb20d8f2b1857709c5e74e1c69 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 18:20:02 -0500 Subject: [PATCH 09/15] Update mathfunctiondescription.md --- mathfunctiondescription.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mathfunctiondescription.md b/mathfunctiondescription.md index ea289b1..8b091e1 100644 --- a/mathfunctiondescription.md +++ b/mathfunctiondescription.md @@ -1,19 +1,20 @@ # Name: -Christian Bondalo +Unit Conversions (2 options) ## Examples: -Insert examples here. +println(convertmeterstomiles(13)) ## Description: -Insert description here +Converts inches to kilometeres and meters to miles ## Syntax: -Demonstrate syntax here +(x, y) ##Parameters: -Name and describe parameters here +x = inputted x value +y = inputted y value ##Returns: -What type of data does it return? +Float ##Other notes: Anything else? From 9a6d2ddb4b859d6af85626759eb2c07c1d483303 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 18:31:26 -0500 Subject: [PATCH 10/15] Update physicsfunctiondescription.md --- physicsfunctiondescription.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/physicsfunctiondescription.md b/physicsfunctiondescription.md index 28f94fa..0d4e94e 100644 --- a/physicsfunctiondescription.md +++ b/physicsfunctiondescription.md @@ -1,19 +1,22 @@ # Name: - +Finding final speed of an object ## Examples: -Insert examples here. +println(finalspeed(2,4,8)) +final speed = 6.928203 ## Description: -Insert description here +after giving the displacement, initial velocity, and acceleration, this function will give you the object's final velocity ## Syntax: -Demonstrate syntax here +float finalspeed (float x, float Vo, float a) ##Parameters: -Name and describe parameters here +float x = displacement +float Vo = initial velocity +float a = acceleration ##Returns: -What type of data does it return? +float ##Other notes: -Anything else? +uses the equation (Vf)^2 = (Vi)^2 + 2ax From d54e468107358ba6e32134689d0f0335d1e41d7a Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 18:32:33 -0500 Subject: [PATCH 11/15] Update physicsfunctiondescription.md --- physicsfunctiondescription.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physicsfunctiondescription.md b/physicsfunctiondescription.md index 0d4e94e..0915e16 100644 --- a/physicsfunctiondescription.md +++ b/physicsfunctiondescription.md @@ -1,7 +1,7 @@ # Name: Finding final speed of an object ## Examples: -println(finalspeed(2,4,8)) +println(finalspeed(2,4,8)), final speed = 6.928203 ## Description: From b9cf67907a1848b6fcc617920af635317b78e4ac Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 18:36:19 -0500 Subject: [PATCH 12/15] Update mathfunctiondescription.md --- mathfunctiondescription.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mathfunctiondescription.md b/mathfunctiondescription.md index 8b091e1..0256f6c 100644 --- a/mathfunctiondescription.md +++ b/mathfunctiondescription.md @@ -1,7 +1,8 @@ # Name: Unit Conversions (2 options) ## Examples: -println(convertmeterstomiles(13)) +println(convertmeterstomiles(10)), 10 meters = 6250 miles +println(convertinchestokm(10)), 10 inches = 5.206 x 10^-5 km ## Description: Converts inches to kilometeres and meters to miles From b229c399feb357d8d0e1a88bc9286a1cc379fdfc Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 18:36:42 -0500 Subject: [PATCH 13/15] Update mathfunctiondescription.md --- mathfunctiondescription.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathfunctiondescription.md b/mathfunctiondescription.md index 0256f6c..55d78d3 100644 --- a/mathfunctiondescription.md +++ b/mathfunctiondescription.md @@ -1,7 +1,7 @@ # Name: Unit Conversions (2 options) ## Examples: -println(convertmeterstomiles(10)), 10 meters = 6250 miles +println(convertmeterstomiles(10)), 10 meters = 6250 miles; println(convertinchestokm(10)), 10 inches = 5.206 x 10^-5 km ## Description: From a1a7e2493a42ad2a6bca951c972058c55b5748a9 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 18:37:11 -0500 Subject: [PATCH 14/15] Update mathfunctiondescription.md --- mathfunctiondescription.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathfunctiondescription.md b/mathfunctiondescription.md index 55d78d3..b5263e5 100644 --- a/mathfunctiondescription.md +++ b/mathfunctiondescription.md @@ -5,7 +5,7 @@ println(convertmeterstomiles(10)), 10 meters = 6250 miles; println(convertinchestokm(10)), 10 inches = 5.206 x 10^-5 km ## Description: -Converts inches to kilometeres and meters to miles +Converts inches to kilometers and meters to miles ## Syntax: (x, y) From c91561d5674ea102f21ebce2e047b3438c84a3c3 Mon Sep 17 00:00:00 2001 From: SSJcbondalo Date: Sun, 13 Dec 2015 18:43:43 -0500 Subject: [PATCH 15/15] Update visualfunctiondescriptionDocumentation3.md --- visualfunctiondescriptionDocumentation3.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/visualfunctiondescriptionDocumentation3.md b/visualfunctiondescriptionDocumentation3.md index 28f94fa..77ce256 100644 --- a/visualfunctiondescriptionDocumentation3.md +++ b/visualfunctiondescriptionDocumentation3.md @@ -1,19 +1,20 @@ # Name: - +Background w/ array of circles ## Examples: -Insert examples here. + ## Description: -Insert description here +Plots a picture in the middle of the canvas as an array of circles appear. If any key is pressed, the tint on the pic will change. ## Syntax: -Demonstrate syntax here +Pimage () +DrawArrayofCircles () ##Parameters: -Name and describe parameters here +no parameters ##Returns: -What type of data does it return? +void ##Other notes: Anything else?