{"id":67577,"date":"2021-10-15T10:37:46","date_gmt":"2021-10-15T14:37:46","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=67577"},"modified":"2021-10-15T10:37:46","modified_gmt":"2021-10-15T14:37:46","slug":"project-07-mathematical-curves","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/15\/project-07-mathematical-curves\/","title":{"rendered":"Project 07: Mathematical 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><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-81.js\">sketch<\/a>\n\n\n\n<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\">\/\/Alana Wu\n\/\/ID: alanawu\n\/\/Project 07 Mathematical Curves\n\nvar nPoints1 = 40;\nvar nPoints2 = 550;\nvar nPoints3 = 100;\nvar whichCurve = 1;\n\n\nfunction setup()\n{\n    createCanvas(480, 480);\n    background(0);\n    stroke (255);\n\n}\n\nfunction draw()\n{\n    translate (width\/2, height\/2);\n    if (whichCurve == 0)\n    {\n        rotate (radians (constrain (mouseY, 50, height - 50)));\n        sinusoidSpiral (); \n    }\n    if (whichCurve == 1)\n    {\n        rotate (radians (mouseX));\n        archiSpiral();\n    }\n    if (whichCurve == 2)\n    {\n        astroidCurve();\n    }\n\n}\n\n\/\/https:\/\/mathworld.wolfram.com\/SinusoidalSpiral.html\nfunction sinusoidSpiral () \/\/r^n = (a^n)cos(n*theta)\n{\n    var x;\n    var y;\n    var a = mouseX\/10;\n    var b = constrain (mouseX\/10, 2, 9);\n    var theta = radians (0);\n\n    fill (mouseX - 100, mouseY - 100, mouseY - 100);\n    beginShape();\n    for (var i = 0; i &lt; nPoints1; i++)\n    {\n        var theta = map(i, 0, nPoints1, 0, TWO_PI);\n        x = a * (b*cos(theta) - cos(b * theta));\n        y = a * (b * sin(theta) - sin(b * theta));\n        vertex (x, y);\n    }\n    endShape(CLOSE);\n}\n\n\/\/https:\/\/mathworld.wolfram.com\/ArchimedeanSpiral.html\nfunction archiSpiral ()\n{\n    var x;\n    var y;\n    var a = mouseX\/10;\n    var n = 10;\n\n    push();\n    background(0);\n    noFill();\n    stroke(255);\n    strokeWeight(.2);\n    beginShape();\n    for (var i = 0; i &lt; nPoints2; i++)\n    {\n        var theta = map (i, 0, nPoints2, 0, TWO_PI*2);\n        x = a * cos (theta) * (theta)^(1\/n);  \/\/x = rcos(theta)\n        y = a * sin(theta)*theta^(1\/n) + random(-5, 5); \/\/x = rsin(theta)\n        stroke (mouseX, 0, mouseY);\n        vertex (x, y);\n\n    }\n    endShape(CLOSE);\n    pop();\n}\n\n\/\/https:\/\/mathworld.wolfram.com\/AstroidRadialCurve.html\nfunction astroidCurve ()\n{\n    var x;\n    var y;\n    var a = 200;\n\n    push();\n    background(0);\n    stroke(mouseX, mouseX\/10, mouseY + 30);\n    noFill();\n    beginShape();\n    for (var i = 0; i &lt; nPoints3; i++)\n    {\n        var theta = map (i, 0, nPoints3, 0, TWO_PI);\n        x = a * (cos (theta))^3 + random (-5, 5);\n        y = a * (sin(theta))^3 + random (-5, 5);\n        print (x);\n        print (y);\n        vertex (x, y);\n    }\n    endShape(CLOSE);\n    pop();\n}\n\n\n\/\/which shape is drawn changes when mouse is clicked\nfunction mousePressed ()\n{\n    whichCurve++;\n    if (whichCurve == 3)\n    {\n        whichCurve = 0;\n    }\n}\n\n\n<\/code><\/pre><\/p><p><\/p>\n\n\n\n<p>For this project, I chose to use a sinusoidal spiral, an archimedes spiral, and an astroid radial curve. I spent a lot of time altering the parameters to see how they affected the shapes. To add user interaction, I had different aspects of the shapes change with the mouse location, while which curve drawn changed as the mouse was clicked. I particularly liked playing with the colors and rotations of sinusoidal spiral. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"948\" height=\"940\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.27.14-AM.png\" alt=\"\" class=\"wp-image-67581\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.27.14-AM.png 948w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.27.14-AM-300x297.png 300w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.27.14-AM-150x150.png 150w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.27.14-AM-768x762.png 768w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\"><\/figure><p>Doing this project also made me wonder how other mathematical concepts can be visualized, and whether or not that could help people understand certain mathematical concepts better.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"956\" height=\"958\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.26.59-AM.png\" alt=\"\" class=\"wp-image-67582\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.26.59-AM.png 956w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.26.59-AM-300x300.png 300w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.26.59-AM-150x150.png 150w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-15-at-10.26.59-AM-768x770.png 768w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\"><\/figure><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>For this project, I chose to use a sinusoidal spiral, an archimedes spiral, and an astroid radial curve. I spent a lot of time altering the parameters to see how they affected the shapes. To add user interaction, I had different aspects of the shapes change with the mouse location, while which curve drawn changed &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/15\/project-07-mathematical-curves\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 07: Mathematical Curves&#8221;<\/span><\/a><\/p>\n","protected":false},"author":677,"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\/67577"}],"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\/677"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=67577"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67577\/revisions"}],"predecessor-version":[{"id":67584,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67577\/revisions\/67584"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=67577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=67577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=67577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}