range steps

This commit is contained in:
Frank 2015-03-26 20:36:59 -04:00
parent dca094220b
commit 9315b91d23
1 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,4 @@
from math import sin, cos, atan2, radians
from math import sin, cos, atan2, radians, sqrt
def get_step(start, end, speed):
x0, y0 = start
@ -28,3 +28,10 @@ def get_points_on_circle(center, radius, count, offset=0):
current_angle + offset))
current_angle += angle_step
return points
def get_range_steps(start, end, count):
for ii in xrange(count):
yield start + (end - start) * ii / float(count - 1)
def get_distance(p0, p1):
return sqrt((p0[0] - p1[0]) ** 2 + (p0[1] - p1[1]) ** 2)