Changed the original analytic method to a geometrical. The errors in the original intersection calculation: The function has a sphere center parameter, but ignores it and assumes that the sphere is in the origo. It calculates the length of the ray direction vector, but later on uses this vector as a unit vector. The position calculation is simply wrong. It multiplies the direction vector with the radius of the sphere instead of the calculated intersection distance. The quadratic equation solving could be improved too: There should be an early exit for negative discriminant. The naive implementation sould be changed to a floating-point specialized one.master
parent
3a3c1fd8e8
commit
ed12134f34
2 changed files with 10 additions and 25 deletions
Loading…
Reference in New Issue