def isect_segments__naive(segments):
isect = []<EOL>if Real is float:<EOL><INDENT>segments = [<EOL>(s[<NUM_LIT:0>], s[<NUM_LIT:1>]) if s[<NUM_LIT:0>][X] <= s[<NUM_LIT:1>][X] else<EOL>(s[<NUM_LIT:1>], s[<NUM_LIT:0>])<EOL>for s in segments]<EOL><DEDENT>else:<EOL><INDENT>segments = [<EOL>(<EOL>(Real(s[<NUM_LIT:0>][<NUM_LIT:0>]), Real(s[<NUM_LIT:0>][<NUM_LIT:1>])),<EOL>(Real(s[<NUM_LIT:1>][<NUM_LIT:0>]), Real(s[<NUM_LIT:1>][<NUM_LIT:1>])),<EOL>) if (s[<NUM_LIT:0>] <= s[<NUM_LIT:1>]) else<EOL>(<EOL>(Real(s[<NUM_LIT:1>][<NUM_LIT:0>]), Real(s[<NUM_LIT:1>][<NUM_LIT:1>])),<EOL>(Real(s[<NUM_LIT:0>][<NUM_LIT:0>]), Real(s[<NUM_LIT:0>][<NUM_LIT:1>])),<EOL>)<EOL>for s in segments]<EOL><DEDENT>n = len(segments)<EOL>for i in range(n):<EOL><INDENT>a0, a1 = segments[i]<EOL>for j in range(i + <NUM_LIT:1>, n):<EOL><INDENT>b0, b1 = segments[j]<EOL>if a0 not in (b0, b1) and a1 not in (b0, b1):<EOL><INDENT>ix = isect_seg_seg_v2_point(a0, a1, b0, b1)<EOL>if ix is not None:<EOL><INDENT>isect.append(ix)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return isect<EOL>
Brute force O(n2) version of ``isect_segments`` for test validation.