{"id":74338,"date":"2022-10-14T13:10:35","date_gmt":"2022-10-14T17:10:35","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74338"},"modified":"2022-10-14T13:14:58","modified_gmt":"2022-10-14T17:14:58","slug":"project-7-curves","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/14\/project-7-curves\/","title":{"rendered":"Project 7 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>I connected mouseX and mouseY to the mapping of <em>t<\/em> to visualize the continuous movement of the curves and the larger shapes they create. It is interesting as you can watch it wind itself, giving a Spirograph effect. I then connected mouseX to <em>a <\/em>of the ranunculoid which affects the scaling from left to right. It is interesting how both <em>x<\/em> and<em> y<\/em> on the canvas determines the complexity of the shapes created. I also had fun experimenting with the different ways the shapes could be shown and decided to have the hypocycloid made of small squares.<\/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-112.js\" data-width=\"480\" data-height=\"480\">project7<\/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\">\/\/ Rachel Legg \/ rlegg \/ Section C\n\n\/\/# of point of each shape\nvar nPoints = 150;\n\nfunction setup() {\n    createCanvas(480, 480);\n    frameRate(10);\n}\n\nfunction draw() {\n    \/\/draw the ranunculoid & astroid curve\n    background(0, 38, 38);    \/\/dark green-blue\n    fill(255);\n    push();\n    translate(width\/2, height\/2);\n    fill(121, 33, 250);        \/\/purple\n    drawRanunculoid();\n    noFill();\n    drawHypocycloid();\n    scale(1\/12);\n    fill(105, 20, 235);        \/\/darker purple\n    drawRanunculoid();\n    pop();\n\n}\n\nfunction drawRanunculoid() {\n    \/\/Ranunculoid : https:\/\/mathworld.wolfram.com\/Ranunculoid.html\n\n    var x;\n    var y;\n\n    var a = 30;        \n\n    stroke(149, 198, 35);      \/\/green\n    strokeWeight(1);\n    beginShape();\n    for(var i = 0; i &lt; nPoints; i++) {\n        \/\/map points to mouseX & mouseY for continuous flow\n        var t = map(i, 0, nPoints, mouseX, mouseY); \n        a += mouseX \/ 500;                    \/\/scale when mouseX changes\n        \n        \/\/adjust to 7 to increase petals to 6\n        x = (a * (7 * cos(t) - cos(7 * t)));\n        y = (a * (7 * sin(t) - sin(7 * t)));\n        vertex(x, y);                           \/\/vertex gets spinograph effect\n        \/\/line(x - 5, y - 5, 10, 10);           \/\/visually different. shows lines to center\n\n    }\n    endShape(CLOSE);\n}\n\nfunction drawHypocycloid() {\n    \/\/https:\/\/mathworld.wolfram.com\/Hypocycloid.html\n\n    var x;\n    var y;\n    \n\n    var a = 110;        \n    var b = 30;\n\n    noFill();\n    stroke(212, 223, 158);     \/\/light green\n    strokeWeight(1);\n    for(var i = 0; i &lt; nPoints; i++){\n        \/\/map points to mouseX & mouseY for continuous change\n        var t = map(i, 0, nPoints, mouseX, mouseY);  \n\n        x = ((a - b) * cos(t)) - (b * cos(t * ((a - b) \/ b)));\n        y = ((a - b) * sin(t)) - (b * sin(t * ((a - b) \/ b)));\n        \/\/rectangle shapes to show patterns\n        rect(x - 5, y - 5, 10, 10);\n    }\n}\n\n\n\n\n\n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>I connected mouseX and mouseY to the mapping of t to visualize the continuous movement of the curves and the larger shapes they create. It is interesting as you can watch it wind itself, giving a Spirograph effect. I then connected mouseX to a of the ranunculoid which affects the scaling from left to right. &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/14\/project-7-curves\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 7 Curves&#8221;<\/span><\/a><\/p>\n","protected":false},"author":737,"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\/f2022\/wp-json\/wp\/v2\/posts\/74338"}],"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\/737"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74338"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74338\/revisions"}],"predecessor-version":[{"id":74343,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74338\/revisions\/74343"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}