position.py#
- class sc2.position.Pointlike(iterable=(), /)[source]#
- closest(ps: Units | Iterable[Point2]) Unit | Point2 [source]#
This function assumes the 2d distance is meant
- distance_to(target: Unit | Point2) float [source]#
Calculate a single distance from a point or unit to another point or unit
- distance_to_closest(ps: Units | Iterable[Point2]) float [source]#
This function assumes the 2d distance is meant :type ps:
Units
|Iterable
[Point2
] :param ps:- Return type:
float
- distance_to_furthest(ps: Units | Iterable[Point2]) float [source]#
This function assumes the 2d distance is meant
- distance_to_point2(p: Point2 | tuple[float, float]) float [source]#
Same as the function above, but should be a bit faster because of the dropped asserts and conversion.
- Parameters:
p (
Point2
|tuple
[float
,float
])- Return type:
float
- furthest(ps: Units | Iterable[Point2]) Unit | Pointlike [source]#
This function assumes the 2d distance is meant
- sort_by_distance(ps: Units | Iterable[Point2]) list[Point2] [source]#
This returns the target points sorted as list. You should not pass a set or dict since those are not sortable. If you want to sort your units towards a point, use ‘units.sorted_by_distance_to(point)’ instead.
- class sc2.position.Point2(iterable=(), /)[source]#
- property as_PointI: PointI#
Represents points on the minimap. Values must be between 0 and 64.
- circle_intersection(p: Point2, r: int | float) set[Point2] [source]#
self is point1, p is point2, r is the radius for circles originating in both points Used in ramp finding
- direction_vector(other: Point2) Point2 [source]#
Converts a vector to a direction that can face vertically, horizontally or diagonal or be zero, e.g. (0, 0), (1, -1), (1, 0)
- property length: float#
This property exists in case Point2 is used as a vector.