Be consistent and pythonic in naming functions.
draw_arrow instead of drawArrow
YouUse comprehensions instead of creating empty list and appending to it in a for loop. It's both faster and easier to read.
def translate(coords, vector):
# Translates a list of coordinate tuples over a vector tuple
return tuple(tuple(map(operator.add, c, vector)) for c in coords)
def mirror(coords):
# Takes a list of coordinate tuples and mirrors it across the first element of
# the first tuple
# Formula: 2 * base - original
base = coords[0]
double_base = tuple(map(operator.mul, base, len(base) * (2,) ))
return tuple(tuple(map(operator.sub, double_base, cord)) for c in coords)
Why have a function that returns a constant value. Why creating a variable when you can just return the value.
def get_arrow_coords():
return [...]
# or if you worry about mutability - use tuples. They actually faster if you wouldn't try to modify them (creating new ones from old ones) a lot.
arrow_coords = ...
You can also use collections.namedtuple('Size', 'height width') instead of using plain tuples for sizes. This would improve readability a little.
And I'm not sure, but maybe you would benefit from using numpy as it seems that you're doing some matrices work.