{"id":74684,"date":"2022-10-16T22:45:32","date_gmt":"2022-10-17T02:45:32","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74684"},"modified":"2022-10-16T22:45:32","modified_gmt":"2022-10-17T02:45:32","slug":"project-07-curves-7","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/16\/project-07-curves-7\/","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><em>Graham Murtha<\/em><\/p>\n\n\n\n<p><em>Section A<\/em><\/p>\n\n\n\n<p>For this project, I wanted to make a series of layered petal-like formations with linework, all with different reactions to mouseX and mouseY.  However, the cardioid caused some trouble, since despite how many times I manipulated the equation, it remained an very slow-growing shape on the left of the screen.  <\/p>\n\n\n\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-143.js\" data-width=\"400\" data-height=\"600\">sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"400\" height=\"600\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Graham Murtha\n\/\/Section A\n\/\/Assignment 7\n\/\/gmurtha@andrew.cmu.edu\n\n\nvar vertices = 150; \/\/ number of vertices or coordinates\n\nfunction setup() {\n    createCanvas(480, 480);\n    background(0);\n    text(\"p5.js vers 0.9.0 test.\", 10, 15);\n}\n\nfunction draw() {\n    push();\n    \/\/moves origin to the center of the canvas\n    translate(width\/2,height\/2);\n\n    \/\/draws loop for the three shapes\n\n    background(120,0,60);\/\/ dark magenta-red\n    Ranunculoid();\n    Cardioid();\n    Nephroid();\n    pop();\n}\n\nfunction Ranunculoid(){\n    \/\/https:\/\/mathworld.wolfram.com\/Ranunculoid.html\n    \n    \/\/variables\n    var x;\n    var y;\n    var a = mouseX\/7\n    var b = mouseY\/100\n    \n    beginShape();\n    noFill();\n    stroke(255,180,255);  \/\/light purple\n    for(var i=0; i&lt;vertices; i++){ \/\/ parametric equations\n            var Ag = map(i,0,vertices,0,TWO_PI); \/\/ angle\/theta\n            x = a*((6*cos(Ag))-(b*cos(6*Ag)));\n            y = a*((6*sin(Ag))-(b*sin(6*Ag)));\n            vertex(x,y);\n            \n        endShape(CLOSE);\n    }\n}\n\nfunction Cardioid(){ \n    \/\/https:\/\/mathworld.wolfram.com\/Cardioid.html\n    \n    \/\/variables\n    var x;\n    var y;\n    var a = mouseX\/4\n    var b = mouseY\/30\n    \n    beginShape();\n    noFill();\n    stroke(255,150,0);\/\/orange\n    for(var i=0; i&lt;vertices; i++){ \/\/ parametric equations\n            var Ag = map(i,0,vertices,0,PI+QUARTER_PI); \/\/ angle\/theta\n            x = (a*cos(Ag)*(1-cos(Ag))*b);\n            y = (a*sin(Ag)*(1-cos(Ag))*b);\n            vertex(x,y);\n            \n        endShape(CLOSE);\n    }\n}\n\nfunction Nephroid(){\n    \/\/ https:\/\/mathworld.wolfram.com\/Nephroid.html\n    \n    \/\/variables\n    var x;\n    var y;\n    var a = mouseX\/6\n    var b = mouseY\/4\n    \n    beginShape();\n    noFill();\n    stroke(255); \/\/ white\n    for(var i=0; i&lt;vertices; i++){ \/\/ parametric equations\n            var Ag = map(i,0,vertices,0,PI); \/\/ angle\/theta\n            x = a*(3*cos(Ag))-((cos(3*Ag))*b);\n            y = a*(3*sin(Ag))-((sin(3*Ag))*b);\n            vertex(x,y);\n            \n        endShape(CLOSE);\n    }\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Graham Murtha Section A For this project, I wanted to make a series of layered petal-like formations with linework, all with different reactions to mouseX and mouseY. However, the cardioid caused some trouble, since despite how many times I manipulated the equation, it remained an very slow-growing shape on the left of the screen. sketch &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/16\/project-07-curves-7\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 07- Curves&#8221;<\/span><\/a><\/p>\n","protected":false},"author":748,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[108],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74684"}],"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\/748"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74684"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74684\/revisions"}],"predecessor-version":[{"id":74686,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74684\/revisions\/74686"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}