|
@@ -70,7 +70,7 @@ def read_image(filename, path_steps, volume_percent, angle_d):
|
70
|
70
|
if dist_curr < dist_min:
|
71
|
71
|
dist_min = dist_curr
|
72
|
72
|
|
73
|
|
- p_center = [ p_min[0] + (p_max[0] - p_min[0] )/2 , p_min[1] + (p_max[1] - p_min[1] )/2]
|
|
73
|
+ p_center = [ p_min[0] + (p_max[0] - p_min[0]) / 2, p_min[1] + (p_max[1] - p_min[1]) / 2 ]
|
74
|
74
|
|
75
|
75
|
# find min max for all rotatations
|
76
|
76
|
for segment in path:
|
|
@@ -127,16 +127,20 @@ def read_image(filename, path_steps, volume_percent, angle_d):
|
127
|
127
|
p = interpolate(p1, p2, f)
|
128
|
128
|
add_point(p)
|
129
|
129
|
|
130
|
|
- for n in range(0, len(points) - 1):
|
131
|
|
- for step in range(0, path_steps):
|
132
|
|
- add_segment(points[n], points[n + 1], step / path_steps)
|
|
130
|
+ def add_path(p1, p2):
|
|
131
|
+ l = math.sqrt((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2)
|
|
132
|
+ ps = max(1, int(path_steps * l))
|
|
133
|
+ for step in range(0, ps):
|
|
134
|
+ add_segment(p1, p2, step / ps)
|
133
|
135
|
|
134
|
|
- #add_point(points[len(points) - 1])
|
|
136
|
+ # walk path forwards
|
|
137
|
+ for n in range(0, len(points) - 1):
|
|
138
|
+ add_path(points[n], points[n + 1])
|
|
139
|
+ add_point(points[len(points) - 1])
|
135
|
140
|
|
|
141
|
+ # walk path backwards
|
136
|
142
|
for n in range(len(points) - 2, -1, -1):
|
137
|
|
- for step in range(0, path_steps):
|
138
|
|
- add_segment(points[n + 1], points[n], step / path_steps)
|
139
|
|
-
|
|
143
|
+ add_path(points[n + 1], points[n])
|
140
|
144
|
add_point(points[0])
|
141
|
145
|
|
142
|
146
|
return data
|
|
@@ -163,8 +167,8 @@ def main():
|
163
|
167
|
help="Samplerate of output file in Hz. Defaults to 44.1kHz.")
|
164
|
168
|
parser.add_argument("-v", "--volume", dest="volume", default=100.0, type=float,
|
165
|
169
|
help="Volume of output file in percent. Defaults to 100%%.")
|
166
|
|
- parser.add_argument("-i", "--interpolate", dest="interpolate", default=10, type=int,
|
167
|
|
- help="Steps on interpolated paths. Defaults to 10.")
|
|
170
|
+ parser.add_argument("-i", "--interpolate", dest="interpolate", default=3, type=int,
|
|
171
|
+ help="Steps on interpolated paths. Defaults to 3.")
|
168
|
172
|
parser.add_argument("-r", "--rotate", dest="angle_d", default=0.0, type=float,
|
169
|
173
|
help="Angle to rotate image, in degrees. Defaults to 0 deg.")
|
170
|
174
|
|