Point
A 2D point.
Usage
Point()Parameters
x: float = 0.0-
The x coordinate.
y: float = 0.0-
The y coordinate.
Methods
| Name | Description |
|---|---|
| as_tuple() | Convert to a tuple. |
| distance_to() | Calculate distance to another point. |
| translate() | Return a new point translated by (dx, dy). |
as_tuple()
Convert to a tuple.
Usage
as_tuple()Returns
tuple-
(x, y) tuple.
distance_to()
Calculate distance to another point.
Usage
distance_to(other)Parameters
other: Point-
The other point.
Returns
float-
Euclidean distance.
translate()
Return a new point translated by (dx, dy).
Usage
translate(dx, dy)Parameters
dx: float-
Horizontal offset.
dy: float-
Vertical offset.
Returns
Point-
New translated point.