charts.lines: add extra points where necessary for drawing

char-rename
Alexander Iljin 2017-01-13 19:28:13 +03:00 committed by John Benediktsson
parent ff0c2fdf32
commit d3e671565f
1 changed files with 5 additions and 1 deletions

View File

@ -106,6 +106,10 @@ TUPLE: line < gadget color data ;
: between<=> ( value min max -- <=> )
3dup between? [ 3drop +eq+ ] [ nip > +gt+ +lt+ ? ] if ;
! Drop chunks that are out of bounds, add extra points where needed.
: (drawable-chunks) ( chunks min max -- chunks )
'[ first second _ _ between? ] filter harvest ;
! Split data into chunks to be drawn within the [ymin,ymax] limits.
! Return the (empty?) sequence of chunks, possibly with some new
! points at ymin and ymax at the gap bounds.
@ -113,7 +117,7 @@ TUPLE: line < gadget color data ;
first2 [
'[ [ second _ _ between<=> ] bi@ = ]
monotonic-split-slice
] 2keep '[ first second _ _ between? not ] reject ;
] 2keep (drawable-chunks) ;
PRIVATE>