{"id":514,"date":"2010-05-12T08:32:36","date_gmt":"2010-05-12T15:32:36","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=2923"},"modified":"2010-05-12T08:32:36","modified_gmt":"2010-05-12T15:32:36","slug":"astroid-pedal-curve-variation","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=514","title":{"rendered":"Astroid Pedal Curve Variation"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nvar xp:Number = 0;\r\nvar yp:Number = 0;\r\nvar t:Number = 0;\r\nvar r:Number = 200;\r\nx = stage.stageWidth \/ 2;\r\ny = stage.stageHeight \/ 2;\r\n\r\ngraphics.lineStyle(0,0x000000);\r\naddEventListener(Event.ENTER_FRAME, onRun);\r\nfunction onRun(evt:Event):void {\r\n\tr = 200 * Math.cos(t \/ 10);\r\n\txp = r * Math.pow(Math.cos(t), 3);\r\n\typ = r * Math.pow(Math.sin(t), 3);\r\n\tif (t == 0){\r\n\t  graphics.moveTo(xp, yp);\r\n\t}else{\r\n\t  graphics.lineTo(xp, yp);\r\n\t}\r\n\tt += 0.1;\r\n}\r\n<\/pre>\n<p>While browsing mathworld I decided to do a variation on <a href=\"http:\/\/mathworld.wolfram.com\/AstroidPedalCurve.html\">this curve <\/a>. The above snippet will draw something like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/actionsnippet.com\/wp-content\/apedal.gif\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>var xp:Number = 0; var yp:Number = 0; var t:Number = 0; var r:Number = 200; x = stage.stageWidth \/ 2; y = stage.stageHeight \/ 2; graphics.lineStyle(0,0&#215;000000); addEventListener(Event.ENTER_FRAME, onRun); function onRun(evt:Event):void { r = 200 * Math.cos(t \/ 10); xp = r * Math.pow(Math.cos(t), 3); yp = r * Math.pow(Math.sin(t), 3); if (t == 0){ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[121,94],"tags":[3,14,4],"class_list":["post-514","post","type-post","status-publish","format-standard","hentry","category-math","category-misc","tag-actionscript","tag-as3","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=514"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/514\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}