search for: unitise

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

2008 Dec 16
0
[LLVMdev] Another compiler shootout
...ec add(const Vec a, const Vec b) { return vec(a.x+b.x, a.y+b.y, a.z+b.z); } Vec sub(const Vec a, const Vec b) { return vec(a.x-b.x, a.y-b.y, a.z-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;...
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