{"action":"created","issue":{"url":"https://api.github.com/repos/sharpdx/SharpDX/issues/730","repository_url":"https://api.github.com/repos/sharpdx/SharpDX","labels_url":"https://api.github.com/repos/sharpdx/SharpDX/issues/730/labels{/name}","comments_url":"https://api.github.com/repos/sharpdx/SharpDX/issues/730/comments","events_url":"https://api.github.com/repos/sharpdx/SharpDX/issues/730/events","html_url":"https://github.com/sharpdx/SharpDX/issues/730","id":142897682,"number":730,"title":"[Mathematics] BoundingFrustum.Intersects(...Ray...) not working correctly","user":{"login":"deng0","id":4224837,"avatar_url":"https://avatars.githubusercontent.com/u/4224837?v=3","gravatar_id":"","url":"https://api.github.com/users/deng0","html_url":"https://github.com/deng0","followers_url":"https://api.github.com/users/deng0/followers","following_url":"https://api.github.com/users/deng0/following{/other_user}","gists_url":"https://api.github.com/users/deng0/gists{/gist_id}","starred_url":"https://api.github.com/users/deng0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deng0/subscriptions","organizations_url":"https://api.github.com/users/deng0/orgs","repos_url":"https://api.github.com/users/deng0/repos","events_url":"https://api.github.com/users/deng0/events{/privacy}","received_events_url":"https://api.github.com/users/deng0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-23T08:38:32Z","updated_at":"2016-03-24T11:43:39Z","closed_at":null,"body":"I've stumbled upon a problem with the BoundingFrustum Ray intersection method.\r\n\r\nIn the case where the Ray.Position is not contained within the BoundingFrustum, the method does not work correctly in many cases:\r\nThe idea that is used (check whether middle position of min/max ray-plane-intersections is inside frustum) is not correct.\r\nIn many cases there are more than two ray-plane-intersections and the middle position is not meaningful.\r\n\r\nAlso some other notes about BoundingFrustum:\r\n- In the first case where the Ray.Position is contained within the BoundingFrustum, shouldn't the inDistance be set to 0 and the outDistance to nearstPlaneDistance instead of inDistance to nearstPlaneDistance and outDistance to null.\r\n- Perhaps the method bool Intersects(ref Ray ray), where we don't care about inDistance and outDistance, could use a different more efficient implementation.\r\n- The method Contains(Vector3[] points) throws a NotImplementedException, perhaps it's better to remove the method instead."},"comment":{"url":"https://api.github.com/repos/sharpdx/SharpDX/issues/comments/200801139","html_url":"https://github.com/sharpdx/SharpDX/issues/730#issuecomment-200801139","issue_url":"https://api.github.com/repos/sharpdx/SharpDX/issues/730","id":200801139,"user":{"login":"deng0","id":4224837,"avatar_url":"https://avatars.githubusercontent.com/u/4224837?v=3","gravatar_id":"","url":"https://api.github.com/users/deng0","html_url":"https://github.com/deng0","followers_url":"https://api.github.com/users/deng0/followers","following_url":"https://api.github.com/users/deng0/following{/other_user}","gists_url":"https://api.github.com/users/deng0/gists{/gist_id}","starred_url":"https://api.github.com/users/deng0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deng0/subscriptions","organizations_url":"https://api.github.com/users/deng0/orgs","repos_url":"https://api.github.com/users/deng0/repos","events_url":"https://api.github.com/users/deng0/events{/privacy}","received_events_url":"https://api.github.com/users/deng0/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T11:43:39Z","updated_at":"2016-03-24T11:43:39Z","body":"Another small issue with Collision.RayIntersectsTriangle():\r\nIf the triangle is very small and therefor the edges of the triangle are very short MathUtil.IsZero(determinant) is true although the ray is not at all parallel to the triangle plane."}}