W=1/SQR(U*U+V*V+1)
This makes a sphere. It gets multiplied by two coordinates to make spheres at different places, U and V. W=1/SQR(U*U+V*V+1)
This makes a sphere. It gets multiplied by two coordinates to make spheres at different places, U and V.if you change the initialization of i from sgn u to 1.2 * sgn u you will get an image with the spheres a little further apart
// sphere_center = (E, F, Z)
E = X - I
F = Y - I
// solving the ray-sphere quadratic eqn...
P = U * E + V * F - W * Z
// discriminant
D = P * P - E * E - F * F - Z * Z + 1
// if solution (ie. intersection) exists
IF D > 0
// intersect_point = ray_orig + T * ray_dir
// this is the closer pt, -P + SQR D is the other
T = -P - SQR D