Convert supervision/geometry/utils.py docstrings to doctests
--- Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
This commit is contained in:
committed by
Jirka Borovec
co-authored by
copilot-swe-agent[bot]
parent
91ff090168
commit
a9dad95fa7
@@ -20,14 +20,14 @@ def get_polygon_center(polygon: np.ndarray) -> Point:
|
||||
ValueError: If the polygon has no vertices.
|
||||
|
||||
Examples:
|
||||
```python
|
||||
import numpy as np
|
||||
import supervision as sv
|
||||
|
||||
polygon = np.array([[0, 0], [0, 2], [2, 2], [2, 0]])
|
||||
sv.get_polygon_center(polygon=polygon)
|
||||
# Point(x=1, y=1)
|
||||
```
|
||||
>>> import numpy as np
|
||||
>>> import supervision as sv
|
||||
>>> polygon = np.array([[0, 0], [0, 2], [2, 2], [2, 0]])
|
||||
>>> center = sv.get_polygon_center(polygon=polygon)
|
||||
>>> float(center.x)
|
||||
1.0
|
||||
>>> float(center.y)
|
||||
1.0
|
||||
"""
|
||||
|
||||
# This is one of the 3 candidate algorithms considered for centroid calculation.
|
||||
|
||||
Reference in New Issue
Block a user