Commit 3848bbf4 authored by Alan Taylor's avatar Alan Taylor

float tidy

parent 0e67822a
......@@ -98,10 +98,10 @@ def delete_blocks(settings, cl_args):
contains core information about the image to be rendered
cl_args : list [min_x, max_x, min_y, max_y]
where:
min_x : int, value between 0.0 and 1.0
max_x : int, value between 0.0 and 1.0
min_y : int, value between 0.0 and 1.0
max_y : int, value between 0.0 and 1.0
min_x : float, value between 0.0 and 1.0
max_x : float, value between 0.0 and 1.0
min_y : float, value between 0.0 and 1.0
max_y : float, value between 0.0 and 1.0
--------------------------------------------------------------------------
returns : none
--------------------------------------------------------------------------
......
......@@ -160,7 +160,7 @@ def _dist_norm(settings, block, centre, max_dist, data_point):
--------------------------------------------------------------------------
"""
dist_from_centre = abs(centre - data_point(settings, block))
return abs(math.cos((dist_from_centre * math.pi) / (2.0 * max_dist)))
return abs(math.cos((dist_from_centre * math.pi) / (2 * max_dist)))
def _bl1_get_block_sizes(settings, min_blocks, max_tiles_x, max_tiles_y):
......@@ -386,8 +386,8 @@ def _block_layout_3(settings, min_blocks):
# unless the blocks become so narrow that we have no choice
fact = _factors(min_blocks)
image_aspect = settings['image_x'] / settings['image_y']
x_wide_blocks_narrow = ((settings['image_x'] / min_blocks) < 8) and (image_aspect >= 1.0)
y_tall_blocks_narrow = ((settings['image_y'] / min_blocks) < 8) and (image_aspect <= 1.0)
x_wide_blocks_narrow = ((settings['image_x'] / min_blocks) < 8) and (image_aspect >= 1)
y_tall_blocks_narrow = ((settings['image_y'] / min_blocks) < 8) and (image_aspect <= 1)
if x_wide_blocks_narrow or y_tall_blocks_narrow:
# increase the number of blocks until we can find at least 3 factors,
# which will allow both h and v to be > 1
......@@ -401,8 +401,8 @@ def _block_layout_3(settings, min_blocks):
for n_blocks_y in fact:
n_blocks_x = min_blocks // n_blocks_y
block_aspect = n_blocks_x / n_blocks_y
both_landscape = (image_aspect >= 1.0) and (block_aspect >= 1.0)
both_portrait = (image_aspect <= 1.0) and (block_aspect <= 1.0)
both_landscape = (image_aspect >= 1) and (block_aspect >= 1)
both_portrait = (image_aspect <= 1) and (block_aspect <= 1)
if both_landscape or both_portrait:
options.append((n_blocks_x, n_blocks_y))
aspect.append(block_aspect)
......@@ -811,7 +811,7 @@ def _value_range(val):
--------------------------------------------------------------------------
"""
val = float(val)
if val < 0.0 or val > 1.0:
if val < 0 or val > 1:
raise argparse.ArgumentTypeError(str(val) + ' not in range 0.0 - 1.0')
return val
......
......@@ -128,10 +128,10 @@ def area_in_blocks(settings, cl_args):
contains core information about the image to be rendered
cl_args : list [min_x, max_x, min_y, max_y]
where:
min_x : int, value between 0.0 and 1.0
max_x : int, value between 0.0 and 1.0
min_y : int, value between 0.0 and 1.0
max_y : int, value between 0.0 and 1.0
min_x : float, value between 0.0 and 1.0
max_x : float, value between 0.0 and 1.0
min_y : float, value between 0.0 and 1.0
max_y : float, value between 0.0 and 1.0
--------------------------------------------------------------------------
yields
generated series of ints, block numbers
......@@ -200,8 +200,8 @@ def _dist_from_centre(settings, block_number):
--------------------------------------------------------------------------
"""
x_min, y_min, x_max, y_max = render_block_normal(settings, block_number)
block_centre_x = (x_max + x_min) / 2.0
block_centre_y = (y_max + y_min) / 2.0
block_centre_x = (x_max + x_min) / 2
block_centre_y = (y_max + y_min) / 2
dxc = (0.5 - block_centre_x) * (settings['image_x'] / settings['image_y'])
dyc = 0.5 - block_centre_y
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment