Pyrr
Pyrr copied to clipboard
ray_intersect_plane yields incorrect results
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?
Ok
Sorry closed by accident, this is still an issue.
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.
Can you see if this is still an issue with 0.10.3 which has some fixes from https://github.com/adamlwgriffiths/Pyrr/pull/88