linspace

compas.utilities.linspace(start, stop, num=50)[source]

Generate a sequence of evenly spaced numbers over a specified interval.

Parameters
  • start (float) – The start value of the sequence.

  • stop (float) – The end value of the sequence.

  • num (int) – The number of elements in the sequence.

Yields

float – The next value in the sequence.

References

This function mimicks the functionality of numpy.linspace 1, but in a simpler form.

1

numpy.linspace Available at https://numpy.org/doc/stable/reference/generated/numpy.linspace.html

Examples

>>> from compas.utilities import linspace
>>> list(linspace(0, 1, 3))
[0.0, 0.5, 1.0]