Prev: higuchi matlab code
Next: higuchi matlab code
From: Berend on 30 May 2010 15:45 "Mathew Thomas" <mathew99(a)gmail.com> wrote in message <htuecg$lc2$1(a)fred.mathworks.com>... > Hey, > > I meant: > All the sample points that lie 'exactly' on the line between these two given points. Hope this makes it clear. > > Thanks, > > Mathew a very crude code to get the ones that exactly lie on this line is: a=[200,80]; b=[220,110]; x=[a(1) b(1)]; y=[a(2) b(2)]; X=a(1):b(1); Y=interp1(x,y,X) r=round(Y); t=Y./r-1; v=find(t==0); X=X(v) Y=Y(v)
From: Matt J on 30 May 2010 15:55 "Mathew Thomas" <mathew99(a)gmail.com> wrote in message <htuen7$cjv$1(a)fred.mathworks.com>... > Thats exactly what I needed. > If you mean that the solution provided by Bernd was what you needed, that's good, but that solution does not givethe points that lie *exacly* on the line. You seem to be requesting contradictory things.
From: Matt J on 30 May 2010 16:03
"Mathew Thomas" <mathew99(a)gmail.com> wrote in message <htuecg$lc2$1(a)fred.mathworks.com>... > Hey, > > I meant: > All the sample points that lie 'exactly' on the line between these two given points. ================= If you really do mean "exactly", then something like this is what you want a=[0;0]; b=[10;6]; dX=b(1)-a(1); dY=b(2)-a(2); G=gcd(dX,dY); dxy=round([dX;dY]/G); AllPoints=round( bsxfun(@plus,a,dxy*(0:G)) ); |