"CRIS" wrote in message <jnu34v$f3l$1@newscl01ah.mathworks.com>...
> Hi, i have an image where i find a straight line ( i have the coefficients of this line y =ax+b). I must to find a pixel in the same image (only one pixel) that lies in this straight line and that is at distance 'd' from another pixel in the image (also this pixel lies in the straight line).
> Any suggestions to do this in a simple and fast way?
> thanks.
         
What if your line were vertical? The equation y = a*x+b wouldn't apply in that case. You can always characterize a line as containing two given points P1 = (x1,y1) and P2 = (x2,y2). Any point P = (x,y) on the line through them satisfies the equation
P = (1t)*P1 + t*P2
where t is an appropriate real parameter.
Thus if P is to be a distance d from P1 you get
d^2 = (xx1)^2 + (yy1)^2 = t^2*((x2x1)^2+(y2y1)^2)
and therefore
t = + or  d/sqrt((x2x1)^2+(y2y1)^2)
Solving for x and y gives you two possible pixel positions. If x and y aren't valid pixel indices, round them.
Roger Stafford
