pythagoras.utils module¶
- class pythagoras.utils.Phantom(x: float, y: float, zord: int = 0)[source]¶
Bases:
PObjectA zero-size placeholder element used for layout or reference.
- Variables:
x (float) – \(x\)-coordinate in Cartesian space.
y (float) – \(y\)-coordinate in Cartesian space.
- extrema() list[tuple[float, float]][source]¶
Computes the furthermost points of the figure.
- Returns:
A list with the bounding points of the object.
- 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.
- x: float¶
- y: float¶
- pythagoras.utils.cartesian_to_canvas(p: tuple[float, float], ctx: RenderingContext) tuple[float, float][source]¶
Converts a point in Cartesian coordinates into the canvas coordinate system.
- Parameters:
p – Point to be converted.
ctx – Properties associated to the canvas.
- Returns:
The point in canvas coordinates.