Calculating the Normal Vector

F(x,y,z) = Ax2 + By2 + Cz2 + 2Dxy + 2Eyz + 2Fxz + 2Gx + 2Hy + 2Jz + K
To calculate the normal vector you take partial derivatives
of F with respect to x, y and z.
[[partialdiff]]F/[[partialdiff]]x = 2Ax + 2Dy +2Fz +2G
[[partialdiff]]F/[[partialdiff]]y = 2By + 2Dx +2Ez +2H
[[partialdiff]]F/[[partialdiff]]z = 2Cx + 2Ey +2Fx +2J

2 can be factored out so Rn = [xn, yn, zn] = [Ax+Dy+Fz+G, By+Dx+Ez+H, Cx+Ey+Fx+J]

We want the normal for the surface facing the ray so if Rn*Rd > 0 then
Rn = -Rn