LineCollection#
- class data_morph.shapes.bases.line_collection.LineCollection(*lines: Iterable[Iterable[Number]])[source]#
Bases:
Shape
Class representing a shape consisting of one or more lines.
- Parameters:
*lines (Iterable[Iterable[numbers.Number]]) – An iterable of two (x, y) pairs representing the endpoints of a line.
- distance(x: Number, y: Number) float [source]#
Calculate the minimum distance from the lines of this shape to a point (x, y).
- Parameters:
x (numbers.Number) – Coordinates of a point in 2D space.
y (numbers.Number) – Coordinates of a point in 2D space.
- Returns:
The minimum distance from the lines of this shape to the point (x, y).
- Return type:
Notes
Implementation based on this Stack Overflow answer.
- classmethod get_name() str #
Get the name of the shape.
- Returns:
The name of the shape.
- Return type:
- lines#
An iterable of two (x, y) pairs representing the endpoints of a line.
- Type:
Iterable[Iterable[numbers.Number]]
- name: str | None = None#
The display name for the shape, if the lowercased class name is not desired.