Identifying the triangles Counting the amount of triangles in a picture is a task commonly used in brain tests. You are given a picture that contains shapes consisting of triangles. You then must find all possible triangles in the picture.

Task

You are given a list of lines in a format of your choice. You must then output a list of triangles found in that 

Input

You are given a list of lines, each given by four integer coordinates (eg. x1 y1 x2 y2). You may choose the input format, as long as it is clearly documented. Examples:

0 4 8 1
0 4 9 5
8 1 9 5
2 8 0 4
9 5 2 8

[[0, 4, 8, 1], [0, 4, 9, 5], [8, 1, 9, 5], [2, 8, 0, 4], [9, 5, 2, 8]]


Here's the same input as an image:



Another one, with intersections (only in one format to save space):

[[2, 1, 5, 0], [2, 1, 2, 7], [5, 0, 6, 6], [5, 0, 2, 7], [6, 6, 2, 1], [2, 7, 6, 6]]




Output

You must output a list of all triangles, each given by six floating-point coordinates (eg. x1 y1 x2 y2 x3 y3), in the picture specified by the input. These might not be integers, since the lines may cross at any point. You may choose the output format, as long as it is clearly documented. Example outputs for the example inputs above:

0 4 8 1 9 5
0 4 9 5 2 8

[[0, 4, 8, 3, 9, 5], [0, 4, 9, 5, 2, 8]]




[[2, 1, 5, 0, 2, 7], [2, 1, 5, 0, 6, 6], [5, 0, 6, 6, 2, 7], [2, 1, 6, 6, 2, 7], [2, 1, 5, 0, 3.674, 3.093], [5, 0, 6, 6, 3.674, 3.093], [6, 6, 2, 7, 3.674, 3.093], [2, 7, 2, 1, 3.674, 3.093]]


You may assume that


there are no edge cases where a line crosses an intersection but not any lines, like

[[0, 9, 1, 8], [1, 8, 2, 9], [2, 9, 3, 8], [3, 8, 4, 9], [4, 9, 0, 9]]

there are no angles over 179 degrees, like

[[0, 0, 0, 1], [0, 1, 0, 2], [0, 2, 0, 0]]



Rules


You may use any language you want.
No external resources must be used.
Standard loopholes apply.


Scoring

This is code-golf, so the shortest answer in bytes wins.
Mathematica 915 395 401 405
Update
This programming challenge is much more difficult than it first appears to be.
The present approach works with simple cases, where there is but a single intersection along the length of any line segment.  With multiple crossings along one segment, it is necessary to
keep track of all of the intersection points along each line and create new sub-segments (hence additional graph edges) connecting the new intersection to all the intersection points along the target line.
Despite that limitation, it may be worth sharing the logic underlying the current approach.

The input line segments are treated as regions. If they intersect, the centroid will be the coordinates of the intersection.
We need to eliminate those intersections that occur at the vertices of line segments.
Lines that do not intersect will have an indeterminate centroid.
Four new edges are created for each intersection point. They connect the intersection point to the four vertices of the two intersecting lines.
A graph such as the one below on the right is generated using both the old and new edges.
The vertices are the coordinates of the respective points.
Cycles, i.e., closed loops of three vertices will be triangles provided that the three vertices are not collinear.
Presently we check to see whether any &quot;triangle&quot; has an indeterminate area.  (For some reason it does not return an area of 0 for three collinear points.)

A simple example
Below are (a) the figure plotted in the coordinate plane and (b) the graph showing the given nodes as well as the intersection node, {114/23, 314/69}.  In the latter, the vertices are not located at the respective Cartesian coordinates.
It may appear that their are more edges in the right figure than in the left. But remember that there are overlapping graph edges on the left.  Each diagonal actually corresponds to 3 graph edges!


    f@w_ :=(h@{a_, b_, c_, d_} := (r = RegionCentroid@RegionIntersection[Line@{a, b}, Line@{c, d}];
     {r &lt;-&gt; a, r &lt;-&gt; b, r &lt;-&gt; c, r &lt;-&gt; d});
      Cases[FindCycle[Graph[Union@Join[w /. {{a_, b_Integer}, {c_, d_}} :&gt; {a, b} &lt;-&gt; {c, d},
      Cases[Flatten[h /@ Cases[{Length[Union@#] &lt; 4, #} &amp; /@ (FlattenAt[#, {{1}, {2}}] &amp; /@ 
      Subsets[w, {2}]),{False, c_} :&gt; c]], Except[{Indeterminate, _} &lt;-&gt; _]]]], {3}, 50],
      x_ /; NumericQ[RegionMeasure@Triangle[x[[All, 1]]]]][[All, All, 1]]//N//Grid)

Each row below is a triangle.
f[{{{2,8},{8,1}},{{0,4},{8,1}},{{0,4},{9,5}},{{8,1},{9,5}},{{2,8},{0,4}},{{9,5},{2,8}}}]



A more complex example
f@{{{9, 5}, {0, -10}}, {{9, 5}, {0, 2}},  {{9, 5}, {2, -1}}, {{0, -10}, {2, -1}}, {{0, -10}, {-2, -1}}, {{-9, 5}, {0, -10}}, {{-9, 5}, {0, 2}}, {{-9, 5}, {-2, -1}}, {{0, 2}, {0, -10}}, {{-9, 5}, {2, -1}}, {{9, 5}, {-2, -1}}, {{-9, 5}, {9, 5}}}

Here's the graph corresponding to the input coordinates. The vertices are at their expected Cartesian coordinates. (If you run the golfed code it will display the vertices elsewhere while respecting the vertex labels and edges. For readability, I assigned the vertex coordinates using a smattering of additional code, not necessary for the solution.)


Here's the derived graph.
It includes the derived point of intersection (0,1/11), where some of the input lines cross.

The code found 19 triangles.  Nine of them have the point, (0,1/11) as one of the vertices.