Skip to content

Triangle Centers

Special points associated with triangles.


centroid

def centroid(
    p1: Point,
    p2: Point,
    p3: Point,
    label: str = "",
    *,
    label_dir: str = "NE",
    color: str = "black",
) -> Point

Create the centroid of a triangle.

The centroid is the intersection of the medians (lines from each vertex to the midpoint of the opposite side). It is also the center of mass of the triangle.

Parameters:

Name Type Default Description
p1 Point required First vertex
p2 Point required Second vertex
p3 Point required Third vertex
label str "" Display label (empty for hidden point)
label_dir str "NE" Direction for label placement
color str "black" Color for the point

Returns: A Point at the centroid of the triangle.

Example

"""Centroid example - intersection of medians."""

from geolet import autofigure, centroid, point, segment


@autofigure
def centroid_():
    A = point(0, 4, "A", label_dir="N")
    B = point(0, 0, "B", label_dir="SW")
    C = point(5, 0, "C", label_dir="SE")

    seg_AB = segment(A, B)
    seg_BC = segment(B, C)
    seg_CA = segment(C, A)

    # Centroid (intersection of medians)
    G = centroid(A, B, C, "G", color="red")

Centroid


orthocenter

def orthocenter(
    p1: Point,
    p2: Point,
    p3: Point,
    label: str = "",
    *,
    label_dir: str = "NE",
    color: str = "black",
) -> Point

Create the orthocenter of a triangle.

The orthocenter is the intersection of the altitudes (perpendiculars from each vertex to the opposite side).

Parameters:

Name Type Default Description
p1 Point required First vertex
p2 Point required Second vertex
p3 Point required Third vertex
label str "" Display label (empty for hidden point)
label_dir str "NE" Direction for label placement
color str "black" Color for the point

Returns: A Point at the orthocenter of the triangle.

Example

"""Orthocenter example - intersection of altitudes."""

from geolet import autofigure, orthocenter, point, segment


@autofigure
def orthocenter_():
    A = point(1, 4, "A", label_dir="N")
    B = point(0, 0, "B", label_dir="SW")
    C = point(5, 0, "C", label_dir="SE")

    seg_AB = segment(A, B)
    seg_BC = segment(B, C)
    seg_CA = segment(C, A)
    H = orthocenter(A, B, C, "H", color="red")

Orthocenter


circumcenter

def circumcenter(
    p1: Point,
    p2: Point,
    p3: Point,
    label: str = "",
    *,
    label_dir: str = "NE",
    color: str = "black",
) -> Point

Create the circumcenter of a triangle.

The circumcenter is the intersection of the perpendicular bisectors (perpendiculars through the midpoints of each side). It is the center of the circumcircle.

Parameters:

Name Type Default Description
p1 Point required First vertex
p2 Point required Second vertex
p3 Point required Third vertex
label str "" Display label (empty for hidden point)
label_dir str "NE" Direction for label placement
color str "black" Color for the point

Returns: A Point at the circumcenter of the triangle.

Example

"""Circumcenter example - center of circumscribed circle."""

from geolet import autofigure, circumcenter, circumcircle, point, segment


@autofigure
def circumcenter_():
    A = point(0, 0, "A", label_dir="SW")
    B = point(5, 0, "B", label_dir="SE")
    C = point(2, 4, "C", label_dir="N")

    seg_AB = segment(A, B)
    seg_BC = segment(B, C)
    seg_CA = segment(C, A)

    O = circumcenter(A, B, C, "O", color="red")
    circ = circumcircle(A, B, C, color="blue", style="dashed")

Circumcenter


incenter

def incenter(
    p1: Point,
    p2: Point,
    p3: Point,
    label: str = "",
    *,
    label_dir: str = "NE",
    color: str = "black",
) -> Point

Create the incenter of a triangle.

The incenter is the intersection of the angle bisectors. It is the center of the incircle.

Parameters:

Name Type Default Description
p1 Point required First vertex
p2 Point required Second vertex
p3 Point required Third vertex
label str "" Display label (empty for hidden point)
label_dir str "NE" Direction for label placement
color str "black" Color for the point

Returns: A Point at the incenter of the triangle.

Example

"""Incenter example - intersection of angle bisectors."""

from geolet import autofigure, incenter, incircle, point, segment


@autofigure
def incenter_():
    A = point(1, 4, "A", label_dir="N")
    B = point(0, 0, "B", label_dir="SW")
    C = point(5, 0, "C", label_dir="SE")

    seg_AB = segment(A, B)
    seg_BC = segment(B, C)
    seg_CA = segment(C, A)
    circ = incircle(A, B, C, color="blue")
    I = incenter(A, B, C, "I", color="red")

Incenter