pythagoras.line module¶
- class pythagoras.line.Line(point: tuple[float, float], direction: Vector, zord: int = 0)[source]¶
Bases:
PObjectLine in \(\mathbf R^2\). Contrary to a
Pathobject, a line extends throughout the entirety of the canvas.- Variables:
point (tuple[float, float]) – A point that belongs to the line.
direction (pythagoras.vector.Vector) – Direction vector.
- extrema() list[tuple[float, float]][source]¶
Computes the furthermost points of the figure.
- Returns:
A list with the bounding points of the object.
- classmethod from_implicit(a: float, b: float, c: float, zord: int = 0) Self[source]¶
Creates a line from its implicit equation, where it is given as \(\ell : ax + by = c.\)
- Returns:
The line with that implicit equation.
- Raises:
ValueError – If both a and b are zero.
- classmethod from_two_points(p1: tuple[float, float], p2: tuple[float, float], zord: int = 0) Self[source]¶
Constructs the unique line that passes through two points.
- Parameters:
p1 – First point.
p2 – Second point.
- Returns:
A line that contains
p1andp2.
- property implicit: tuple[float, float, float]¶
Gives the line expressed in an implicit equation, where the numbers are the coefficients of \(x\) and \(y\), and the independent term (see
from_implicit()).
- point: tuple[float, float]¶
- svg(ctx: RenderingContext, *args: POProperty) str[source]¶
Compiles the object into SVG commands.
- Parameters:
ctx – Context associated with the
Canvasinstance.args – Properties of the object.
- Returns:
The corresponding SVG code.
- tikz(ctx: RenderingContext, *args: POProperty) str[source]¶
Compiles the object into a sequence of TikZ instructions.
- Parameters:
ctx – Context associated with the
Canvasinstance.args – Properties of the object.
- Returns:
The resulting TikZ code.