{"id":67775,"date":"2021-10-16T21:14:48","date_gmt":"2021-10-17T01:14:48","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=67775"},"modified":"2021-10-16T21:14:48","modified_gmt":"2021-10-17T01:14:48","slug":"project-07-composition-with-curves-4","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/16\/project-07-composition-with-curves-4\/","title":{"rendered":"Project-07: Composition with 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><div class=\"wp-block-file\"><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-104.js\">Composition Curves<\/a><a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/sketch-104.js\" class=\"wp-block-file__button\" download>Download<\/a><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\">\/*Name:Camellia(Siyun) Wang; \nSection: C; \nEmail Address: siyunw@andrew.cmu.edu;*\/\n\n\nfunction setup() {\n    createCanvas(480, 480);\n\n    nPoints = 100;\n}\n\n\nfunction draw() {\n    background(245,222,179);\n    push();\n    translate(width \/ 2, height \/ 2);\n    drawBulletnose();\n    pop();\n}\n\nfunction drawBulletnose(){\n    var x;\n    var y;\n    var a = constrain(mouseX \/ 2,0,200);\n    var b = constrain(mouseY \/ 2,0,200);\n\n    stroke(240,248,255);\n    strokeWeight(5);\n    fill(230,230,250);\n    beginShape();\n    for(var i = 1; i &lt; nPoints; i++){\n        var t  = map(i,0,nPoints,0,PI);\n        \/\/Bullet Nose\n        x = a * cos(t);\n        y = b * (1\/tan(t));\n        vertex(x,y);\n    }\n    for(var i = 1; i &lt; nPoints; i++){\n        var t  = map(i,0,nPoints,0,PI);\n        \/\/Bullet Nose\n        x = -a * cos(t);\n        y = b * (1\/tan(t));\n        vertex(x,y);\n    }\n    endShape();\n\n\n}\n   \n<\/code><\/pre><\/div>\n\n\n<p>When doing this assignment, I first browse through the given curve website to see which curve I am most interested in and can possibly create variation in it. When I chose to do the Bullet Nose, I looked at its x and y equation, then realized that to create variation of this form, I need to change t, a, and b. That&rsquo;s why in my code, I defined a and b first in the draw function, and then defined t in the for loop to draw the shape. Then I set the a and b to be manipulated by mouseX and mouseY.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"962\" height=\"964\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.37-PM.png\" alt=\"\" class=\"wp-image-67786\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.37-PM.png 962w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.37-PM-300x300.png 300w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.37-PM-150x150.png 150w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.37-PM-768x770.png 768w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\"><figcaption>Bullet Nose 1: Largest MouseX and mouseY<\/figcaption><\/figure><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"962\" height=\"960\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.59-PM.png\" alt=\"\" class=\"wp-image-67788\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.59-PM.png 962w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.59-PM-300x300.png 300w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.59-PM-150x150.png 150w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-16-at-9.10.59-PM-768x766.png 768w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\"><figcaption>Bullet Nose 2: mouseX smaller, mouseY smaller<\/figcaption><\/figure><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Composition CurvesDownload \/*Name:Camellia(Siyun) Wang; Section: C; Email Address: siyunw@andrew.cmu.edu;*\/ function setup() { createCanvas(480, 480); nPoints = 100; } function draw() { background(245,222,179); push(); translate(width \/ 2, height \/ 2); drawBulletnose(); pop(); } function drawBulletnose(){ var x; var y; var a = constrain(mouseX \/ 2,0,200); var b = constrain(mouseY \/ 2,0,200); stroke(240,248,255); strokeWeight(5); fill(230,230,250); beginShape(); for(var &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/16\/project-07-composition-with-curves-4\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project-07: Composition with Curves&#8221;<\/span><\/a><\/p>\n","protected":false},"author":676,"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\/67775"}],"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\/676"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=67775"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67775\/revisions"}],"predecessor-version":[{"id":67789,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67775\/revisions\/67789"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=67775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=67775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=67775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}