{"id":23914,"date":"2021-12-13T19:59:11","date_gmt":"2021-12-14T00:59:11","guid":{"rendered":"http:\/\/blog.kenperlin.com\/?p=23914"},"modified":"2021-12-13T21:03:27","modified_gmt":"2021-12-14T02:03:27","slug":"monte-carlo","status":"publish","type":"post","link":"http:\/\/blog.kenperlin.com\/?p=23914","title":{"rendered":"Monte Carlo stars"},"content":{"rendered":"<p>The first time I ever implemented a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Monte_Carlo_method\">Monte Carlo method<\/a> was at the very start of my career in computer graphics. The company I was working for, MAGI, needed a star field for a TV commercial.<\/p>\n<p>So I generated lots and lots of points inside a cube, using a random number generator to produce (x,y,z) coordinates. Then I discarded all of the points that were outside of a sphere that fit snugly inside the cube.<\/p>\n<p>I then pushed all of the remaining points out to the surface of the sphere. <i>Voila<\/i>, stars.<\/p>\n<p>But then the head of CGI told me that he needed more stars in the sky. So I just made lots of copies of my star field.<\/p>\n<p>Everywhere I had put a star, I placed a copy of the entire star field in miniature, centered on that location. By making those clusters bigger or smaller, I could tune how &#8220;clumpy&#8221; the star field looked.<\/p>\n<p>Then he was happy. The spot aired on TV with my beautiful star field. And then I was happy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The first time I ever implemented a Monte Carlo method was at the very start of my career in computer graphics. The company I was working for, MAGI, needed a star field for a TV commercial. So I generated lots and lots of points inside a cube, using a random number generator to produce (x,y,z) &hellip; <a href=\"http:\/\/blog.kenperlin.com\/?p=23914\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Monte Carlo stars&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/23914"}],"collection":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23914"}],"version-history":[{"count":4,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/23914\/revisions"}],"predecessor-version":[{"id":23918,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/23914\/revisions\/23918"}],"wp:attachment":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23914"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}