evanw/lightgl.js — Issue #4: Bug in Raytracer.hitTestTriangle
Author: jagenjo
Created: 2012-03-06 19:41:57+00:00
State: open

In the line:

var t = normal.dot(a.subtract(origin)).divide(normal.dot(ray));

dot product returns a number, not a Vector, so it should be:

var t = normal.dot(a.subtract(origin)) / normal.dot(ray);