{"id":19576,"date":"2018-01-22T22:11:54","date_gmt":"2018-01-23T03:11:54","guid":{"rendered":"http:\/\/blog.kenperlin.com\/?p=19576"},"modified":"2018-01-22T22:11:54","modified_gmt":"2018-01-23T03:11:54","slug":"cg-programming-for-non-programmers-lesson-20","status":"publish","type":"post","link":"http:\/\/blog.kenperlin.com\/?p=19576","title":{"rendered":"CG programming for non-programmers, lesson 20"},"content":{"rendered":"<p>In lesson 20 we finally move from 2D graphics to 3D graphics.  Specifically we go from flat disks to spheres.<\/p>\n<p>To do this we just use some high school math.  For a sphere of radius <code>r<\/code>, you probably learned in high school that for any point (x,y,z) on the sphere surface the following is true:<br \/>\n<code><br \/>\n&nbsp; &nbsp; &nbsp; x<sup>2<\/sup> + y<sup>2<\/sup> + z<sup>2<\/sup> = r<sup>2<\/sup><br \/>\n<\/code><\/p>\n<p>From there it is pretty easy to show that if you already know <code>x<\/code>,<code>y<\/code> and <code>r<\/code>, you can find <code>z<\/code> by:<br \/>\n<code><br \/>\n&nbsp; &nbsp; &nbsp; z = sqrt(r<sup>2<\/sup> - x<sup>2<\/sup> - y<sup>2<\/sup>)<br \/>\n<\/code><\/p>\n<p>We use this formula to create a sphere, which we will do cool things with in coming lessons.<\/p>\n<p>You can see this lesson by <a href=http:\/\/mrl.nyu.edu\/~perlin\/cg\/lesson20>CLICKING HERE<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In lesson 20 we finally move from 2D graphics to 3D graphics. Specifically we go from flat disks to spheres. To do this we just use some high school math. For a sphere of radius r, you probably learned in high school that for any point (x,y,z) on the sphere surface the following is true: &hellip; <a href=\"http:\/\/blog.kenperlin.com\/?p=19576\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;CG programming for non-programmers, lesson 20&#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\/19576"}],"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=19576"}],"version-history":[{"count":2,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/19576\/revisions"}],"predecessor-version":[{"id":19578,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/19576\/revisions\/19578"}],"wp:attachment":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19576"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}