middle of massive restructure, everything still broken

This commit is contained in:
Grant Sanderson
2015-10-27 21:00:50 -07:00
parent 096c5c1890
commit 2e074afb60
46 changed files with 791 additions and 3970 deletions

View File

@ -93,6 +93,38 @@ def random_color():
color.set_rgb([1 - 0.5 * random() for x in range(3)])
return color
################################################
def straight_path(start_points, end_points, alpha):
return (1-alpha)*start_points + alpha*end_points
def path_along_arc(arc_angle):
"""
If vect is vector from start to end, [vect[:,1], -vect[:,0]] is
perpendicualr to vect in the left direction.
"""
if arc_angle == 0:
return straight_path
def path(start_points, end_points, alpha):
vects = end_points - start_points
centers = start_points + 0.5*vects
if arc_angle != np.pi:
for i, b in [(0, -1), (1, 1)]:
centers[:,i] += 0.5*b*vects[:,1-i]/np.tan(arc_angle/2)
return centers + np.dot(
start_points-centers,
np.transpose(rotation_about_z(alpha*arc_angle))
)
return path
def clockwise_path():
return path_along_arc(np.pi)
def counterclockwise_path():
return path_along_arc(-np.pi)
################################################
def to_cammel_case(name):