{"id":74372,"date":"2022-10-15T05:51:50","date_gmt":"2022-10-15T09:51:50","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74372"},"modified":"2022-10-15T23:38:28","modified_gmt":"2022-10-16T03:38:28","slug":"project-7-curves-flower-blossom","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/15\/project-7-curves-flower-blossom\/","title":{"rendered":"Project 7 Curves &#8211; Flower Blossom"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><div class=\"wp-block-file\"><a class=\"p5_sketch_link\" data-width=\"480\" data-height=\"480\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-115.js\">sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/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\">\/\/SRISHTY BHAVSAR\n\/\/15-104 SECTION C\n\/\/PROJECT 7\n\nvar nPoints = 500;\n\nfunction setup() {\n    createCanvas(400, 400);\n\n}\n\n\nfunction draw() {\n    createCanvas(480, 480);\n    background(0);\n    \/\/ draw the curve\n\n    fill(154,205,40,70); \/\/ yellow green color\n    ranunculoid(10,20);\n    hypotro();\n    noFill();\n    ranunculoid(30,50);\n    ranunculoid(40,60);\n\n\n}\n\n\/\/--------------------------------------------------\nfunction hypotro() {\n    \/\/ Hypotrochoid\n    \/\/ https:\/\/mathworld.wolfram.com\/Hypotrochoid.html\n    \n    push();\n    noFill();\n    stroke('magenta');\n    strokeWeight(1);\n    translate(width\/2 , height\/2);\n    var x = constrain(mouseX, 0, width);\n    var y = constrain(mouseY, 0, height);\n    var a = map(x, 0, width, 60, 160); \/\/radius of still circle\n    var b = map(y, 0, height, 1, 8); \/\/ radius b of rolling circle inside still circle\n    var h = constrain(a\/2, 100, 100); \/\/\n    beginShape();\n    for (var i = 0; i &lt; nPoints; i++) {\n        var t = map( i, 0, nPoints, 0, TWO_PI); \/\/ tangent?\n        \/\/PARAMETRIC EQUATIONS\n        x = (a - b) * cos(t) + (h * cos(((a-b)\/b)*t)); \n        y = (a - b) * sin(t) - (h * sin(((a-b)\/b)*t));\n        vertex(x,y); \/\/ connected to center vertex\n\n    }\n    endShape();\n    pop();\n}\n\n\/\/--------------------------------------------------\n\nfunction ranunculoid(xsize,ysize) {\n    \/\/ https:\/\/mathworld.wolfram.com\/Ranunculoid.html\n    push();\n    stroke('green');\n    strokeWeight(1);\n    translate(width\/2 , height\/2);  \n    var x = constrain(mouseX, 0, width);\n    var y = constrain(mouseY, 0, height);\n    var a = map(mouseX, 0, width, xsize, ysize); \n    beginShape();\n    for (var i = 0; i &lt; nPoints\/10; i++) {\n        var t = map(i, 0, nPoints\/10, 0, TWO_PI);\n\n        x = a * (( 6 * cos(t)) - cos(6*t))\n        y = a * (( 6 * sin(t)) - sin(6*t))\n        vertex(x, y);\n    }\n    endShape();\n    pop();\n}\n\n<\/code><\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/IMG_5553-702x1024.jpg\" alt=\"\" class=\"wp-image-74374\" width=\"351\" height=\"512\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/IMG_5553-702x1024.jpg 702w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/IMG_5553-206x300.jpg 206w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/IMG_5553-768x1121.jpg 768w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/IMG_5553-1053x1536.jpg 1053w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/IMG_5553.jpg 1078w\" sizes=\"(max-width: 351px) 85vw, 351px\"><figcaption>equations<\/figcaption><\/figure><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch \/\/SRISHTY BHAVSAR \/\/15-104 SECTION C \/\/PROJECT 7 var nPoints = 500; function setup() { createCanvas(400, 400); } function draw() { createCanvas(480, 480); background(0); \/\/ draw the curve fill(154,205,40,70); \/\/ yellow green color ranunculoid(10,20); hypotro(); noFill(); ranunculoid(30,50); ranunculoid(40,60); } \/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; function hypotro() { \/\/ Hypotrochoid \/\/ https:\/\/mathworld.wolfram.com\/Hypotrochoid.html push(); noFill(); stroke(&#8216;magenta&#8217;); strokeWeight(1); translate(width\/2 , height\/2); var &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/15\/project-7-curves-flower-blossom\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 7 Curves &#8211; Flower Blossom&#8221;<\/span><\/a><\/p>\n","protected":false},"author":704,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[108,57],"tags":[33,61],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74372"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/users\/704"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74372"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74372\/revisions"}],"predecessor-version":[{"id":74621,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74372\/revisions\/74621"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}