position.py
- class sc2.position.Pointlike(iterable=(), /)
- closest(ps)
This function assumes the 2d distance is meant
- distance_to(target)
Calculate a single distance from a point or unit to another point or unit
- distance_to_closest(ps)
This function assumes the 2d distance is meant :type ps:
Union
[Units
,Iterable
[Point2
]] :param ps:- Return type:
float
- distance_to_furthest(ps)
This function assumes the 2d distance is meant
- distance_to_point2(p)
Same as the function above, but should be a bit faster because of the dropped asserts and conversion.
- Parameters:
p (
Union
[Point2
,Tuple
[float
,float
]])- Return type:
float
- furthest(ps)
This function assumes the 2d distance is meant
- sort_by_distance(ps)
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.
- towards(p, distance=1, limit=False)
- unit_axes_towards(p)
- Parameters:
p
- class sc2.position.Point2(iterable=(), /)
- property as_PointI: PointI
Represents points on the minimap. Values must be between 0 and 64.
- static center(points)
Returns the central point for points in list
- circle_intersection(p, r)
self is point1, p is point2, r is the radius for circles originating in both points Used in ramp finding
- direction_vector(other)
Converts a vector to a direction that can face vertically, horizontally or diagonal or be zero, e.g. (0, 0), (1, -1), (1, 0)
- Return type:
- property length: float
This property exists in case Point2 is used as a vector.
- class sc2.position.Point3(iterable=(), /)
- class sc2.position.Size(iterable=(), /)