Polyline.divide_by_length
- Polyline.divide_by_length(length, strict=True, tol=None)[source]
Divide a polyline in segments of a given length.
- Parameters:
- lengthfloat
Length of the segments.
- strictbool, optional
If False, the remainder segment will be added even if it is smaller than the desired length
- tolfloat, optional
Floating point error tolerance. Defaults to TOL.absolute.
- Returns:
- list[
compas.geometry.Point
]
- list[
Notes
The points of the new polyline are constrained to the segments of the old polyline. However, since the old points are not part of the new set of points, the geometry of the polyline will change.
Examples
>>> polyline = Polyline([(0, 0, 0), (1, 1, 0), (2, 3, 0), (4, 4, 0), (5, 2, 0)]) >>> len(polyline.divide_by_length(3)) 3
>>> polyline = Polyline([(0, 0, 0), (1, 1, 0), (2, 3, 0), (4, 4, 0), (5, 2, 0)]) >>> len(polyline.divide_by_length(3, strict=False)) 4