I asked this over on stackoverflow and it transpired it was amenable to a mathematical solution. So I am seeking clarity here, or I go night night.
//Returns the point on the line traced from start to end which //comes nearest to 0.5, 0.5. fpPoint closestToCentre(fpPoint start, fpPoint end);
Anyone know of quicker way than single stepping through the pixels?
Now I know how to rotate the gradient 90 degrees and can find which way easy enough, so it is now a matter of finding a line intercept and expressing this mathematically so I can solve for x and y.
I was thinking my original line is known and : dy1 = dx1 * dybydx1 + c1
and the perp through centre is : dy2 = dx2 * dybydx2 + c2
I don't really need trig (and to worry about negativity in certain quadrants) to rotate the grad 90 degrees do I? Night all.