pythagoras.angle module

class pythagoras.angle.Angle(p1: tuple[float, float], p2: tuple[float, float], p3: tuple[float, float], radius: float = 1, zord: int = 0)[source]

Bases: PObject

An angle described by three points and its radius, following the right-hand rule.

Variables:
  • p1 (tuple[float, float]) – Starting point.

  • p2 (tuple[float, float]) – Corner of the angle.

  • p3 (tuple[float, float]) – End point.

  • radius (float) – Radius of the arc.

extrema() list[tuple[float, float]][source]

Computes the furthermost points of the figure.

Returns:

A list with the bounding points of the object.

p1: tuple[float, float]
p2: tuple[float, float]
p3: tuple[float, float]
radius: float
svg(ctx: RenderingContext, *args: POProperty) str[source]

Compiles the object into SVG commands.

Parameters:
  • ctx – Context associated with the Canvas instance.

  • 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 Canvas instance.

  • args – Properties of the object.

Returns:

The resulting TikZ code.

class pythagoras.angle.RAngle(p1: tuple[float, float], p2: tuple[float, float], p3: tuple[float, float], radius: float = 1, zord: int = 0)[source]

Bases: Angle

A special type of Angle instance, where the shape is drawn with straight lines instead of an arc. This results in a square whenever the angle measures 90 degrees, and a rhombus otherwise.

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 Canvas instance.

  • 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 Canvas instance.

  • args – Properties of the object.

Returns:

The resulting TikZ code.