I have an array of "lines" each defined by 2 points. I am working with only the line segments lying between those points. I need to search lines that could continue one another (relative to some angle) and lie on the same line (with some offset)

I mean I had something like 3 lines

I solved some mathematical problem (formulation of which is my question) and got understanding that there are lines that could be called relatively one line (with some angle K and offset J)

And of course by math formulation I meant some kind of math formula like

so I know the algorithm I used such simple approach like one presented by Victor Liu

```
Angle(A,B)
return Atan((B.y-A.y) / (B.x-A.x)) // use atan2 if possible, but needs wrapping
NearlyParallel(angle1, angle2)
delta = Abs(angle1-angle2)
return (delta < threshold) or (delta > Pi-threshold)
Collinear(A,B, C,D)
// Assume NearlyParallel(Angle(A,B), Angle(C,D)) == true
return NearlyParallel(Angle(A,C), Angle(B,D)) and NearlyParallel(Angle(A,D), Angle(B,C))
```

but its Pusedo solution code and what I need is problem formulation.

argmin(B, A) [Atan((B.y-A.y) / (B.x-A.x))]" btw that line i just write looks like math... but I do not kow how to give to determine in such math model my arrays of A's and B's...

My problem is its formalisation into math using some Matrix and other math words (to write into some paper=)

guys - I am a programmer - sorry=)