charts.lines: update some names
left-cut -> left-cut-x, min -> xmin; right-cut -> right-cut-x, max -> xmax.char-rename
parent
b0ec86be44
commit
6fee00014f
|
@ -68,9 +68,9 @@ ALIAS: y second
|
||||||
: last2 ( seq -- penultimate ultimate ) 2 tail* first2 ;
|
: last2 ( seq -- penultimate ultimate ) 2 tail* first2 ;
|
||||||
|
|
||||||
! Due to the way adjusted-tail-slice works, the first element of
|
! Due to the way adjusted-tail-slice works, the first element of
|
||||||
! pairs is <= min, and if the first is < min, then the second is
|
! pairs is <= xmin, and if the first is < xmin, then the second is
|
||||||
! > min. Otherwise the first one would be = min.
|
! > xmin. Otherwise the first one would be = xmin.
|
||||||
: left-cut ( min pairs -- seq )
|
: left-cut-x ( xmin pairs -- seq )
|
||||||
2dup first x < [
|
2dup first x < [
|
||||||
[ dupd first2 y-at 2array ] keep rest-slice swap prefix
|
[ dupd first2 y-at 2array ] keep rest-slice swap prefix
|
||||||
] [
|
] [
|
||||||
|
@ -78,9 +78,9 @@ ALIAS: y second
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
! Due to the way adjusted-head-slice works, the last element of
|
! Due to the way adjusted-head-slice works, the last element of
|
||||||
! pairs is >= max, and if the last is > max, then the second to
|
! pairs is >= xmax, and if the last is > xmax, then the second to
|
||||||
! last is < max. Otherwise the last one would be = max.
|
! last is < xmax. Otherwise the last one would be = xmax.
|
||||||
: right-cut ( max pairs -- seq )
|
: right-cut-x ( xmax pairs -- seq )
|
||||||
2dup last x < [
|
2dup last x < [
|
||||||
[ dupd last2 y-at 2array ] keep but-last-slice swap suffix
|
[ dupd last2 y-at 2array ] keep but-last-slice swap suffix
|
||||||
] [
|
] [
|
||||||
|
@ -90,7 +90,7 @@ ALIAS: y second
|
||||||
! If the line spans beyond min or max, make sure there are points
|
! If the line spans beyond min or max, make sure there are points
|
||||||
! with x = min and x = max in seq.
|
! with x = min and x = max in seq.
|
||||||
: min-max-cut ( min,max pairs -- seq )
|
: min-max-cut ( min,max pairs -- seq )
|
||||||
[ first2 ] dip right-cut left-cut ;
|
[ first2 ] dip right-cut-x left-cut-x ;
|
||||||
|
|
||||||
: clip-by-x ( min,max pairs -- pairs' )
|
: clip-by-x ( min,max pairs -- pairs' )
|
||||||
2dup x-in-bounds? [
|
2dup x-in-bounds? [
|
||||||
|
|
Loading…
Reference in New Issue