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^o$ 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 : $dy_1$ = $dx_1\left(\frac{dy}{dx_1}\right) + c_1$
and the perpendicular through center is : $dy_2 = dx_2 \left( \frac{dy}{dx_2}\right) + c_2$
I don't really need trig (and to worry about negativity in certain quadrants) to rotate the grad $90^o$ do I? Night all.