{"id":1398,"date":"2014-02-05T10:54:19","date_gmt":"2014-02-05T10:54:19","guid":{"rendered":"http:\/\/www.geoplanit.co.uk\/?p=1398"},"modified":"2014-02-05T10:56:09","modified_gmt":"2014-02-05T10:56:09","slug":"the-occlusion-theory","status":"publish","type":"post","link":"https:\/\/www.geoplanit.co.uk\/?p=1398","title":{"rendered":"The Occlusion Theory &#8211; Is one geometry touching another?"},"content":{"rendered":"<p>It&#8217;s been a while but I&#8217;ve come back to CityEngine and have been experimenting with Occlusion queries, basically it tests to see whether a shape lies inside, overlaps or touches geometry of another shape.<\/p>\n<p>I&#8217;m finding it a little tricky to get my head around, most things in CityEngine are assessed very quickly and dynamically, but not this occlusion thing.<\/p>\n<p>Here&#8217;s a video which may explain it better, basically as one shape is moved the rule assesses when it is touching another shape, expect it doesn&#8217;t always work first time&#8230;.<\/p>\n<p><iframe loading=\"lazy\" src=\"\/\/www.youtube.com\/embed\/NSSTB4C35l4?rel=0\" height=\"360\" width=\"480\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p>For those interested here is the CGA code (yes I have looked at this as a way of analysing shapes\/buildings that are affected by flooding. \u00a0Somewhat topical in the UK this week I think:<\/p>\n<p>&nbsp;<\/p>\n<pre>attr flood_height = 10\r\nattr building_height = 10\r\n\r\nattr buildingColor = \"#ffffff\"\r\nattr floodColor = \"#0000ff\"\r\nattr waterOpacity = 0.5\r\nFlood--&gt;\r\n\textrude(flood_height)\r\n\tcomp(f){top :water}\r\n\r\nBuilding--&gt;\r\n\textrude(flood_height)\r\n\tcomp(f){side :wall}\r\n\r\nwater--&gt;\r\n\tcase touches(inter):\tcolor(floodColor) x\r\n\telse : set(material.opacity, waterOpacity) color(floodColor) x\t\t\r\n\r\nwall--&gt;\r\n\tcase touches(inter):\tcolor(\"#ff0000\") x\r\n\telse : color(buildingColor) x<\/pre>\n<p><strong>Suggestions and improvements would be welcome!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been a while but I&#8217;ve come back to CityEngine and have been experimenting with Occlusion queries, basically it tests to see whether a shape lies inside, overlaps or touches geometry of another shape. I&#8217;m finding it a little tricky to get my head around, most things in CityEngine are assessed very quickly and dynamically, [&hellip;]<\/p>\n","protected":false},"author":161,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[245,145,231,246,54,9],"tags":[],"class_list":["post-1398","post","type-post","status-publish","format-standard","category-cga","category-cityengine","category-code","category-rule","category-tips","category-workflow"],"_links":{"self":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/users\/161"}],"replies":[{"embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1398"}],"version-history":[{"count":3,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1398\/revisions"}],"predecessor-version":[{"id":1401,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1398\/revisions\/1401"}],"wp:attachment":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}