From 9223c3c187706cd983fac9da3de82071b7836926 Mon Sep 17 00:00:00 2001 From: kapnerd Date: Tue, 8 Dec 2015 14:30:39 -0500 Subject: [PATCH 1/3] math and physics --- FunctionsChallenge/FunctionsChallenge.pde | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 FunctionsChallenge/FunctionsChallenge.pde diff --git a/FunctionsChallenge/FunctionsChallenge.pde b/FunctionsChallenge/FunctionsChallenge.pde new file mode 100644 index 0000000..7302fbc --- /dev/null +++ b/FunctionsChallenge/FunctionsChallenge.pde @@ -0,0 +1,20 @@ +//physics +float force(float m, float a) { + float F = m*a; + return F; +} + +//math +float slope(float r1x, float r1y, float r2x, float r2y) { + float m = (r2y - r1y)/(r2x-r1x); + return m; +} + +//visual + + + +void draw() { + println(force(10, 5)); + println(slope(14, 15, 12, 16)); +} \ No newline at end of file From 50ba53233338df8dd1dd6457df157da2178e2ce3 Mon Sep 17 00:00:00 2001 From: kapnerd Date: Tue, 8 Dec 2015 14:49:26 -0500 Subject: [PATCH 2/3] visual --- FunctionsChallenge/FunctionsChallenge.pde | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/FunctionsChallenge/FunctionsChallenge.pde b/FunctionsChallenge/FunctionsChallenge.pde index 7302fbc..59dc1a2 100644 --- a/FunctionsChallenge/FunctionsChallenge.pde +++ b/FunctionsChallenge/FunctionsChallenge.pde @@ -11,10 +11,21 @@ float slope(float r1x, float r1y, float r2x, float r2y) { } //visual +void donut(float x, float y, float diam){ + fill(random(255),random(255),random(255)); + ellipse(x,y, diam, diam); + fill(0); + ellipse(x,y, diam/3,diam/3); +} - +void setup(){ + background(0); + size(800,600); + noStroke(); +} void draw() { println(force(10, 5)); println(slope(14, 15, 12, 16)); + donut(width/2,height/2,200); } \ No newline at end of file From 2208d30ec3085a68cb4896015bb421cf4ce539a6 Mon Sep 17 00:00:00 2001 From: kapnerd Date: Thu, 10 Dec 2015 14:42:07 -0500 Subject: [PATCH 3/3] Documentation --- Documentation1.md | 15 ++++++++------- Documentation2.md | 18 ++++++++++-------- Documentation3.md | 16 +++++++++------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Documentation1.md b/Documentation1.md index 28f94fa..68fbc6e 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -1,19 +1,20 @@ # Name: +Force() ## Examples: -Insert examples here. +Force(10,5) +Returns 50 ## Description: -Insert description here +Calculates force by multilying mass and acceleration. ## Syntax: -Demonstrate syntax here +force(m,a) ##Parameters: -Name and describe parameters here +float m - mass +float a - acceleration ##Returns: -What type of data does it return? +float f - force -##Other notes: -Anything else? diff --git a/Documentation2.md b/Documentation2.md index 28f94fa..9e4f147 100644 --- a/Documentation2.md +++ b/Documentation2.md @@ -1,19 +1,21 @@ # Name: +slope() ## Examples: -Insert examples here. +slope(14,15,12,16) +Returns -.5 ## Description: -Insert description here +Calculates the slope of a line from two points on the line ## Syntax: -Demonstrate syntax here +slope(r1x,r1y,r2x,r2y) ##Parameters: -Name and describe parameters here +float r1x - x coordinate of first point +float r1y - y coordinate of first point +float r2x - x coordinate of second point +float r2y - y coordinate of second point ##Returns: -What type of data does it return? - -##Other notes: -Anything else? +float m - slope diff --git a/Documentation3.md b/Documentation3.md index 28f94fa..5e87231 100644 --- a/Documentation3.md +++ b/Documentation3.md @@ -1,19 +1,21 @@ # Name: +donut() ## Examples: -Insert examples here. +donut(width/2,height/2,200) +Draws a donut in the middle of the window. ## Description: -Insert description here +Draws a colored circle then a black circle 1/3 its size ## Syntax: -Demonstrate syntax here +donut(x,y,diam); ##Parameters: -Name and describe parameters here +x - x coordinate of donut +y - y coordinate of donut +diam - diameter of donut ##Returns: -What type of data does it return? +Displays donut -##Other notes: -Anything else?