Skip to content

Commit

Permalink
docs: better formatting for example 5
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Aug 6, 2020
1 parent 2293dc7 commit 88668f3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/example_05_draw_tiles_on_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

def measurement(x, y, w, h, a=8) -> float:
"""some measurement that you want to display"""
return min(max(0, math.exp(
- a*(2*(x / w - 0.5)) ** 2
- a*(2*(y / h - 0.5)) ** 2
) + random.uniform(-0.1, 0.1)), 1)
v = math.exp(-a * ((2 * x / w - 1) ** 2 + (2 * y / h - 1) ** 2))
v += random.uniform(-0.1, 0.1)
return min(max(0., v), 1.)


def iterate_grid(width, height, grid_size) -> Iterator[Tuple[int, int]]:
Expand Down

0 comments on commit 88668f3

Please sign in to comment.