Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intersectRayPlane returns true in parallel case #578

Closed
Bargor opened this issue Nov 22, 2016 · 1 comment
Closed

intersectRayPlane returns true in parallel case #578

Bargor opened this issue Nov 22, 2016 · 1 comment
Assignees
Milestone

Comments

@Bargor
Copy link

Bargor commented Nov 22, 2016

When ray is parallel to plane function intersectRayPlane returns true.

Eg glm::intersectRayPlane(glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), dist)

Problem can be solved by inverting sign of epsilon check:

	if(d < -Epsilon)
	{
		intersectionDistance = glm::dot(planeOrig - orig, planeNormal) / d;
		return true;
	}
	return false;

Edit: not sure how to handle case when plane and ray lies on same plane, since there are inifinite solutions.

@Groovounet
Copy link
Member

This issue is fixed in both master and 0.9.8 branch with your proposed fix.

Thanks for contributing,
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants