{"action":"created","comment":{"url":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/comments/219711788","pull_request_review_id":157952045,"id":219711788,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTcxMTc4OA==","diff_hunk":"@@ -0,0 +1,477 @@\n+/*\n+ * Copyright 2013 MovingBlocks\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.terasology.math.geom;\n+\n+import com.google.common.base.Objects;\n+import gnu.trove.list.TFloatList;\n+\n+import java.util.ArrayList;\n+import java.util.Iterator;\n+import java.util.List;\n+\n+/**\n+ * An axis-aligned bounding box. Provides basic support for inclusion\n+ * and intersection tests.\n+ *\n+ */\n+public final class AABB {\n+\n+    public static final float DEFAULT_MARGIN = 0.01f;\n+    public static final float HALVING_FACTOR = 0.5f;\n+    private final Vector3f min;\n+    private final Vector3f max;\n+\n+    private Vector3f[] vertices;\n+\n+    private AABB(Vector3f min, Vector3f max) {\n+        this.min = min;\n+        this.max = max;\n+    }\n+\n+    public static AABB createMinMax(Vector3f min, Vector3f max) {\n+        return new AABB(new Vector3f(min), new Vector3f(max));\n+    }\n+\n+    public static AABB createCenterExtent(Vector3f center, Vector3f extent) {\n+        Vector3f min = new Vector3f(center);\n+        min.sub(extent);\n+        Vector3f max = new Vector3f(center);\n+        max.add(extent);\n+        return new AABB(min, max);\n+    }\n+\n+    public static AABB createEmpty() {\n+        return new AABB(new Vector3f(), new Vector3f());\n+    }\n+\n+    /**\n+     * Creates a new AABB that encapsulates a set of AABBs\n+     *\n+     * @param others\n+     */\n+    public static AABB createEncompassing(Iterable<AABB> others) {\n+        Vector3f min;\n+        Vector3f max;\n+        Iterator<AABB> i = others.iterator();\n+        if (i.hasNext()) {\n+            AABB next = i.next();\n+            min = next.getMin();\n+            max = next.getMax();\n+        } else {\n+            return createEmpty();\n+        }\n+        while (i.hasNext()) {\n+            AABB next = i.next();\n+            Vector3f otherMin = next.getMin();\n+            Vector3f otherMax = next.getMax();\n+            min.min(otherMin);\n+            max.max(otherMax);\n+        }\n+        return new AABB(min, max);\n+    }\n+\n+    public static AABB createEncompasing(TFloatList vertices) {\n+        int vertexCount = vertices.size() / 3;\n+        if (vertexCount == 0) {\n+            return AABB.createEmpty();\n+        }\n+\n+        Vector3f min = new Vector3f(vertices.get(0), vertices.get(1), vertices.get(2));\n+        Vector3f max = new Vector3f(vertices.get(0), vertices.get(1), vertices.get(2));\n+        for (int index = 1; index < vertexCount; ++index) {\n+            min.x = Math.min(min.x, vertices.get(3 * index));\n+            max.x = Math.max(max.x, vertices.get(3 * index));\n+            min.y = Math.min(min.y, vertices.get(3 * index + 1));\n+            max.y = Math.max(max.y, vertices.get(3 * index + 1));\n+            min.z = Math.min(min.z, vertices.get(3 * index + 2));\n+            max.z = Math.max(max.z, vertices.get(3 * index + 2));\n+        }\n+        return AABB.createMinMax(min, max);\n+    }\n+\n+    /**\n+     * @return The distance from the center to the max node\n+     */\n+    public Vector3f getExtents() {\n+        Vector3f dimensions = new Vector3f(max);\n+        dimensions.sub(min);\n+        dimensions.scale(HALVING_FACTOR);\n+        return dimensions;\n+    }\n+\n+    public Vector3f getCenter() {\n+        Vector3f dimensions = new Vector3f(max);\n+        dimensions.add(min);\n+        dimensions.scale(HALVING_FACTOR);\n+        return dimensions;\n+    }\n+\n+    public Vector3f getMin() {\n+        return new Vector3f(min);\n+    }\n+\n+    public Vector3f getMax() {\n+        return new Vector3f(max);\n+    }\n+\n+    /**\n+     * Get a new AABB which have a new location base on the offset\n+     * @param offset The offset between the current AABB and the new AABB\n+     * @return the new AABB\n+     */\n+    public AABB move(Vector3f offset) {\n+        Vector3f newMin = new Vector3f(min);\n+        newMin.add(offset);\n+        Vector3f newMax = new Vector3f(max);\n+        newMax.add(offset);\n+        return new AABB(newMin, newMax);\n+    }\n+\n+    public AABB transform(Quat4f rotation, Vector3f offset, float scale) {","path":"src/main/java/org/terasology/math/geom/AABB.java","position":144,"original_position":144,"commit_id":"2475d4559e73f81625ba78153d9a6853fe31429a","original_commit_id":"2475d4559e73f81625ba78153d9a6853fe31429a","user":{"login":"Avalancs","id":18668703,"node_id":"MDQ6VXNlcjE4NjY4NzAz","avatar_url":"https://avatars0.githubusercontent.com/u/18668703?v=4","gravatar_id":"","url":"https://api.github.com/users/Avalancs","html_url":"https://github.com/Avalancs","followers_url":"https://api.github.com/users/Avalancs/followers","following_url":"https://api.github.com/users/Avalancs/following{/other_user}","gists_url":"https://api.github.com/users/Avalancs/gists{/gist_id}","starred_url":"https://api.github.com/users/Avalancs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Avalancs/subscriptions","organizations_url":"https://api.github.com/users/Avalancs/orgs","repos_url":"https://api.github.com/users/Avalancs/repos","events_url":"https://api.github.com/users/Avalancs/events{/privacy}","received_events_url":"https://api.github.com/users/Avalancs/received_events","type":"User","site_admin":false},"body":"A javadoc should mention that the rotation part will actually be ignored, since it's an AABB","created_at":"2018-09-23T21:15:29Z","updated_at":"2018-09-23T21:16:41Z","html_url":"https://github.com/MovingBlocks/TeraMath/pull/55#discussion_r219711788","pull_request_url":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/55","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/comments/219711788"},"html":{"href":"https://github.com/MovingBlocks/TeraMath/pull/55#discussion_r219711788"},"pull_request":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/55","id":199099226,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MDk5MjI2","html_url":"https://github.com/MovingBlocks/TeraMath/pull/55","diff_url":"https://github.com/MovingBlocks/TeraMath/pull/55.diff","patch_url":"https://github.com/MovingBlocks/TeraMath/pull/55.patch","issue_url":"https://api.github.com/repos/MovingBlocks/TeraMath/issues/55","number":55,"state":"open","locked":false,"title":"added AABB collision and transform","user":{"login":"pollend","id":854359,"node_id":"MDQ6VXNlcjg1NDM1OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/854359?v=4","gravatar_id":"","url":"https://api.github.com/users/pollend","html_url":"https://github.com/pollend","followers_url":"https://api.github.com/users/pollend/followers","following_url":"https://api.github.com/users/pollend/following{/other_user}","gists_url":"https://api.github.com/users/pollend/gists{/gist_id}","starred_url":"https://api.github.com/users/pollend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pollend/subscriptions","organizations_url":"https://api.github.com/users/pollend/orgs","repos_url":"https://api.github.com/users/pollend/repos","events_url":"https://api.github.com/users/pollend/events{/privacy}","received_events_url":"https://api.github.com/users/pollend/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-03T22:34:41Z","updated_at":"2018-09-23T21:16:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb5e0fae87ea133077cebed8b3f9c47d899b6e14","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/55/commits","review_comments_url":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/55/comments","review_comment_url":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MovingBlocks/TeraMath/issues/55/comments","statuses_url":"https://api.github.com/repos/MovingBlocks/TeraMath/statuses/2475d4559e73f81625ba78153d9a6853fe31429a","head":{"label":"pollend:aabb","ref":"aabb","sha":"2475d4559e73f81625ba78153d9a6853fe31429a","user":{"login":"pollend","id":854359,"node_id":"MDQ6VXNlcjg1NDM1OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/854359?v=4","gravatar_id":"","url":"https://api.github.com/users/pollend","html_url":"https://github.com/pollend","followers_url":"https://api.github.com/users/pollend/followers","following_url":"https://api.github.com/users/pollend/following{/other_user}","gists_url":"https://api.github.com/users/pollend/gists{/gist_id}","starred_url":"https://api.github.com/users/pollend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pollend/subscriptions","organizations_url":"https://api.github.com/users/pollend/orgs","repos_url":"https://api.github.com/users/pollend/repos","events_url":"https://api.github.com/users/pollend/events{/privacy}","received_events_url":"https://api.github.com/users/pollend/received_events","type":"User","site_admin":false},"repo":{"id":66183835,"node_id":"MDEwOlJlcG9zaXRvcnk2NjE4MzgzNQ==","name":"TeraMath","full_name":"pollend/TeraMath","private":false,"owner":{"login":"pollend","id":854359,"node_id":"MDQ6VXNlcjg1NDM1OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/854359?v=4","gravatar_id":"","url":"https://api.github.com/users/pollend","html_url":"https://github.com/pollend","followers_url":"https://api.github.com/users/pollend/followers","following_url":"https://api.github.com/users/pollend/following{/other_user}","gists_url":"https://api.github.com/users/pollend/gists{/gist_id}","starred_url":"https://api.github.com/users/pollend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pollend/subscriptions","organizations_url":"https://api.github.com/users/pollend/orgs","repos_url":"https://api.github.com/users/pollend/repos","events_url":"https://api.github.com/users/pollend/events{/privacy}","received_events_url":"https://api.github.com/users/pollend/received_events","type":"User","site_admin":false},"html_url":"https://github.com/pollend/TeraMath","description":"Experimental standalone math and stuff","fork":true,"url":"https://api.github.com/repos/pollend/TeraMath","forks_url":"https://api.github.com/repos/pollend/TeraMath/forks","keys_url":"https://api.github.com/repos/pollend/TeraMath/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pollend/TeraMath/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pollend/TeraMath/teams","hooks_url":"https://api.github.com/repos/pollend/TeraMath/hooks","issue_events_url":"https://api.github.com/repos/pollend/TeraMath/issues/events{/number}","events_url":"https://api.github.com/repos/pollend/TeraMath/events","assignees_url":"https://api.github.com/repos/pollend/TeraMath/assignees{/user}","branches_url":"https://api.github.com/repos/pollend/TeraMath/branches{/branch}","tags_url":"https://api.github.com/repos/pollend/TeraMath/tags","blobs_url":"https://api.github.com/repos/pollend/TeraMath/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pollend/TeraMath/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pollend/TeraMath/git/refs{/sha}","trees_url":"https://api.github.com/repos/pollend/TeraMath/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pollend/TeraMath/statuses/{sha}","languages_url":"https://api.github.com/repos/pollend/TeraMath/languages","stargazers_url":"https://api.github.com/repos/pollend/TeraMath/stargazers","contributors_url":"https://api.github.com/repos/pollend/TeraMath/contributors","subscribers_url":"https://api.github.com/repos/pollend/TeraMath/subscribers","subscription_url":"https://api.github.com/repos/pollend/TeraMath/subscription","commits_url":"https://api.github.com/repos/pollend/TeraMath/commits{/sha}","git_commits_url":"https://api.github.com/repos/pollend/TeraMath/git/commits{/sha}","comments_url":"https://api.github.com/repos/pollend/TeraMath/comments{/number}","issue_comment_url":"https://api.github.com/repos/pollend/TeraMath/issues/comments{/number}","contents_url":"https://api.github.com/repos/pollend/TeraMath/contents/{+path}","compare_url":"https://api.github.com/repos/pollend/TeraMath/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pollend/TeraMath/merges","archive_url":"https://api.github.com/repos/pollend/TeraMath/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pollend/TeraMath/downloads","issues_url":"https://api.github.com/repos/pollend/TeraMath/issues{/number}","pulls_url":"https://api.github.com/repos/pollend/TeraMath/pulls{/number}","milestones_url":"https://api.github.com/repos/pollend/TeraMath/milestones{/number}","notifications_url":"https://api.github.com/repos/pollend/TeraMath/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pollend/TeraMath/labels{/name}","releases_url":"https://api.github.com/repos/pollend/TeraMath/releases{/id}","deployments_url":"https://api.github.com/repos/pollend/TeraMath/deployments","created_at":"2016-08-21T06:05:08Z","updated_at":"2016-08-21T06:05:11Z","pushed_at":"2018-07-03T22:34:18Z","git_url":"git://github.com/pollend/TeraMath.git","ssh_url":"git@github.com:pollend/TeraMath.git","clone_url":"https://github.com/pollend/TeraMath.git","svn_url":"https://github.com/pollend/TeraMath","homepage":null,"size":422,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"MovingBlocks:develop","ref":"develop","sha":"f45ad25cb7edfb67ec4c2ac506a6ca0ba8982edf","user":{"login":"MovingBlocks","id":1292442,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyOTI0NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/1292442?v=4","gravatar_id":"","url":"https://api.github.com/users/MovingBlocks","html_url":"https://github.com/MovingBlocks","followers_url":"https://api.github.com/users/MovingBlocks/followers","following_url":"https://api.github.com/users/MovingBlocks/following{/other_user}","gists_url":"https://api.github.com/users/MovingBlocks/gists{/gist_id}","starred_url":"https://api.github.com/users/MovingBlocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MovingBlocks/subscriptions","organizations_url":"https://api.github.com/users/MovingBlocks/orgs","repos_url":"https://api.github.com/users/MovingBlocks/repos","events_url":"https://api.github.com/users/MovingBlocks/events{/privacy}","received_events_url":"https://api.github.com/users/MovingBlocks/received_events","type":"Organization","site_admin":false},"repo":{"id":16586128,"node_id":"MDEwOlJlcG9zaXRvcnkxNjU4NjEyOA==","name":"TeraMath","full_name":"MovingBlocks/TeraMath","private":false,"owner":{"login":"MovingBlocks","id":1292442,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyOTI0NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/1292442?v=4","gravatar_id":"","url":"https://api.github.com/users/MovingBlocks","html_url":"https://github.com/MovingBlocks","followers_url":"https://api.github.com/users/MovingBlocks/followers","following_url":"https://api.github.com/users/MovingBlocks/following{/other_user}","gists_url":"https://api.github.com/users/MovingBlocks/gists{/gist_id}","starred_url":"https://api.github.com/users/MovingBlocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MovingBlocks/subscriptions","organizations_url":"https://api.github.com/users/MovingBlocks/orgs","repos_url":"https://api.github.com/users/MovingBlocks/repos","events_url":"https://api.github.com/users/MovingBlocks/events{/privacy}","received_events_url":"https://api.github.com/users/MovingBlocks/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/MovingBlocks/TeraMath","description":"Experimental standalone math and stuff. Automation category: Terasology Library","fork":false,"url":"https://api.github.com/repos/MovingBlocks/TeraMath","forks_url":"https://api.github.com/repos/MovingBlocks/TeraMath/forks","keys_url":"https://api.github.com/repos/MovingBlocks/TeraMath/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MovingBlocks/TeraMath/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MovingBlocks/TeraMath/teams","hooks_url":"https://api.github.com/repos/MovingBlocks/TeraMath/hooks","issue_events_url":"https://api.github.com/repos/MovingBlocks/TeraMath/issues/events{/number}","events_url":"https://api.github.com/repos/MovingBlocks/TeraMath/events","assignees_url":"https://api.github.com/repos/MovingBlocks/TeraMath/assignees{/user}","branches_url":"https://api.github.com/repos/MovingBlocks/TeraMath/branches{/branch}","tags_url":"https://api.github.com/repos/MovingBlocks/TeraMath/tags","blobs_url":"https://api.github.com/repos/MovingBlocks/TeraMath/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MovingBlocks/TeraMath/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MovingBlocks/TeraMath/git/refs{/sha}","trees_url":"https://api.github.com/repos/MovingBlocks/TeraMath/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MovingBlocks/TeraMath/statuses/{sha}","languages_url":"https://api.github.com/repos/MovingBlocks/TeraMath/languages","stargazers_url":"https://api.github.com/repos/MovingBlocks/TeraMath/stargazers","contributors_url":"https://api.github.com/repos/MovingBlocks/TeraMath/contributors","subscribers_url":"https://api.github.com/repos/MovingBlocks/TeraMath/subscribers","subscription_url":"https://api.github.com/repos/MovingBlocks/TeraMath/subscription","commits_url":"https://api.github.com/repos/MovingBlocks/TeraMath/commits{/sha}","git_commits_url":"https://api.github.com/repos/MovingBlocks/TeraMath/git/commits{/sha}","comments_url":"https://api.github.com/repos/MovingBlocks/TeraMath/comments{/number}","issue_comment_url":"https://api.github.com/repos/MovingBlocks/TeraMath/issues/comments{/number}","contents_url":"https://api.github.com/repos/MovingBlocks/TeraMath/contents/{+path}","compare_url":"https://api.github.com/repos/MovingBlocks/TeraMath/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MovingBlocks/TeraMath/merges","archive_url":"https://api.github.com/repos/MovingBlocks/TeraMath/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MovingBlocks/TeraMath/downloads","issues_url":"https://api.github.com/repos/MovingBlocks/TeraMath/issues{/number}","pulls_url":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls{/number}","milestones_url":"https://api.github.com/repos/MovingBlocks/TeraMath/milestones{/number}","notifications_url":"https://api.github.com/repos/MovingBlocks/TeraMath/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MovingBlocks/TeraMath/labels{/name}","releases_url":"https://api.github.com/repos/MovingBlocks/TeraMath/releases{/id}","deployments_url":"https://api.github.com/repos/MovingBlocks/TeraMath/deployments","created_at":"2014-02-06T16:51:31Z","updated_at":"2018-09-14T07:55:23Z","pushed_at":"2018-07-03T22:34:42Z","git_url":"git://github.com/MovingBlocks/TeraMath.git","ssh_url":"git@github.com:MovingBlocks/TeraMath.git","clone_url":"https://github.com/MovingBlocks/TeraMath.git","svn_url":"https://github.com/MovingBlocks/TeraMath","homepage":"","size":391,"stargazers_count":12,"watchers_count":12,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":9,"open_issues":9,"watchers":12,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/55"},"html":{"href":"https://github.com/MovingBlocks/TeraMath/pull/55"},"issue":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/issues/55"},"comments":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/MovingBlocks/TeraMath/statuses/2475d4559e73f81625ba78153d9a6853fe31429a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Avalancs"}}