I need help verifying my logic is correct. Basically I am trying to derive a formula for calculating the 3D normal vector to a sphere given its 2D image. If I am given the 2D picture of a sphere. I can calculate its radius, r. Here we assume an orthographic projection, meaning the sphere mapped into the 2D image plane is simply the z value dropped.
Let the coordinate frame originate from the center of the sphere with z-axis pointing toward the viewer or out of the image plane, then if I select any point, (x,y), on the 2D image of a sphere, I can actually calculate the 3D normal vector to the sphere at that point from its 2D image as follows:
1. Let d be the distance from center of the 2D sphere to the point (x, y) in our 2D coordinate system (dropping the z-axis for now). This is the projected shortened length as seen, but its actual length in 3D from the center of the sphere is of course the radius r.
2. We also know that in 3D that rcost = d, because d is also the distance of the 3D projection of the vector < x, y, z > onto the 2D radius vector v that originates from the 2D sphere's center and ends at the edge of the 2D sphere, and is on the 2D image plane, forms a right triangle.
3. So, cost = d/r and arccos(d/r) = t, where t is the angle between the 2D radius vector v on the 2D image plane and the 3D vector < x, y, z > to our point of interest.
4. Since x and y is given by the 2D image, we only need the depth z and that is given by rsint = rsin(arccos(d/r)).
5. Therefore the 3D vector < x, y, z > = < x, y, rsin(arccos(d/r))>, where < x, y > is given by the 2D image.
Is this the correct step to find the depth, z, for a normal vector to a point (x, y, z) on a sphere given a 2D image of that sphere?