{"id":217,"date":"2015-06-19T13:53:32","date_gmt":"2015-06-19T09:53:32","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=217"},"modified":"2015-06-19T15:09:43","modified_gmt":"2015-06-19T11:09:43","slug":"exercise-45","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/exercise-45\/","title":{"rendered":"Exercise 45"},"content":{"rendered":"<p>using rotation and sine cosine functions to draw patterns.<\/p>\n<pre><code>\r\nfloat k = 2\/7.0;\r\nint scaleIt = 400;\r\n\r\nvoid setup() {\r\n  size(800, 800);\r\n  background(20);\r\n  colorMode(HSB);\r\n  strokeWeight(0.01);\r\n  smooth();\r\n}\r\n\r\nvoid draw() {\r\n  translate(width\/2, height\/2);\r\n  \/\/scale(width\/2, height\/2);\r\n  float t = frameCount \/ 20.0;\r\n  float x = cos(k*t) * sin(t) * scaleIt;\r\n  float y = cos(k*t) * cos(t) * scaleIt; \r\n  stroke(255);\r\n  line(0, 0, x, y);\r\n}\r\n<\/code><\/pre>\n<p>The chart below shows the results of different parameters, from the wikipedia <a href=\"https:\/\/en.wikipedia.org\/wiki\/Rose_(mathematics)\">page on the rose formula<\/a>.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/courses.haigarmen.com\/creativecoding\/files\/2015\/06\/Rose-rhodonea-curve-7x9-chart.png\" alt=\"Rose-rhodonea-curve-7x9-chart\" width=\"452\" height=\"582\" class=\"alignnone size-full wp-image-222\" srcset=\"https:\/\/courses.haigarmen.com\/creativecoding\/files\/2015\/06\/Rose-rhodonea-curve-7x9-chart.png 452w, https:\/\/courses.haigarmen.com\/creativecoding\/files\/2015\/06\/Rose-rhodonea-curve-7x9-chart-233x300.png 233w\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>using rotation and sine cosine functions to draw patterns. float k = 2\/7.0; int scaleIt = 400; void setup() { size(800, 800); background(20); colorMode(HSB); strokeWeight(0.01); smooth(); } void draw() { translate(width\/2, height\/2); \/\/scale(width\/2, height\/2); float t = frameCount \/ 20.0; float x = cos(k*t) * sin(t) * scaleIt; float y = cos(k*t) * cos(t) * [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-217","post","type-post","status-publish","format-standard","hentry","category-lessons"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/comments?post=217"}],"version-history":[{"count":6,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/217\/revisions"}],"predecessor-version":[{"id":224,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/217\/revisions\/224"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}