{"id":74697,"date":"2022-10-16T23:21:21","date_gmt":"2022-10-17T03:21:21","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74697"},"modified":"2022-10-16T23:31:47","modified_gmt":"2022-10-17T03:31:47","slug":"project-7-curves-3","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/16\/project-7-curves-3\/","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>Abstract roses using astroids and astroid evolutes. Astroids rotate using mouseX and scale using the minimum of mouseX and mouse Y. Random astroids are added to the canvas. The color of these depends on the mouse&rsquo;s position on the canvas. If left on canvas they are red, and if on right of canvas they are black. Moving mouse along diagonals creates and in bottom right corner creates best shapes.<\/p>\n\n\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-Copy-Copy-Copy.js\" data-width=\"480\" data-height=\"480\">sketch &ndash; Copy &ndash; Copy &ndash; Copy<\/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\">\/\/ Ana Furtado \n\/\/ Section E\n\/\/ Project 7 Composition with Curves\n\nvar nPoints = 100;\n\nfunction setup() {\n    createCanvas(480, 480);\n    background(255);\n    frameRate(10);\n}\n\nfunction draw() {\n    \n    strokeWeight(3);\n\n    \/\/rotates and scales by mouse at top right\n    \/\/brown\/red at left and bottom\n    push();\n    translate(width\/4, height\/4);\n    scale(mouseX\/width);\n    rotate(radians(min(mouseX,mouseY)));\n    drawAstroid();\n    if (mouseX &lt; width\/2) {\n        stroke('brown'); \n        rotate(radians(min(mouseX,mouseY)));\n        drawAstroid();\n    } \n    pop();\n\n    \/\/rotates and scales by mouse at bottom left\n    \/\/brown\/red at left and bottom\n    push();\n    \/\/translate(width\/2, height\/2)\n    translate(width\/4 * 3, height\/4 * 3);\n    scale(mouseX\/width);\n    rotate(radians(min(mouseX,mouseY)));\n    drawAstroid();\n    if (mouseX &lt; width\/2) {\n        stroke('brown'); \n        rotate(radians(min(mouseX,mouseY)));\n        drawAstroid();\n    } if (mouseY &gt; height\/2) {\n        stroke('brown'); \n        rotate(radians(min(mouseX,mouseY)));\n        drawAstroid();\n    }\n    pop();\n\n    \/\/rotates and scales by mouse at random location \n    \/\/move\/leve mouse to left of canvas for red atroids \n    \/\/move\/leave mouse to right of canvas for black atroids \n    \/\/move\/leave in top right of canvas to fill with more black atroids\n    push();\n    translate(random(0,480), random(0,480));\n    scale(0.5);\n    rotate(radians(min(mouseX,mouseY)));\n    drawAstroid();\n    if ( mouseX &lt; width\/2) {\n        stroke('brown'); \n        rotate(radians(min(mouseX,mouseY)));\n        drawAstroid();\n    }\n    pop();\n\n    \n\n    \/\/originals that stay in  splace\n    \/\/only show in beginning\n    \/\/scaled and rotated turns the astroid into an atroid evolute\n    push();\n    translate(width\/2, height\/2);\n    drawAstroid();\n    pop();\n\n    \/\/stays in place scale 0.5\n    push();\n    translate(width\/2, height\/2);\n    scale(0.5);\n    rotate(radians(45));\n    drawAstroid();\n    pop();\n\n    \/\/stays in place scale 0.25\n    push();\n    translate(width\/2, height\/2);\n    scale(0.25);\n    rotate(radians(45));\n    drawAstroid();\n    pop();\n\n}\n\nfunction drawAstroid() {\n    \/\/Astroid\n    \/\/https:\/\/mathworld.wolfram.com\/AstroidEvolute.html\n\n    var x;\n    var y;\n    var a = 300;\n\n    \/\/fill('pink');\n    noFill();\n    beginShape();\n    for (var i = 0; i &lt; nPoints; i++) {\n        var t = map(i, 0, nPoints, 0, TWO_PI);\n        \/\/angleMode(DEGREES);\n        x = a * (cos(t) * cos(t) * cos(t));\n        y = a * (sin(t) * sin(t) * sin(t));\n        vertex(x, y);\n    }\n    endShape(CLOSE);\n    constrain(a, 0, 325);\n}\n\n<\/code><\/pre><\/div>\n\n\n<p>I think the most difficult part of this was getting the shape to be represented properly. <\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Abstract roses using astroids and astroid evolutes. Astroids rotate using mouseX and scale using the minimum of mouseX and mouse Y. Random astroids are added to the canvas. The color of these depends on the mouse&rsquo;s position on the canvas. If left on canvas they are red, and if on right of canvas they are &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/16\/project-7-curves-3\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 7: Curves&#8221;<\/span><\/a><\/p>\n","protected":false},"author":749,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[108,121],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74697"}],"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\/749"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74697"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74697\/revisions"}],"predecessor-version":[{"id":74702,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74697\/revisions\/74702"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}