copy-intervalIntervalsexpand-pointexpand-intervalGoTo Top

expand-interval   interval amount => new-interval[Function]

Purpose
Create a new interval by expanding interval by amount.

Package   :gbbopen

Module   :gbbopen-core

Arguments and values

interval     An interval
amount     A numbe
new-interval     An interval

Returns
A new, expanded interval.

Description
The structure of the original interval (cons, two-element list, or two-element array) is maintained in the newly allocated, expanded new-interval.

An interval that is contracted (expanded negatively) by an amount greater than one-half of its width will result in a zero-width new-interval at the center point of the original interval.

See also
    *coerce-contracted-interval-rationals-to-floats*
    copy-interval
    infinite-interval
    interval-start
    interval-end
    interval-values
    make-interval
    nexpand-interval
    nshift-interval
    shift-interval

Examples

  > (expand-interval '(2 5) 2)
  (0 7)
  > (expand-interval '(2 . 5) -1)
  (3 . 4)
  > (expand-interval #(2 5) .5)
  #(1.5 5.5)
  > (expand-interval '(2 . 5) -3)
  (3.5 . 3.5)
  >


The GBBopen Project


copy-intervalIntervalsexpand-pointexpand-intervalGoTo Top