Skip to content

Circles

Circle primitives for creating circles in various ways.

API Reference

geolet.primitives.circles.api.Circle

Circle(p1: PointT, p2: PointT, p3: PointT, *, label: str = '', label_dir: str = 'N', label_pos: float = 0.0, color: str = 'black', style: str = 'solid', width: float = 1.0) -> CircleT

Create a circle through 3 points (circumcircle).

Parameters:

Name Type Description Default
p1 PointT

First point on the circle.

required
p2 PointT

Second point on the circle.

required
p3 PointT

Third point on the circle.

required
label str

Display label for the circle (empty string for no label).

''
label_dir str

Direction for label placement (N, NE, E, SE, S, SW, W, NW).

'N'
label_pos float

Relative position along path for label (0.0 = start, 1.0 = end).

0.0
color str

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

'black'
style str

Line style. One of: solid, dashed, dotted.

'solid'
width float

Line width in Asymptote units.

1.0

Returns:

Type Description
CircleT

A circumcircle drawable.


geolet.primitives.circles.api.CircleWithRadius

CircleWithRadius(center: PointT, radius: float, *, label: str = '', label_dir: str = 'N', label_pos: float = 0.0, color: str = 'black', style: str = 'solid', width: float = 1.0) -> CircleT

Create a circle with center and radius.

Parameters:

Name Type Description Default
center PointT

Center point of the circle.

required
radius float

Radius of the circle.

required
label str

Display label for the circle (empty string for no label).

''
label_dir str

Direction for label placement (N, NE, E, SE, S, SW, W, NW).

'N'
label_pos float

Relative position along path for label (0.0 = start, 1.0 = end).

0.0
color str

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

'black'
style str

Line style. One of: solid, dashed, dotted.

'solid'
width float

Line width in Asymptote units.

1.0

Returns:

Type Description
CircleT

A circle drawable satisfying CircleT protocol.


geolet.primitives.circles.api.CircleThroughPoint

CircleThroughPoint(center: PointT, through: PointT, *, label: str = '', label_dir: str = 'N', label_pos: float = 0.0, color: str = 'black', style: str = 'solid', width: float = 1.0) -> CircleT

Create a circle with center passing through a point.

Parameters:

Name Type Description Default
center PointT

Center point of the circle.

required
through PointT

Point that the circle passes through.

required
label str

Display label for the circle (empty string for no label).

''
label_dir str

Direction for label placement (N, NE, E, SE, S, SW, W, NW).

'N'
label_pos float

Relative position along path for label (0.0 = start, 1.0 = end).

0.0
color str

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

'black'
style str

Line style. One of: solid, dashed, dotted.

'solid'
width float

Line width in Asymptote units.

1.0

Returns:

Type Description
CircleT

A circle drawable satisfying CircleT protocol.

Examples

Circle Through Three Points

from geolet import Point, Circle, autofigure


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

    Circle(A, B, C, color="blue")

Circle With Radius

from geolet import Point, CircleWithRadius, autofigure


@autofigure
def circle_radius():
    O = Point("O", 0, 0, label_dir="SW")

    CircleWithRadius(O, 2, color="blue")
    CircleWithRadius(O, 3, color="red", style="dashed")

Circle Through Point

from geolet import Point, CircleThroughPoint, autofigure


@autofigure
def circle_through():
    O = Point("O", 0, 0, label_dir="SW")
    P = Point("P", 2, 1, label_dir="NE")

    CircleThroughPoint(O, P, color="blue")

Circumcircle of Triangle

from geolet import Point, Triangle, autofigure


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

    T = Triangle(A, B, C)
    T.circumcircle(color="blue")
    T.circumcenter(label="O", color="blue")