 ! points at ymin and ymax at the gap bounds.
 : drawable-chunks ( data ymin,ymax -- chunks )
     first2 [
-        '[ [ second _ _ between<=> ] bi@ = ]
+        '[ [ y _ _ between<=> ] bi@ = ]
         monotonic-split-slice
     ] 2keep (drawable-chunks) ;
 

! pairs is <= min, and if the first is < min, then the second is
! > min. Otherwise the first one would be = min.
: left-cut ( min pairs -- seq )
    2dup first first < [
        [ dupd first2 y-at 2array ] keep rest-slice swap prefix
    ] [
        nip

    [ (line-vertices) gl-vertex-pointer GL_LINES 0 ] keep
    length glDrawArrays ;

! bounds: { { xmin xmax } { ymin ymax } }
: clip-data ( bounds data -- data' )
    dup empty? [ nip ] [
        dupd [ first ] dip clip-by-x
        dup empty? [ nip ] [
            [ second ] dip [ y-in-bounds? ] keep swap
            [ drop { } ] unless
        ] if
    ] if ;
