search for: ray_spher

Displaying 2 results from an estimated 2 matches for "ray_spher".

Did you mean: ray_sphere
2008 Dec 16
0
[LLVMdev] Another compiler shootout
...-b.z); } Vec scale(real a, const Vec b) { return vec(a*b.x, a*b.y, a*b.z); } real dot(const Vec a, const Vec b) { return a.x*b.x + a.y*b.y + a.z*b.z; } Vec unitise(const Vec a) { return scale((1.0 / sqrt(dot(a, a))), a); } struct Scene { Vec center; real radius; struct Scene *child; }; real ray_sphere(Vec o, Vec d, Vec c, real r) { Vec v = sub(c, o); real b = dot(v, d), disc = b*b - dot(v, v) + r*r, t1, t2; if (disc < 0.0) return INFINITY; disc = sqrt(disc); t2 = b + disc; if (t2 < 0.0) return INFINITY; t1 = b - disc; return (t1 > 0.0 ? t1 : t2); } void intersect(Vec o...
2008 Dec 16
6
[LLVMdev] Another compiler shootout
FYI. http://leonardo-m.livejournal.com/73732.html If anyone is motivated, please file bugs for the losing cases. Also, it might make sense to incorporate the tests into our nightly tester test suite. Thanks, Evan