Dear Sir,
What you could do is defining a starting point in a grid, then draw a line and find all intersections points. Once you have found your point you can use any 1D interpolater to find the corresponding grey points. A small code that helps you on your way, modified from this question : The code you can find below:
clc;clear all;close all;
x = 0:5;
y = 0:25;
lxmb = @(x,mb) mb(1).*x + mb(2);
m = 2.7;
b = 1;
mb = [m b];
L1 = lxmb(x,mb);
hix = @(y,mb) [(y-mb(2))./mb(1); y];
vix = @(x,mb) [x; lxmb(x,mb)];
hrz = hix(x(2:end),mb)'
vrt = vix(y(1:6),mb)'
figure(1)
plot(repmat(x,2,length(x)), [0 length(y)-1])
hold on
plot([0 length(x)-1], repmat(y,2,length(y)))
plot(x, L1)
hold on
axis equal
hvix = [hrz; vrt];
srtd = unique(hvix,'rows');
plot(srtd(:,1),srtd(:,2),'o');
Good luck! Christiaan
Best Answer