trimesh.interval module

interval.py

Deal with 1D intervals which are defined by:

[start position, end position]

Functions

check(a, b, digits)

Check input ranges, convert them to vector form, and get a fixed precision integer version of them.

intersection(a, b[, digits])

Given a pair of ranges, merge them in to

trimesh.interval.check(a, b, digits)

Check input ranges, convert them to vector form, and get a fixed precision integer version of them.

Parameters
  • a ((2, ) or (2, n) float) – Start and end of a 1D interval

  • b ((2, ) or (2, n) float) – Start and end of a 1D interval

  • digits (int) – How many digits to consider

Returns

  • a ((2, n) float) – Ranges as vector

  • b ((2, n) float) – Ranges as vector

  • a_int ((2, n) int64) – Ranges rounded to digits, as vector

  • b_int ((2, n) int64) – Ranges rounded to digits, as vector

  • is_1D (bool) – If True, input was single pair of ranges

trimesh.interval.intersection(a, b, digits=8)

Given a pair of ranges, merge them in to one range if they overlap at all

Parameters
  • a ((2, ) float) – Start and end of a 1D interval

  • b ((2, ) float) – Start and end of a 1D interval

  • digits (int) – How many digits to consider

Returns

  • intersects (bool or (n,) bool) – Indicates if the ranges overlap at all

  • new_range ((2, ) or (2, 2) float) – The unioned range from the two inputs, or both of the original ranges if not overlapping