You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I understood correctly the purpose of the intersectRay function, it contains a few errors.
Edit: The intersectLineSphere function is also incorrect.
1.) The function has a sphere center parameter, but ignores it and assumes that the sphere is in the origo.
2.) It calculates the length of the ray direction vector, but later on uses this vector as a unit vector.
3.) The position calculation is simply wrong. It multiplies the direction vector with the radius of the sphere instead of the calculated intersection distance.
And I would also like to add, that for most of the applications of this function simply returning (or assigning) the intersection distance (x) would be more useful. The rest can be calculated by the user if necessary.
The text was updated successfully, but these errors were encountered:
If I understood correctly the purpose of the intersectRay function, it contains a few errors.
Edit: The intersectLineSphere function is also incorrect.
1.) The function has a sphere center parameter, but ignores it and assumes that the sphere is in the origo.
2.) It calculates the length of the ray direction vector, but later on uses this vector as a unit vector.
3.) The position calculation is simply wrong. It multiplies the direction vector with the radius of the sphere instead of the calculated intersection distance.
Here is a corrected implementation with "floating-point safeguards" on the quadratic equation solving too.
The quadratic equation implementation is based on this pdf: http://www.scilab.org/content/download/1106/10848/file/scilabisnotnaive.pdf
And I would also like to add, that for most of the applications of this function simply returning (or assigning) the intersection distance (x) would be more useful. The rest can be calculated by the user if necessary.
The text was updated successfully, but these errors were encountered: