chickadee » srfi-179 » interval-dilate

interval-dilate interval lower-diffs upper-diffsprocedure

If interval is an interval with lower bounds $\ell_0,\dots,\ell_{d-1}$ and upper bounds $u_0,\dots,u_{d-1}$, and lower-diffs is a vector of exact integers $L_0,\dots,L_{d-1}$ and upper-diffs is a vector of exact integers $U_0,\dots,U_{d-1}$, then interval-dilate returns a new interval with lower bounds $\ell_0+L_0,\dots,\ell_{d-1}+L_{d-1}$ and upper bounds $u_0+U_0,\dots,u_{d-1}+U_{d-1}$, as long as this is a nonempty interval. It is an error if the arguments do not satisfy these conditions.

Examples:

(interval=
 (interval-dilate (make-interval '#(100 100))
                  '#(1 1) '#(1 1))
 (make-interval '#(1 1) '#(101 101))) => #t
(interval=
 (interval-dilate (make-interval '#(100 100))
                  '#(-1 -1) '#(1 1))
 (make-interval '#(-1 -1) '#(101 101))) => #t
(interval=
 (interval-dilate (make-interval '#(100 100))
                  '#(0 0) '#(-50 -50))
 (make-interval '#(50 50))) => #t
(interval-dilate
 (make-interval '#(100 100))
 '#(0 0) '#(-500 -50)) => error