- // Surface normal is the difference between intersection and center point
- if(Intersect(tempRay)) {
- // intersection point
- Vec3f i = tempRay.origin() + tempRay.direction() * (tempRay.t() - Epsilon);
- // normal
- Vec3f n = (i - m_center);
- n.normalize();
- return n;
- } else {
- // no intersection with ray, so no surface normal
- return Vec3f(0,0,0);
- }