geom2d.polyline

Polyline functions.

A polyline being a series of connected straight line segments.

geom2d.polyline.closest_point(polyline: Iterable[Sequence[float]], p: Sequence[float], vertices_only: bool = False) P

Get the closest point on a polyline to point p.

Parameters:
  • polyline – An iterable of vertices.

  • p – Reference point.

  • vertices_only – Closest vertices only. Otherwise normal projection on closest segment.

geom2d.polyline.is_inside(polypath1: Iterable[Sequence[Sequence[float]]], polypath2: Iterable[Sequence[Sequence[float]]]) bool

Is polypath1 inside polypath2?

geom2d.polyline.polyline_length(polyline: Iterable[Sequence[float]]) float

Total cumulative length of polyline.

geom2d.polyline.polyline_length_to(polyline: Iterable[Sequence[float]], p: Sequence[float]) float

Distance along polyline from start point to a point on the polyline.

geom2d.polyline.polyline_to_polypath(polyline: Iterable[Sequence[float]]) Iterator[Line]

Convert a polyline to a polypath.

Parameters:

polyline – An iterable of vertices.

Returns:

An iterable of line segments.

geom2d.polyline.polypath_is_closed(polypath: Sequence[Sequence[Sequence[float]]]) bool

True if polypath is a closed polygon.

geom2d.polyline.polypath_length(polypath: Iterable[Sequence[Sequence[float]]]) float

Total cumulative length of polypath.

geom2d.polyline.polypath_length_to(polypath: Iterable[Line], p: Sequence[float]) float

Distance along polypath from start point to a point on the polypath.

geom2d.polyline.polypath_reversed(polypath: Sequence[Line]) list[Line]

Reverse a polypath.

geom2d.polyline.polypath_to_polyline(polypath: Iterable[Sequence[Sequence[float]]]) Iterator[P]

Convert a polypath to a polyline.

Parameters:

polypath – An iterable of line segments.

Returns:

A polyline as an iterable of vertices.

geom2d.polyline.segment_intersects(polyline: Iterable[Sequence[float]], segment: Line) bool

Return True if the segment intersects polyline.