Points¶
Points are the fundamental building blocks for geometry diagrams.
API Reference¶
geolet.primitives.points.api.Point
¶
Create a point in 2D space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Display name for the point (e.g. 'A', 'P_1'). Empty string for unlabeled points that won't be drawn. |
required |
x
|
float
|
X coordinate. |
required |
y
|
float
|
Y coordinate. |
required |
label_dir
|
str
|
Direction to place label relative to point. One of: N, NE, E, SE, S, SW, W, NW. |
'NE'
|
color
|
str
|
Asymptote color name (e.g. 'black', 'red', 'blue'). |
'black'
|
Returns:
| Type | Description |
|---|---|
PointT
|
A point drawable satisfying PointT protocol. |
geolet.primitives.points.api.Midpoint
¶
Midpoint(p1: PointT, p2: PointT, *, label: str = '', label_dir: str = 'NE', color: str = 'black') -> PointT
Create the midpoint of two points.
Uses Asymptote's midpoint() function for the calculation.
If label is omitted/empty, the midpoint uses an inline expression and is not drawn. This is useful for compositions where the midpoint is needed as a reference but shouldn't be visible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
PointT
|
First point. |
required |
p2
|
PointT
|
Second point. |
required |
label
|
str
|
Display name for the midpoint (e.g. 'M'). Omit for hidden. |
''
|
label_dir
|
str
|
Direction to place label relative to point. One of: N, NE, E, SE, S, SW, W, NW. |
'NE'
|
color
|
str
|
Asymptote color name (e.g. 'black', 'red', 'blue'). |
'black'
|
Returns:
| Type | Description |
|---|---|
PointT
|
A midpoint drawable satisfying PointT protocol. |
Examples¶
Basic Points¶
from geolet import Point, autofigure
@autofigure
def basic_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")
Colored Points¶
from geolet import Point, autofigure
@autofigure
def colored_points():
A = Point("A", 0, 0, color="red")
B = Point("B", 2, 0, color="blue")
C = Point("C", 1, 2, color="green")