{"id":67815,"date":"2021-10-16T22:50:36","date_gmt":"2021-10-17T02:50:36","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=67815"},"modified":"2021-10-16T22:50:36","modified_gmt":"2021-10-17T02:50:36","slug":"project-07","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/16\/project-07\/","title":{"rendered":"Project 07"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><p><a class=\"p5_sketch_link\" data-width=\"480\" data-height=\"480\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/sketch-110.js\">sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"480\" height=\"480\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Tim Nelson-Pyne\n\/\/tnelsonp@andrew.cmu.edu\n\/\/Section C\n\/\/Project-07-Composition With Curves\n\n\/\/size of hypocycloid\nvar a;\n\/\/number of cusps in the hypocycloid\nvar n;\n\/\/x coordinate of points on graph\nvar x;\n\/\/y coordinate of points on graph\nvar y;\n\/\/total number of points to generate\nvar nPoints;\n\nfunction setup() {\n  createCanvas(480, 480);\n  background(0);\n  nPoints = 1000;\n\n  \n}\n\nfunction drawHypocycloid (a, n) {\n  push();\n  translate(240, 240);\n  stroke(255, 0, 0);\n  strokeWeight(0.2);\n  \/\/changes the fill color based on mouseX\n  fill(map(mouseX, 0, 480, 0, 255), 0, map(mouseX, 0, 480, 0, 255));\n  \n\n  for (var i = 0; i &lt;= nPoints; i++) {\n    t = map(i, 0, 1000, radians(0), radians(13 * 360))\n    \/\/equation for x value of hypocycloid\n    x = (a\/n) * ((n-1) * cos(t) - cos((n-1)*t));\n    \/\/equation for y value of hypocycloid\n    y = (a\/n) * ((n-1) * sin(t) - sin((n-1)*t));\n    \/\/draws hypocycloid using elipses centered at points along the graph\n    ellipse(x, y, map(abs(x), 0, 240, 0, 25), map(abs(y), 0, 240, 0, 25));\n    \n  }\n  pop();\n}\n\nfunction draw() {\n  background(0);\n  \/\/sets a based on mouseY\n  a = map(mouseY, 0, 480, 20, 100);\n  \/\/sets n based on mouseX for first shape\n  n = map(mouseX, 0, 480, HALF_PI, 5);\n  \/\/draw first shape\n  drawHypocycloid(a, n);\n  \/\/sets n based on mouseX for second shape\n  n = map(mouseX, 0, 480, -10, -HALF_PI);\n  \/\/draw second shape\n  drawHypocycloid(a, n);\n\n  \n}<\/code><\/pre><\/p>\n\n\n\n<p>I created an interactive visualization of multiple hypocycloids.<\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch \/\/Tim Nelson-Pyne \/\/tnelsonp@andrew.cmu.edu \/\/Section C \/\/Project-07-Composition With Curves \/\/size of hypocycloid var a; \/\/number of cusps in the hypocycloid var n; \/\/x coordinate of points on graph var x; \/\/y coordinate of points on graph var y; \/\/total number of points to generate var nPoints; function setup() { createCanvas(480, 480); background(0); nPoints = 1000; &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/16\/project-07\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 07&#8221;<\/span><\/a><\/p>\n","protected":false},"author":662,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[108,57],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67815"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/users\/662"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=67815"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67815\/revisions"}],"predecessor-version":[{"id":67820,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67815\/revisions\/67820"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=67815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=67815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=67815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}