How to find the edge points of a line in matlab? -


i have plotted line in matlab , want find out coordinates line crosses edges:

enter image description here

any suggestions or advices? =) function xy-limits -1 1. here code far:

yp = -1 + (1-(-1)).*rand(1,2); xp = -1 + (1-(-1)).*rand(1,2); = (yp(2)-yp(1)) / (xp(2)-xp(1)); b = yp(1)-a*xp(1); xlim([-1 1]) ylim([-1 1]) xlims = xlim(gca); ylims = ylim(gca); y = xlims*a+b; line( xlims, y ); 

  1. find equation line, ie: y=a*x+b
  2. solve x using lower/upper y-limit, if resulting x within x-limits, is/are edge point(s).
  3. solve y using left/right x-limit, if resulting y within y-limits, is/are edge point(s).
  4. done

so resulting points within limits green dots in te following picture, resulting points outside limits red ones.

enter image description here


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -