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

ray_intersect_plane yields incorrect results #94

Open
kietdlam opened this issue Apr 18, 2019 · 4 comments
Open

ray_intersect_plane yields incorrect results #94

kietdlam opened this issue Apr 18, 2019 · 4 comments

Comments

@kietdlam
Copy link

kietdlam commented Apr 18, 2019

import pyrr
import numpy as np

p1 = np.array([0.6122449, 0.8163265, 1.562406])
p2 = np.array([0.8571429, 0.7142857, 1.976692])
p3 = np.array([0.6122449, 0.6326531, 1.250161])

plane = pyrr.plane.create_from_points(p1, p2, p3)

ray = pyrr.ray.create_from_line([np.array([1, 1, 1]), np.array([0, 1, 1])])
print(pyrr.geometric_tests.ray_intersect_plane(ray, plane))

yields : [-0.83114114 1. 1. ]
expected: [0.247 1 . 1. ]

Why does ray_intersect_plane yield this wrong result?

@adamlwgriffiths
Copy link
Owner

Ok

@kietdlam
Copy link
Author

Sorry closed by accident, this is still an issue.

@kietdlam kietdlam reopened this Apr 18, 2019
@kietdlam
Copy link
Author

kietdlam commented Apr 18, 2019

print(pyrr.plane.create_from_points(p1, p2, p3))
=>
[-0.77258732 -0.54724948 0.32191123 0.41679086]

The plane equation should have Ax + By + Cz + D = 0

-0.77258732*-0.83114114 + -0.54724948 + 0.32191123 + 0.41679086 = 0.8335817158943447

which is not 0.

The answer from ray_intersect_plane is not on the plane at all.

@adamlwgriffiths
Copy link
Owner

Can you see if this is still an issue with 0.10.3 which has some fixes from #88

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

No branches or pull requests

2 participants