{"id":67997,"date":"2021-10-18T08:14:49","date_gmt":"2021-10-18T12:14:49","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=67997"},"modified":"2021-10-18T08:14:49","modified_gmt":"2021-10-18T12:14:49","slug":"project-07-curves-3","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/18\/project-07-curves-3\/","title":{"rendered":"Project: 07 Curves"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><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-127.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\">\/\/Jacky Lococo\n\/\/jlococo\n\/\/Section C\nvar nPoints = 50; \/\/ points on the epispiral and ranunculoid\nfunction setup() {\n    createCanvas(480, 480);\n}\n\nfunction draw() {\n    background(255);\n    push()\n    translate(width\/2, height\/2)\n    rotate(mouseX\/2, mouseY\/2)\n    epispiralOne() \/\/espiral - will repeat this shape to make more spiral lines\n    epispiralOne()\n    rotate(mouseX\/4, mouseY\/2)\n    epispiralOne()\n    ranunculoid() \/\/flower curve -- will repeat to create spirals\n    rotate(mouseX, mouseY)\n    scale(2.0)\n    ranunculoid() \/\/flower curve scaled by factor of 2\n    ranunculoid()\n    scale(0.5)\n    ranunculoid()\n    pop()\n\n    push()\n    scale(2.0) \/\/scaled up flower in top left corner\n    ranunculoid()\n    pop()\n    ranunculoid() \/\/ flower in top left corner\n\n    push()\n    translate(width, height)\n    ranunculoid()\/\/ flower in bottom right corner\n    scale(2.0)\/\/scaled up flower in right corner\n    ranunculoid()\n    pop()\n\n    ellipse(width\/2, height\/2, mouseY\/30, mouseY\/30 ) \/\/creates scaling ellipse\n\n\n}\n\nfunction epispiralOne(){ \/\/episprial with two curves\n    var a = 40\n    var b = a \/ 2.0;\n    var h = mouseX\n    var ph = mouseX \/ 50.0\n    noFill()\n    strokeWeight(2)\n    stroke(0, 100, mouseY)\n    beginShape();\n    for (var i = 0; i &lt; nPoints; i++) {\n        var t = map(i, 0, nPoints, 0, TWO_PI);\n        x = (a + b) * cos(t) - h * cos(ph + t * (a + b) \/ b); \/\/formulas\n        y = (a + b) * sin(t) - h * sin(ph + t * (a + b) \/ b);\n        vertex(x,y)\n    }\n    endShape()\n\n}\n\nfunction ranunculoid(){ \/\/ type of Epicycloid with four petals\n    var a = mouseY \/ 30 \/\/ changes the size of the shape\n    noFill()\n    stroke(mouseX, 0, 100) \/\/ changes just the red value \n    strokeWeight(1)\n    beginShape();\n    for (var i = 0; i &lt; nPoints; i++) {\n        var t = map(i, 0, nPoints, 0, TWO_PI);\n        x = a*(6 * cos(t) - cos(6*t)); \/\/formulas\n        y = a*(6 * sin(t) - sin(6*t));\n        vertex(x,y)\n    }\n    endShape()\n\n}\n\n\n\n<\/code><\/pre><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":655,"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\/67997"}],"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\/655"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=67997"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67997\/revisions"}],"predecessor-version":[{"id":67999,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67997\/revisions\/67999"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=67997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=67997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=67997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}