sorbetto.geometry.line_segment module

class sorbetto.geometry.line_segment.LineSegment(p1: Point, p2: Point, name: str | None = None)[source]

Bases: AbstractGeometricObject2D

This class is used to represent line segments. See https://en.wikipedia.org/wiki/Line_segment

draw(fig: Figure, ax: Axes, extent, **plt_kwargs)[source]

Plots the line segment in some given Pyplot axes. TODO: extent is currently ignored.

Parameters:
  • fig (_type_) – a Pyplot Figure object

  • ax (_type_) – a Pyplot Axes object

  • extent (_type_) – the axis-aligned box \((x_{min}, x_{max}, y_{min}, y_{max})\)

  • plt_kwargs – options for Pyplot’s plot command.

property p1: Point

The first endpoint.

Returns:

\(p_1\)

Return type:

Point

property p2: Point

The second endpoint.

Returns:

\(p_2\)

Return type:

Point