sorbetto.geometry.line module
- class sorbetto.geometry.line.Line(a: float, b: float, c: float, name: str | None = None)[source]
Bases:
AbstractGeometricObject2DThis class is used to represent a line. \(a x + b y + c = 0\) See https://en.wikipedia.org/wiki/Line_(geometry)
- property a: float
The parameter \(a\) of the line \(a x + b y + c = 0\)
- Returns:
\(a\)
- Return type:
float
- property b: float
The parameter \(b\) of the line \(a x + b y + c = 0\)
- Returns:
\(b\)
- Return type:
float
- property c: float
The parameter \(c\) of the line \(a x + b y + c = 0\)
- Returns:
\(c\)
- Return type:
float
- draw(fig: Figure, ax: Axes, extent, **plt_kwargs)[source]
Draws the part of the line that is within some axis-aligned box in some given Pyplot axes.
- 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.
- getIntersectionWithAxisAlignedBox(extent) LineSegment | Point | None[source]
Computes the intersection of the line with any given axis-aligned box.
- Parameters:
extent (_type_) – the axis-aligned box \((x_{min}, x_{max}, y_{min}, y_{max})\)
- Returns:
the intersection, or None if there is no intersection.
- Return type:
LineSegment | Point | None
- getIntersectionWithLine(other: Self) Self | Point | None[source]
Computes the intersection of the line with another one.
- Parameters:
other (Self) – the other line
- Returns:
the intersection.
- Return type:
Self | Point | None