Skip to main content
. 2020 Jan 4;20(1):293. doi: 10.3390/s20010293
Algorithm 2: 2D Wall Lines Connection and Refining
Input: 2D Wall Lines in floor plane: L
Angle threshold: φ0
Output: Connection vectors of 2D wall lines: L
1:  initialize: Random Select one line L0 from L
2:  Remove L0 from L, and add L0 to L
3:  while L is not empty do
4:     for i=1, i length(L), i++ do
5:        For distance set D: Di= Dv(L0, Li)
6:     end for
7:     Find line candidate Lc referring to the minimum value in D
8:     Remove Lc from L, and add Lc to L
9:  end while
10: for j=1, jlength(L), j++ do
11:    Calculate the angle between adjacent lines: Ang=A(Lj,Lj+1)
12:     if Ang< φ0 then
13:       Extend lines to obtain intersection point
14:       Update the vertexes of Lj,Lj+1
15:    else
16:       Add one new line between Lj,Lj+1
17:    end if
18: end for
19: Return: L