{"id":22678,"date":"2015-07-02T18:45:30","date_gmt":"2015-07-02T18:45:30","guid":{"rendered":"http:\/\/ok-cleek.com\/blogs\/?p=22678"},"modified":"2015-07-02T19:09:07","modified_gmt":"2015-07-02T19:09:07","slug":"so-filling","status":"publish","type":"post","link":"https:\/\/ok-cleek.com\/blogs\/?p=22678","title":{"rendered":"So, Filling..."},"content":{"rendered":"<p><a href=\"https:\/\/ok-cleek.com\/blogs\/?p=22640\">Continuing with this<\/a>... (busy week at work! whew!)<\/p>\n<p>Instead of filling with boring old rectangles, what about filling with ellipses?<\/p>\n<p>First problem: it's just too much work to do the dividing and conquering with actual ellipses. There's no good way to recursively chop a rectangular image into successively smaller ellipses. So, I decided to just stick with the rectangles right up until the point where I go to fill them in. Then, I'll just draw an ellipse that covers what the rectangle covers. This is just an experiment. I can do what I want.<\/p>\n<p>So, given that we need each ellipse to cover, at least, the same area as the rectangle would have, is there a way to determine the optimal ellipse? That is: given a rectangle, how big is its proportional enclosing\u00a0ellipse? Beats me. Sounds like tough problem. But, <a href=\"http:\/\/stackoverflow.com\/questions\/433371\/ellipse-bounding-a-rectangle\">StackExchange<\/a> knew:<\/p>\n<p>A=RectWidth \/ &radic;2<br \/>\nB=RectHeight \/ &radic;2<\/p>\n<p><i>So<\/i> much simpler than I'd expected.<\/p>\n<p>So, here we go. Everything else is the same, except that I'm drawing ellipses instead of rectangles.<\/p>\n<p><a href=\"https:\/\/ok-cleek.com\/blogs\/wp-content\/uploads\/2015\/07\/ml_sz2_t100_ell.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22679\" src=\"https:\/\/ok-cleek.com\/blogs\/wp-content\/uploads\/2015\/07\/ml_sz2_t100_ell1.jpg\" alt=\"ml_sz2_t100_ell\" width=\"375\" height=\"537\" \/><\/a><\/p>\n<p>Hmm... Interesting. Looks like a lot of eggs. I don't like that the tops and lefts of the ellipses are all visible, but the bottoms and rights aren't. That's a consequence of the fact that the overall drawing and processing basically goes left to right, top to bottom. <\/p>\n<p>Can I change the order in which they're drawn? Yes.<\/p>\n<p>Instead of drawing ellipses as soon as they're calculated, I put them in a list. At the end I have a list of all the ellipses that would've been drawn. Then, sort that list by the area of each ellipse. And then, draw the sorted ellipses - biggest first. That way, the smaller ellipses will overlay the bigger ones. And that gives:<\/p>\n<p><a href=\"https:\/\/ok-cleek.com\/blogs\/wp-content\/uploads\/2015\/07\/ml_sz2_t100_ellSt.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22680\" src=\"https:\/\/ok-cleek.com\/blogs\/wp-content\/uploads\/2015\/07\/ml_sz2_t100_ellSt1.jpg\" alt=\"ml_sz2_t100_ellSt\" width=\"375\" height=\"537\" \/><\/a><\/p>\n<p>Better. There's variety in which parts of the ellipses are obscured. And, the ends of the really big ellipses along the left and right sides are covered up.<\/p>\n<p>With borders? Sure!<\/p>\n<p><a href=\"https:\/\/ok-cleek.com\/blogs\/wp-content\/uploads\/2015\/07\/ml_sz2_t100_ellStO.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22681\" src=\"https:\/\/ok-cleek.com\/blogs\/wp-content\/uploads\/2015\/07\/ml_sz2_t100_ellStO1.jpg\" alt=\"ml_sz2_t100_ellStO\" width=\"375\" height=\"537\" \/><\/a><\/p>\n<p>No fill, borders only?<\/p>\n<p><a href=\"https:\/\/ok-cleek.com\/blogs\/wp-content\/uploads\/2015\/07\/ml_sz2_t100_ellStNo.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22682\" src=\"https:\/\/ok-cleek.com\/blogs\/wp-content\/uploads\/2015\/07\/ml_sz2_t100_ellStNo1.jpg\" alt=\"ml_sz2_t100_ellStNo\" width=\"375\" height=\"537\" \/><\/a><\/p>\n<p>Sweeeeeeet.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continuing with this... (busy week at work! whew!) Instead of filling with boring old rectangles, what about filling with ellipses? First problem: it's just too much work to do the dividing and conquering with actual ellipses. There's no good way to recursively chop a rectangular image into successively smaller ellipses. So, I decided to just [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[],"class_list":["post-22678","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/22678","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22678"}],"version-history":[{"count":10,"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/22678\/revisions"}],"predecessor-version":[{"id":22696,"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/22678\/revisions\/22696"}],"wp:attachment":[{"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ok-cleek.com\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}