Skip to content

Commit

Permalink
PEP8 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
jtauber committed Jul 15, 2014
1 parent 555470c commit 55919d7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
27 changes: 16 additions & 11 deletions extract_cells.py
Expand Up @@ -102,23 +102,27 @@ def hillshade(cell, xres=1, yres=1, azimuth=315.0, altitude=45.0, z=1.0, scale=0
for col in range(3):
window.append(cell[row:(row + cell.shape[0] - 2), col:(col + cell.shape[1] - 2)])

x = ((z * window[0] + z * window[3] + z * window[3] + z * window[6]) \
- (z * window[2] + z * window[5] + z * window[5] + z * window[8])) \
/ (8.0 * xres * scale)
x = (
(z * window[0] + z * window[3] + z * window[3] + z * window[6]) -
(z * window[2] + z * window[5] + z * window[5] + z * window[8])
) / (8.0 * xres * scale)

y = ((z * window[6] + z * window[7] + z * window[7] + z * window[8]) \
- (z * window[0] + z * window[1] + z * window[1] + z * window[2])) \
/ (8.0 * yres * scale)
y = (
(z * window[6] + z * window[7] + z * window[7] + z * window[8]) -
(z * window[0] + z * window[1] + z * window[1] + z * window[2])
) / (8.0 * yres * scale)

rad2deg = 180.0 / math.pi

slope = 90.0 - arctan(sqrt(x * x + y * y)) * rad2deg
aspect = arctan2(x, y)
deg2rad = math.pi / 180.0

shaded = sin(altitude * deg2rad) * sin(slope * deg2rad) \
+ cos(altitude * deg2rad) * cos(slope * deg2rad) \
* cos((azimuth - 90.0) * deg2rad - aspect)
shaded = (
sin(altitude * deg2rad) * sin(slope * deg2rad) +
cos(altitude * deg2rad) * cos(slope * deg2rad) *
cos((azimuth - 90.0) * deg2rad - aspect)
)

shaded = shaded * 255

Expand Down Expand Up @@ -173,10 +177,11 @@ def colour_for_height(height):

pixels = zeros((SIZE, SIZE, 3), dtype=uint8)

for y in range(64, SIZE - 32):
for x in range(32, SIZE - 32):
# for y in range(1000, 2000):
# for x in range(4500, 5500):

for y in range(64, SIZE - 32):
for x in range(32, SIZE - 32):
cy, py = divmod(y, 30)
cx, px = divmod(x, 30)
file_id = 0x80020000 + cy * 0x100 + cx
Expand Down
2 changes: 0 additions & 2 deletions local.py
@@ -1,12 +1,10 @@
#!/usr/bin/env python

import struct
import time
import zlib

from dat import DatFile
import png
from utils import dump


filename = "LOTRO/client_local_English.dat"
Expand Down
2 changes: 1 addition & 1 deletion surface.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python

import os.path
import png
import struct
import zlib

from dat import DatFile
from utils import dump


def rgb565(c):
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
@@ -0,0 +1,2 @@
[flake8]
ignore = E265,E501

0 comments on commit 55919d7

Please sign in to comment.