{"action":"opened","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":0,"created_at":"2016-03-23T08:38:32Z","updated_at":"2016-03-23T08:38:32Z","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."}}