Triangle Centers¶
Special points and circles associated with triangles.
API Reference¶
geolet.primitives.centers.api.Centroid
¶
Centroid(p1: PointT, p2: PointT, p3: PointT, *, label: str = '', label_dir: str = 'NE', color: str = 'black') -> IntersectionPoint
Create centroid of a triangle (intersection of medians).
Pure composition: intersects two median segments (with inline midpoints).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
PointT
|
First vertex of triangle. |
required |
p2
|
PointT
|
Second vertex of triangle. |
required |
p3
|
PointT
|
Third vertex of triangle. |
required |
label
|
str
|
Display name for the centroid (e.g. 'G'). Omit for hidden. |
''
|
label_dir
|
str
|
Direction to place label relative to point. |
'NE'
|
color
|
str
|
Asymptote color name. |
'black'
|
Returns:
| Type | Description |
|---|---|
IntersectionPoint
|
The centroid point. |
geolet.primitives.centers.api.Orthocenter
¶
Orthocenter(p1: PointT, p2: PointT, p3: PointT, *, label: str = '', label_dir: str = 'NE', color: str = 'black') -> IntersectionPoint
Create orthocenter of a triangle (intersection of altitudes).
Pure composition: intersects two altitude lines (perpendiculars from vertices to opposite sides).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
PointT
|
First vertex of triangle. |
required |
p2
|
PointT
|
Second vertex of triangle. |
required |
p3
|
PointT
|
Third vertex of triangle. |
required |
label
|
str
|
Display name for the orthocenter (e.g. 'H'). Omit for hidden. |
''
|
label_dir
|
str
|
Direction to place label relative to point. |
'NE'
|
color
|
str
|
Asymptote color name. |
'black'
|
Returns:
| Type | Description |
|---|---|
IntersectionPoint
|
The orthocenter point. |
geolet.primitives.centers.api.Circumcenter
¶
Circumcenter(p1: PointT, p2: PointT, p3: PointT, *, label: str = '', label_dir: str = 'NE', color: str = 'black') -> IntersectionPoint
Create circumcenter of a triangle (intersection of perpendicular bisectors).
Pure composition: intersects two perpendicular bisector lines. The circumcenter is equidistant from all three vertices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
PointT
|
First vertex of triangle. |
required |
p2
|
PointT
|
Second vertex of triangle. |
required |
p3
|
PointT
|
Third vertex of triangle. |
required |
label
|
str
|
Display name for the circumcenter (e.g. 'O'). Omit for hidden. |
''
|
label_dir
|
str
|
Direction to place label relative to point. |
'NE'
|
color
|
str
|
Asymptote color name. |
'black'
|
Returns:
| Type | Description |
|---|---|
IntersectionPoint
|
The circumcenter point. |
geolet.primitives.centers.api.Incenter
¶
Incenter(p1: PointT, p2: PointT, p3: PointT, *, label: str = '', label_dir: str = 'NE', color: str = 'black') -> IntersectionPoint
Create incenter of a triangle (intersection of angle bisectors).
Pure composition: intersects two angle bisector lines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
PointT
|
First vertex of triangle. |
required |
p2
|
PointT
|
Second vertex of triangle. |
required |
p3
|
PointT
|
Third vertex of triangle. |
required |
label
|
str
|
Display name for the incenter (e.g. 'I'). Omit for hidden. |
''
|
label_dir
|
str
|
Direction to place label relative to point. |
'NE'
|
color
|
str
|
Asymptote color name. |
'black'
|
Returns:
| Type | Description |
|---|---|
IntersectionPoint
|
The incenter point. |
geolet.primitives.centers.api.Incircle
¶
Incircle(p1: PointT, p2: PointT, p3: PointT, *, color: str = 'black', style: str = 'solid', width: float = 1.0) -> CircleT
Create incircle of a triangle (inscribed circle).
Pure composition: Incenter -> Foot -> CircleThroughPoint. The incircle has its center at the incenter and passes through the foot of the perpendicular from incenter to any side.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
PointT
|
First vertex of triangle. |
required |
p2
|
PointT
|
Second vertex of triangle. |
required |
p3
|
PointT
|
Third vertex of triangle. |
required |
color
|
str
|
Asymptote color name. |
'black'
|
style
|
str
|
Line style. One of: solid, dashed, dotted. |
'solid'
|
width
|
float
|
Line width in Asymptote units. |
1.0
|
Returns:
| Type | Description |
|---|---|
CircleT
|
The incircle. |
geolet.primitives.centers.api.Median
¶
Median(vertex: PointT, p1: PointT, p2: PointT, *, color: str = 'black', style: str = 'solid', width: float = 1.0) -> SegmentT
Create a median of a triangle (segment from vertex to midpoint of opposite side).
Pure composition: Segment(vertex, Midpoint(p1, p2)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex
|
PointT
|
The vertex the median starts from. |
required |
p1
|
PointT
|
First endpoint of the opposite side. |
required |
p2
|
PointT
|
Second endpoint of the opposite side. |
required |
color
|
str
|
Asymptote color name. |
'black'
|
style
|
str
|
Line style. One of: solid, dashed, dotted. |
'solid'
|
width
|
float
|
Line width in Asymptote units. |
1.0
|
Returns:
| Type | Description |
|---|---|
SegmentT
|
The median segment. |
geolet.primitives.centers.api.Foot
¶
Foot(point: PointT, to: SegmentT | LineT, *, label: str = '', label_dir: str = 'NE', color: str = 'black') -> IntersectionPoint
Create foot of perpendicular from a point to a line or segment.
The foot is where the perpendicular from point meets the line. This is pure composition: Intersection(Line(p1,p2), PerpendicularLine(point, to)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
PointT
|
The point from which the perpendicular is drawn. |
required |
to
|
SegmentT | LineT
|
The line or segment to which the perpendicular is drawn. |
required |
label
|
str
|
Display name for the foot (e.g. 'H'). Omit for hidden. |
''
|
label_dir
|
str
|
Direction to place label relative to point. |
'NE'
|
color
|
str
|
Asymptote color name. |
'black'
|
Returns:
| Type | Description |
|---|---|
IntersectionPoint
|
The foot intersection point. |
Examples¶
Triangle Centers via Triangle Methods¶
The easiest way to access triangle centers is through Triangle methods:
from geolet import Point, Triangle, autofigure
@autofigure
def triangle_centers():
A = Point("A", 0, 0, label_dir="SW")
B = Point("B", 6, 0, label_dir="SE")
C = Point("C", 2, 4, label_dir="N")
T = Triangle(A, B, C)
T.centroid(label="G", color="blue")
T.orthocenter(label="H", color="red")
T.circumcenter(label="O", color="green")
T.incenter(label="I", color="purple")
Euler Line¶
The orthocenter, centroid, and circumcenter lie on a line:
from geolet import Point, Triangle, Line, autofigure
@autofigure
def euler_line():
A = Point("A", 0, 0, label_dir="SW")
B = Point("B", 6, 0, label_dir="SE")
C = Point("C", 2, 5, label_dir="N")
T = Triangle(A, B, C)
H = T.orthocenter(label="H", color="red")
G = T.centroid(label="G", color="blue")
O = T.circumcenter(label="O", color="green")
Line(H, O, color="purple", style="dashed")
Incircle and Circumcircle¶
from geolet import Point, Triangle, autofigure
@autofigure
def triangle_circles():
A = Point("A", 0, 0, label_dir="SW")
B = Point("B", 5, 0, label_dir="SE")
C = Point("C", 2, 4, label_dir="N")
T = Triangle(A, B, C)
T.incircle(color="blue")
T.incenter(label="I", color="blue")
T.circumcircle(color="red")
T.circumcenter(label="O", color="red")
Altitude and Foot¶
from geolet import Point, Segment, Foot, autofigure
@autofigure
def altitude():
A = Point("A", 1, 3, label_dir="N")
B = Point("B", 0, 0, label_dir="SW")
C = Point("C", 4, 0, label_dir="SE")
Segment(A, B)
bc = Segment(B, C)
Segment(C, A)
# Foot of altitude from A to BC
H = Foot(A, bc, label="H", label_dir="S")
Segment(A, H, style="dashed", color="blue")