diff --git a/primitive/sphere.cpp b/primitive/sphere.cpp index 0029a7b..1da5c09 100644 --- a/primitive/sphere.cpp +++ b/primitive/sphere.cpp @@ -36,9 +36,9 @@ bool Sphere::intersect(Ray &ray) const { return false; // Calculate the normal - auto intersectPoint = ray.origin + ray.direction * t; - auto normalDirection = intersectPoint - this->center; // Point of intersect - origin of sphere creates a line along the normal, pointing outwards - ray.normal = normalized(normalDirection); + auto intersectPoint = ray.origin + ray.direction * t; + auto normalDirection = intersectPoint - this->center; // Point of intersect - origin of sphere creates a line along the normal, pointing outwards + ray.normal = normalized(normalDirection); // Calculate the surface position and tangent vector float const phi = std::acos(ray.normal.y);