{"action":"opened","number":130,"pull_request":{"url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls/130","id":83994822,"html_url":"https://github.com/IfcOpenShell/IfcOpenShell/pull/130","diff_url":"https://github.com/IfcOpenShell/IfcOpenShell/pull/130.diff","patch_url":"https://github.com/IfcOpenShell/IfcOpenShell/pull/130.patch","issue_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/issues/130","number":130,"state":"open","locked":false,"title":"Spatial Querying: Implementation of BVH tree for IFC files using NCollection_UBTree","user":{"login":"aothms","id":1096535,"avatar_url":"https://avatars.githubusercontent.com/u/1096535?v=3","gravatar_id":"","url":"https://api.github.com/users/aothms","html_url":"https://github.com/aothms","followers_url":"https://api.github.com/users/aothms/followers","following_url":"https://api.github.com/users/aothms/following{/other_user}","gists_url":"https://api.github.com/users/aothms/gists{/gist_id}","starred_url":"https://api.github.com/users/aothms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aothms/subscriptions","organizations_url":"https://api.github.com/users/aothms/orgs","repos_url":"https://api.github.com/users/aothms/repos","events_url":"https://api.github.com/users/aothms/events{/privacy}","received_events_url":"https://api.github.com/users/aothms/received_events","type":"User","site_admin":false},"body":"# Rationale\r\nBy arranging the bounding volumes into a bounding volume hierarchy, the time complexity (the number of tests performed) can be reduced to logarithmic in the number of objects. With such a hierarchy in place, during collision testing, children volumes do not have to be examined if their parent volumes are not intersected. From [wikipedia](https://en.wikipedia.org/wiki/Bounding_volume_hierarchy).\r\n\r\n#### Bounding box intersection: 0.000 seconds\r\n![Bounding box intersection](https://cloud.githubusercontent.com/assets/1096535/18247480/1fc1c2a6-7373-11e6-8723-b42014385312.png)\r\n#### Solid volume containment: 0.597 seconds\r\n![Solid volume containment](https://cloud.githubusercontent.com/assets/1096535/18247481/1fc34040-7373-11e6-9c64-67d90264c7fd.png)\r\n\r\n# API\r\n\r\n### Python\r\n\r\n~~~\r\nfn = \"Duplex_A_20110907_optimized.ifc\"\r\nf = ifcopenshell.open(fn)\r\nwall = f[\"2O2Fr$t4X7Zf8NOew3FLPP\"]\r\n\r\ntree_settings = ifcopenshell.geom.settings()\r\ntree_settings.set(tree_settings.DISABLE_OPENING_SUBTRACTIONS, True)\r\nifcopenshell.geom.tree(f, tree_settings)\r\n\r\nprint(\"Intersecting with wall 2O2Fr$t4X7Zf8NOew3FLPP\")\r\nprint(t.select(wall))\r\n\r\nprint(\"Contained within wall 2O2Fr$t4X7Zf8NOew3FLPP\")\r\nprint(t.select(wall, completely_within=True))\r\n\r\nprint(\"Intersecting with bounding box wall 2O2Fr$t4X7Zf8NOew3FLPP\")\r\nprint(t.select_box(wall))\r\n\r\nprint(\"Surrounding bounding box wall 2O2Fr$t4X7Zf8NOew3FLPP\")\r\nprint(t.select_box(wall, extend=1.))\r\n\r\nprint(\"Contained within bounding box wall 2O2Fr$t4X7Zf8NOew3FLPP\")\r\nprint(t.select_box(wall, extend=0.001, completely_within=True))\r\n\r\nprint(\"Containing point (0,0,0)\")\r\nprint(t.select((0.,0.,0.)))\r\n\r\nprint(\"Intersecting with (-1,-1,-1) -> (1,1,1)\")\r\nprint(t.select_box(((-1.,-1.,-1.),(1.,1.,1.))))\r\n\r\nprint(\"Contained within (-2,-2,-2) -> (10,10,10)\")\r\nprint(t.select_box(((-2.,-2.,-2.),(10.,10.,10.)), completely_within=True))\r\n~~~\r\n\r\n### C++\r\n\r\n~~~\r\nIfcParse::IfcFile f;\r\nf.Init(\"Duplex_A_20110907_optimized.ifc\");\r\n\r\nIfcGeom::IteratorSettings settings;\r\nsettings.set(IfcGeom::IteratorSettings::DISABLE_OPENING_SUBTRACTIONS, true);\r\n\r\nIfcGeom::tree tree(f, settings);\r\n\r\nIfcSchema::IfcWallStandardCase* wall = f.entityByGuid(\"2O2Fr$t4X7Zf8NOew3FLPP\")->as<IfcSchema::IfcWallStandardCase>();\r\n\r\nstd::cout << \"Intersecting with wall 2O2Fr$t4X7Zf8NOew3FLPP\" << std::endl;\r\nstd::vector<IfcSchema::IfcProduct*> contained = tree.select(wall);\r\n~~~\r\n\r\n# Implementation\r\nOpen Cascade [NCollection_UBTree](https://www.opencascade.com/doc/occt-6.9.1/refman/html/class_n_collection___u_b_tree_1_1_tree_node.html)\r\n\r\n# Performance\r\nNothing conclusive, querying times for bounding boxes below timer resolution for small-medium sized models. Tree construction + geometry generation linearithmic (?).\r\n\r\n![treestats](https://cloud.githubusercontent.com/assets/1096535/18247561/8f64dcf6-7373-11e6-9299-631748b53ce6.png)\r\n\r\n","created_at":"2016-09-05T12:27:25Z","updated_at":"2016-09-05T12:27:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b29a2f575abc12ec9dc677da43b62090e571c19b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls/130/commits","review_comments_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls/130/comments","review_comment_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/issues/130/comments","statuses_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/statuses/5bc211e250b5c0f9fb42cecf1eaae63d4f07aa39","head":{"label":"aothms:bvh_tree","ref":"bvh_tree","sha":"5bc211e250b5c0f9fb42cecf1eaae63d4f07aa39","user":{"login":"aothms","id":1096535,"avatar_url":"https://avatars.githubusercontent.com/u/1096535?v=3","gravatar_id":"","url":"https://api.github.com/users/aothms","html_url":"https://github.com/aothms","followers_url":"https://api.github.com/users/aothms/followers","following_url":"https://api.github.com/users/aothms/following{/other_user}","gists_url":"https://api.github.com/users/aothms/gists{/gist_id}","starred_url":"https://api.github.com/users/aothms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aothms/subscriptions","organizations_url":"https://api.github.com/users/aothms/orgs","repos_url":"https://api.github.com/users/aothms/repos","events_url":"https://api.github.com/users/aothms/events{/privacy}","received_events_url":"https://api.github.com/users/aothms/received_events","type":"User","site_admin":false},"repo":{"id":40475450,"name":"IfcOpenShell","full_name":"aothms/IfcOpenShell","owner":{"login":"aothms","id":1096535,"avatar_url":"https://avatars.githubusercontent.com/u/1096535?v=3","gravatar_id":"","url":"https://api.github.com/users/aothms","html_url":"https://github.com/aothms","followers_url":"https://api.github.com/users/aothms/followers","following_url":"https://api.github.com/users/aothms/following{/other_user}","gists_url":"https://api.github.com/users/aothms/gists{/gist_id}","starred_url":"https://api.github.com/users/aothms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aothms/subscriptions","organizations_url":"https://api.github.com/users/aothms/orgs","repos_url":"https://api.github.com/users/aothms/repos","events_url":"https://api.github.com/users/aothms/events{/privacy}","received_events_url":"https://api.github.com/users/aothms/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aothms/IfcOpenShell","description":"Open source IFC library and geometry engine","fork":true,"url":"https://api.github.com/repos/aothms/IfcOpenShell","forks_url":"https://api.github.com/repos/aothms/IfcOpenShell/forks","keys_url":"https://api.github.com/repos/aothms/IfcOpenShell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aothms/IfcOpenShell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aothms/IfcOpenShell/teams","hooks_url":"https://api.github.com/repos/aothms/IfcOpenShell/hooks","issue_events_url":"https://api.github.com/repos/aothms/IfcOpenShell/issues/events{/number}","events_url":"https://api.github.com/repos/aothms/IfcOpenShell/events","assignees_url":"https://api.github.com/repos/aothms/IfcOpenShell/assignees{/user}","branches_url":"https://api.github.com/repos/aothms/IfcOpenShell/branches{/branch}","tags_url":"https://api.github.com/repos/aothms/IfcOpenShell/tags","blobs_url":"https://api.github.com/repos/aothms/IfcOpenShell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aothms/IfcOpenShell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aothms/IfcOpenShell/git/refs{/sha}","trees_url":"https://api.github.com/repos/aothms/IfcOpenShell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aothms/IfcOpenShell/statuses/{sha}","languages_url":"https://api.github.com/repos/aothms/IfcOpenShell/languages","stargazers_url":"https://api.github.com/repos/aothms/IfcOpenShell/stargazers","contributors_url":"https://api.github.com/repos/aothms/IfcOpenShell/contributors","subscribers_url":"https://api.github.com/repos/aothms/IfcOpenShell/subscribers","subscription_url":"https://api.github.com/repos/aothms/IfcOpenShell/subscription","commits_url":"https://api.github.com/repos/aothms/IfcOpenShell/commits{/sha}","git_commits_url":"https://api.github.com/repos/aothms/IfcOpenShell/git/commits{/sha}","comments_url":"https://api.github.com/repos/aothms/IfcOpenShell/comments{/number}","issue_comment_url":"https://api.github.com/repos/aothms/IfcOpenShell/issues/comments{/number}","contents_url":"https://api.github.com/repos/aothms/IfcOpenShell/contents/{+path}","compare_url":"https://api.github.com/repos/aothms/IfcOpenShell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aothms/IfcOpenShell/merges","archive_url":"https://api.github.com/repos/aothms/IfcOpenShell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aothms/IfcOpenShell/downloads","issues_url":"https://api.github.com/repos/aothms/IfcOpenShell/issues{/number}","pulls_url":"https://api.github.com/repos/aothms/IfcOpenShell/pulls{/number}","milestones_url":"https://api.github.com/repos/aothms/IfcOpenShell/milestones{/number}","notifications_url":"https://api.github.com/repos/aothms/IfcOpenShell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aothms/IfcOpenShell/labels{/name}","releases_url":"https://api.github.com/repos/aothms/IfcOpenShell/releases{/id}","deployments_url":"https://api.github.com/repos/aothms/IfcOpenShell/deployments","created_at":"2015-08-10T09:51:58Z","updated_at":"2016-06-20T09:20:54Z","pushed_at":"2016-09-05T12:13:48Z","git_url":"git://github.com/aothms/IfcOpenShell.git","ssh_url":"git@github.com:aothms/IfcOpenShell.git","clone_url":"https://github.com/aothms/IfcOpenShell.git","svn_url":"https://github.com/aothms/IfcOpenShell","homepage":null,"size":14041,"stargazers_count":6,"watchers_count":6,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":6,"default_branch":"master"}},"base":{"label":"IfcOpenShell:master","ref":"master","sha":"8efd9757b75744d06ce2e82f0a0a533c3ffe295a","user":{"login":"IfcOpenShell","id":13692563,"avatar_url":"https://avatars.githubusercontent.com/u/13692563?v=3","gravatar_id":"","url":"https://api.github.com/users/IfcOpenShell","html_url":"https://github.com/IfcOpenShell","followers_url":"https://api.github.com/users/IfcOpenShell/followers","following_url":"https://api.github.com/users/IfcOpenShell/following{/other_user}","gists_url":"https://api.github.com/users/IfcOpenShell/gists{/gist_id}","starred_url":"https://api.github.com/users/IfcOpenShell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IfcOpenShell/subscriptions","organizations_url":"https://api.github.com/users/IfcOpenShell/orgs","repos_url":"https://api.github.com/users/IfcOpenShell/repos","events_url":"https://api.github.com/users/IfcOpenShell/events{/privacy}","received_events_url":"https://api.github.com/users/IfcOpenShell/received_events","type":"Organization","site_admin":false},"repo":{"id":40473201,"name":"IfcOpenShell","full_name":"IfcOpenShell/IfcOpenShell","owner":{"login":"IfcOpenShell","id":13692563,"avatar_url":"https://avatars.githubusercontent.com/u/13692563?v=3","gravatar_id":"","url":"https://api.github.com/users/IfcOpenShell","html_url":"https://github.com/IfcOpenShell","followers_url":"https://api.github.com/users/IfcOpenShell/followers","following_url":"https://api.github.com/users/IfcOpenShell/following{/other_user}","gists_url":"https://api.github.com/users/IfcOpenShell/gists{/gist_id}","starred_url":"https://api.github.com/users/IfcOpenShell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IfcOpenShell/subscriptions","organizations_url":"https://api.github.com/users/IfcOpenShell/orgs","repos_url":"https://api.github.com/users/IfcOpenShell/repos","events_url":"https://api.github.com/users/IfcOpenShell/events{/privacy}","received_events_url":"https://api.github.com/users/IfcOpenShell/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IfcOpenShell/IfcOpenShell","description":"Open source IFC library and geometry engine","fork":false,"url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell","forks_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/forks","keys_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/teams","hooks_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/hooks","issue_events_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/issues/events{/number}","events_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/events","assignees_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/assignees{/user}","branches_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/branches{/branch}","tags_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/tags","blobs_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/git/refs{/sha}","trees_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/statuses/{sha}","languages_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/languages","stargazers_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/stargazers","contributors_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/contributors","subscribers_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/subscribers","subscription_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/subscription","commits_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/commits{/sha}","git_commits_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/git/commits{/sha}","comments_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/comments{/number}","issue_comment_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/issues/comments{/number}","contents_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/contents/{+path}","compare_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/merges","archive_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/downloads","issues_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/issues{/number}","pulls_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls{/number}","milestones_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/milestones{/number}","notifications_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/labels{/name}","releases_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/releases{/id}","deployments_url":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/deployments","created_at":"2015-08-10T09:03:14Z","updated_at":"2016-08-31T05:23:20Z","pushed_at":"2016-09-05T12:27:25Z","git_url":"git://github.com/IfcOpenShell/IfcOpenShell.git","ssh_url":"git@github.com:IfcOpenShell/IfcOpenShell.git","clone_url":"https://github.com/IfcOpenShell/IfcOpenShell.git","svn_url":"https://github.com/IfcOpenShell/IfcOpenShell","homepage":null,"size":13989,"stargazers_count":37,"watchers_count":37,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":32,"forks":38,"open_issues":32,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls/130"},"html":{"href":"https://github.com/IfcOpenShell/IfcOpenShell/pull/130"},"issue":{"href":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/issues/130"},"comments":{"href":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/issues/130/comments"},"review_comments":{"href":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls/130/comments"},"review_comment":{"href":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/pulls/130/commits"},"statuses":{"href":"https://api.github.com/repos/IfcOpenShell/IfcOpenShell/statuses/5bc211e250b5c0f9fb42cecf1eaae63d4f07aa39"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":376,"deletions":13,"changed_files":8}}
{"actor":{"display_login":"aothms"}}