-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathintspoints.m
36 lines (30 loc) · 948 Bytes
/
intspoints.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function pointlist=intspoints(lines,imsize)
len=length(lines);
k=1;
pointlist(k).point=[0 0];
pointlist(k).lines=[0 0];
for i = 1:len
for j =i+1:len
[a,b]=Itspoint(lines(i),lines(j));
if (a>0) && (a<imsize(2)) && (b>0) && (b<imsize(1))
if isneighb([a b],lines(i),lines(j))
pointlist(k).point=[a b];
pointlist(k).lines=[i j];
k=k+1;
end
end
end
end
end
function isneb=isneighb(intp,line1,line2)
isneb=false;
if isnan(intp(1)) || isnan(intp(2))
return;
end
l1=norm(line1.point1-line1.point2);
l2=norm(line2.point1-line2.point2);
if (norm(intp-line1.point1)<0.2*l1 || norm(intp-line1.point2)<0.2*l1 )|| ...
(norm(intp-line2.point1)<0.2*l2 || norm(intp-line2.point2)<0.2*l2)
isneb=true;
end
end