Location
Represent positions, update coordinates, and measure distances.
- class pydraw.location.Location(x: float, y: float)
- class pydraw.location.Location(location: Location)
- class pydraw.location.Location(xy: Tuple[float, float])
Bases:
object- clone()
Clone the Location
- Returns:
a new Location with the same x and y as this one.
- distance(location) float
Returns the distance between this location and another
- Parameters:
location – the Location to get the distance to
- Returns:
a float
- move(dx: float, dy: float) Location
- move(location: Location) Location
- move(dxy: Tuple[float, float]) Location
- move(*, dx: float = ..., dy: float = ...) Location
Moves the location by a specified difference.
Can take two numbers (dx, dy), a tuple, or a Location
- Parameters:
dx – the dx to move by
dy – the dy to move by
- Returns:
the location (after change)
- moveto(x: float, y: float) Location
- moveto(location: Location) Location
- moveto(xy: Tuple[float, float]) Location
- moveto(*, x: float = ..., y: float = ...) Location
Moves the location to a new location!
Can take two coordinates (x, y), a tuple, or a Location
- Parameters:
x – the x to move to
y – the y to move to
- Returns:
the location (after change)
- x(new_x: float = None) float
- y(new_y: float = None) float