{"id":74391,"date":"2022-10-15T12:07:01","date_gmt":"2022-10-15T16:07:01","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74391"},"modified":"2022-10-15T12:07:01","modified_gmt":"2022-10-15T16:07:01","slug":"project-07-curves-2","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/15\/project-07-curves-2\/","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><p>The most difficult part of this project is to find out how which curve formula to use for my design. I played around with different colors and shape overlapping and I like the flower shape it makes.<\/p>\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-116.js\" data-width=\"480\" data-height='480\"'>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\">\/\/Jenny Wang\n\/\/sectionB\n\/\/jiayiw3@andrew.cmu.edu\n\/\/project - 07 - curves\n\nvar nPoints = 150;\n\nfunction setup() {\n    createCanvas(480, 480);\n    background(29,7,79);\/\/dark purple\n    frameRate(10);\n}\n\nfunction draw() {\n    push();\n    \/\/make the center of canvas the origin\n    translate(width\/2,height\/2);\n\n    \/\/draw loop for the curves 1 & 2\n    background(29,7,79);\/\/dark purple\n    curve1();\n    curve2();\n    curve3();\n    pop();\n}\n\nfunction curve1(){\n\n    \/\/Epicycloid Involute\n    \/\/https:\/\/mathworld.wolfram.com\/EpicycloidInvolute.html\n    \n    \/\/set varibale\n    var x;\n    var y;\n    var a = mouseX\/8\n    var b = mouseY\/8\n    \n    beginShape();\n    noFill();\n    stroke(247,246,208);\/\/light yellow\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)-b*cos(((a+b)\/b)*t);\n            y = (a+b)*sin(t)-b*sin(((a+b)\/b)*t);\n            vertex(x,y);\n            \n        endShape(CLOSE);\n    }\n}\n\nfunction curve2(){\n\n    \/\/Epicycloid Involute\n    \/\/https:\/\/mathworld.wolfram.com\/EpicycloidInvolute.html\n    \n    \/\/set variable\n    var x;\n    var y;\n    var a = mouseX\/5\n    var b = mouseY\/5\n    \n    beginShape();\n    noFill();\n    stroke(\"white\");\/\/white\n    for(var i=0; i&lt;nPoints; i++){\n            var t = map(i,0,nPoints,0,PI+QUARTER_PI);\n            x = (a+b)*cos(t)-b*cos(((a+b)\/b)*t);\n            y = (a+b)*sin(t)-b*sin(((a+b)\/b)*t);\n            vertex(x,y);\n            \n        endShape(CLOSE);\n    }\n}\n\nfunction curve3(){\n\n    \/\/Epicycloid Involute\n    \/\/https:\/\/mathworld.wolfram.com\/EpicycloidInvolute.html\n    \n    \/\/set variable\n    var x;\n    var y;\n    var a = mouseX\/3\n    var b = mouseY\/3\n    \n    beginShape();\n    noFill();\n    stroke(\"pink\");\/\/pink\n    for(var i=0; i&lt;nPoints; i++){\n            var t = map(i,0,nPoints,0,PI);\n            x = (a+b)*cos(t)-b*cos(((a+b)\/b)*t);\n            y = (a+b)*sin(t)-b*sin(((a+b)\/b)*t);\n            vertex(x,y);\n            \n        endShape(CLOSE);\n    }\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>The most difficult part of this project is to find out how which curve formula to use for my design. I played around with different colors and shape overlapping and I like the flower shape it makes. sketch\/\/Jenny Wang \/\/sectionB \/\/jiayiw3@andrew.cmu.edu \/\/project &#8211; 07 &#8211; curves var nPoints = 150; function setup() { createCanvas(480, 480); &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/15\/project-07-curves-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project-07-curves&#8221;<\/span><\/a><\/p>\n","protected":false},"author":769,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[108,56],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74391"}],"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\/769"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74391"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74391\/revisions"}],"predecessor-version":[{"id":74395,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74391\/revisions\/74395"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}