4.1.4.3. Interval

Implements 1D and 2D Interval Arithmetic.

class PyOpenGLng.Tools.Interval.Interval(*args)[source]

Bases: object

One-dimension Interval

Initialise an interval

  • Interval(inf, sup)
  • else args must support the __getitem__ interface, e.g.: - Interval((inf, sup)) - Interval([inf, sup]) - Interval(interval_instance)
_check_arguments(args)[source]
static _intersection(i1, i2)[source]
static _union(i1, i2)[source]
copy()[source]

Return a clone of the interval

enlarge(dx)[source]

Enlarge the interval of dx

intersect(i1, i2)[source]

Does the interval intersect with i2?

is_empty()[source]
is_included_in(i1, i2)[source]

Is the interval included in i1?

is_outside_of(i1, i2)[source]

Is the interval outside of i2?

length()[source]

Return sup - inf

map_in(interval_reference)[source]

Construct a new interval shifted of interval_reference.inf

map_x_in(x)[source]

Return x - inf

middle()[source]

Return interval middle

print_object()[source]

Print the interval

unmap_x_in(x)[source]

Return x + inf

zero_length()[source]

Return sup == inf

class PyOpenGLng.Tools.Interval.Interval2D(x, y)[source]

Bases: object

Two-dimension Interval

Initialise a 2D interval

x and y must support the __getitem__ interface

area()[source]

Return the area

bounding_box()[source]

Return the corresponding bounding box (x.inf, y.inf, x.sup, y.sup)

copy()[source]

Return a clone of the interval

diagonal()[source]

Return the diagonal length

enlarge(dx)[source]

Enlarge the interval of dx

intersect(i2)[source]

Does the interval intersect with i2?

is_empty()[source]
is_included_in(i2)[source]

Is the interval included in i2?

map_in(interval_reference)[source]

Construct a new interval shifted of interval_reference.inf

map_xy_in(x, y)[source]

Return x - y.inf, y - y.inf

middle()[source]

Return interval middle

print_object()[source]

Print the interval

shift(dx, dy)[source]

Shift the interval of dx

size()[source]

Return the horizontal and vertical size

unmap_xy_in(x, y)[source]

Return x + y.inf, y + y.inf

class PyOpenGLng.Tools.Interval.IntervalInt(*args)[source]

Bases: PyOpenGLng.Tools.Interval.Interval

One-dimension Integer Interval

Initialise an interval

array must support the __getitem__ interface

length()[source]

Return sup - inf +1

length_float()[source]

Return sup - inf

class PyOpenGLng.Tools.Interval.IntervalInt2D(x, y)[source]

Bases: PyOpenGLng.Tools.Interval.Interval2D

Two-dimension Integer Interval

Initialise a 2D Integer interval

x and y must support the __getitem__ interface

class PyOpenGLng.Tools.Interval.IntervalIntSupOpen(*args)[source]

Bases: PyOpenGLng.Tools.Interval.IntervalInt

One-dimension Integer Interval [inf, sup[

Initialise an interval

array must support the __getitem__ interface

intersect(i1, i2)[source]

Does the interval intersect with i2?

minus(i1, i2)[source]

Return i1 - i1 intersect i2

split(i1, i2)[source]

Split

Previous topic

4.1.4.2. EnumFactory

Next topic

4.1.4.4. Math

This Page