Example #1
0
 def __init__(self, id, lon, lat, t=None):
     self.id = id
     self.lon = lon
     self.lat = lat
     self.x, self.y = science.geo_project((self.lon, self.lat))
     self.paths = []    
     self.place = None
     self.city = None
     self.moving = False
     TimedDatum.__init__(self, t)        
Example #2
0
from housepy import science, drawing

SIZE = 500, 500
X, Y = 0, 1

brooklyn = [-73.9565, 40.7111]
manhattan = [-73.9735, 40.7697]

points = [brooklyn, manhattan]
points = [list(science.geo_project(point)) for point in points]


min_x = min([point[X] for point in points])
min_y = min([point[Y] for point in points])
points = [((point[X] - min_x), (point[Y] - min_y)) for point in points]

max_x = max([point[X] for point in points])
max_y = max([point[Y] for point in points])
factor = max(max_x, max_y)


def normalize_position(point, min_x, min_y, factor):
    point[X] -= min_x
    point[Y] -= min_y
    point[X] /= factor
    point[Y] /= factor
    return point


# for p, point in enumerate(points):
#     points[p] = normalize_position(point, min_x, min_y, factor)