So i am working through the book "Raytracing in one weekend". At the point where i am at we want to check if a ray hits a sphere. For that we have the equation:
dot((A + t*B - C),(A + t*B - C)) = R*R
Where A + t*B is a point on the ray, with A the start, B the direction and t how far along we went on the ray.
To solve this the author transformed the equation to:
t*t*dot(B,B) + 2*t*dot(A-C,A-C) + dot(C,C) - R*R = 0
Now i just can not understand how this transformation comes about. Simply multiplying this out seems to give a way different result.
Is there some kind of vector math i'm missing here?