{"id":1370,"date":"2013-12-20T11:39:29","date_gmt":"2013-12-20T11:39:29","guid":{"rendered":"http:\/\/www.geoplanit.co.uk\/?p=1370"},"modified":"2013-12-20T11:39:29","modified_gmt":"2013-12-20T11:39:29","slug":"cityengine-security-camera-demo-video-cga-code","status":"publish","type":"post","link":"https:\/\/www.geoplanit.co.uk\/?p=1370","title":{"rendered":"CityEngine Security Camera Demo &#8211; Video &#038; CGA Code"},"content":{"rendered":"<p>I saw the CityEngine webinar yesterday on <a href=\"http:\/\/www.youtube.com\/watch?v=oV732FA0L-s&amp;feature=youtu.be\">&#8220;3D Cities for Safety and Security&#8221; \u00a0<\/a>\u00a0and got inspired by their security camera rule, I thought I could do that quite quickly so came up with this:<\/p>\n<p><iframe loading=\"lazy\" src=\"\/\/www.youtube.com\/embed\/rLg0JKb4Hx4?rel=0\" height=\"480\" width=\"640\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><\/p>\n<p>Here&#8217;s the code for those that like this sort of thing (it&#8217;s not carefully commented by feel free to modify and share) I&#8217;m aware the CityEngine team have something much more sophisticated but for 5 minutes coding I think it&#8217;s quite nice:<\/p>\n<p>&nbsp;<\/p>\n<pre>\/**\r\n * File:    camera.cga\r\n * Created: 19 Dec 2013 16:18:39 GMT\r\n * Author:  EHartley\r\n *\/\r\n\r\nversion \"2013.1\"\r\n\r\n@Color\r\nattr cameraColor = \"#ff00ff\"\r\n@Range(0,1)\r\nattr cameraTransparency = 0.5\t\r\n@Range(0,360)\r\nattr cameraRotate =0\r\n@Range(0,360)\r\nattr cameraAngle =0\r\n@Range(0,1000)\r\nattr cameraDistance =20\r\n@Range(0,100)\r\nattr cameraHeight = 2.5\r\n@Range(0,100)\r\nattr cameraH = 64\r\n@Range(0,100)\r\nattr cameraW = 48\r\npyramid = \"assets\/pyramid.dae\"\r\n\r\n@StartRule\r\nbox--&gt;\r\n\tcolor(cameraColor) set(material.opacity,cameraTransparency)\r\n\t\/\/extrude(cameraHeight)\r\n\ti(\"builtin:cube\")\r\n\ts(cameraH,cameraHeight,cameraW)\r\n\tcenter(xyz)\r\n\tcomp(f) { top : camera | all : NIL}\r\n\r\ncamera--&gt;\r\n\t\/\/reverseNormals\r\n\troofPyramid(30) s('1,cameraDistance,'1)\r\n\tr(0,cameraAngle,cameraRotate)\r\n\tcenter(xyz)\r\n\tt(0,-cameraDistance\/2,0)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I saw the CityEngine webinar yesterday on &#8220;3D Cities for Safety and Security&#8221; \u00a0\u00a0and got inspired by their security camera rule, I thought I could do that quite quickly so came up with this: Here&#8217;s the code for those that like this sort of thing (it&#8217;s not carefully commented by feel free to modify and [&hellip;]<\/p>\n","protected":false},"author":161,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"tdm_status":"","tdm_grid_status":"","footnotes":""},"categories":[93,12,116,145,231,7,54,133,9],"tags":[],"class_list":["post-1370","post","type-post","status-publish","format-standard","category-3d","category-arcgis","category-city-creation","category-cityengine","category-code","category-gis","category-tips","category-video","category-workflow"],"_links":{"self":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1370","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=1370"}],"version-history":[{"count":1,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1370\/revisions"}],"predecessor-version":[{"id":1371,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1370\/revisions\/1371"}],"wp:attachment":[{"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.geoplanit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}