Skip to content

Angles

Angle marking for geometry diagrams.

API Reference

geolet.primitives.angles.api.Angle

Angle(p1: PointT, p2: PointT, p3: PointT, *, label: str = '', n: int = 1, radius: float = 0.4, color: str = 'black', fill: bool = False, right_angle: bool = False) -> AngleT

Create an angle marking at a vertex between two rays.

Uses standard geometry notation: Angle(A, B, C) marks the angle ABC, which is the angle at vertex B with rays BA and BC.

Uses Asymptote's markangle function from the markers module to draw an arc marking the angle (counterclockwise from first ray to second).

Parameters:

Name Type Description Default
p1 PointT

First point (A in angle ABC).

required
p2 PointT

The vertex of the angle (B in angle ABC, where the arc is drawn).

required
p3 PointT

Third point (C in angle ABC).

required
label str

Angle label (e.g. "\alpha", "45°"). Empty for no label.

''
n int

Number of arc marks (1, 2, 3 for congruent angle notation).

1
radius float

Arc radius in cm.

0.4
color str

Asymptote color name (e.g. 'black', 'red', 'blue').

'black'
fill bool

Fill the angle sector with semi-transparent color.

False
right_angle bool

Draw square marker for 90° angles instead of arc.

False

Returns:

Type Description
AngleT

An angle marking drawable satisfying AngleT protocol.

Examples

Basic Angle Marking

from geolet import Point, Segment, Angle, autofigure


@autofigure
def angle_example():
    A = Point("A", 3, 2, label_dir="NE")
    B = Point("B", 0, 0, label_dir="SW")
    C = Point("C", 4, 0, label_dir="SE")

    Segment(B, A)
    Segment(B, C)

    # Mark angle ABC at vertex B
    Angle(A, B, C, label=r"$\alpha$")

Right Angle

from geolet import Point, Segment, Angle, autofigure


@autofigure
def right_angle():
    A = Point("A", 0, 2, label_dir="N")
    B = Point("B", 0, 0, label_dir="SW")
    C = Point("C", 3, 0, label_dir="SE")

    Segment(B, A)
    Segment(B, C)

    # Square marker for 90° angle
    Angle(A, B, C, right_angle=True)

Multiple Arc Marks

from geolet import Point, Segment, Angle, autofigure


@autofigure
def congruent_angles():
    A = Point("A", 0, 0, label_dir="SW")
    B = Point("B", 4, 0, label_dir="SE")
    C = Point("C", 2, 3, label_dir="N")

    Segment(A, B)
    Segment(B, C)
    Segment(C, A)

    # Mark congruent angles with same number of arcs
    Angle(B, A, C, n=2, color="blue")
    Angle(A, B, C, n=1, color="red")
    Angle(A, C, B, n=2, color="blue")

Filled Angle

from geolet import Point, Segment, Angle, autofigure


@autofigure
def filled_angle():
    A = Point("A", 2, 2, label_dir="NE")
    B = Point("B", 0, 0, label_dir="SW")
    C = Point("C", 3, 0, label_dir="SE")

    Segment(B, A)
    Segment(B, C)

    Angle(A, B, C, fill=True, color="blue")