Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d51d63
commit 513ddc0
Showing
35 changed files
with
17,001 additions
and
17,001 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
# Python object code. | ||
*.pyc | ||
*.pyo | ||
*~ | ||
|
||
# Vim temporary files. | ||
*.sw* | ||
|
||
# Folders created by setup.py. | ||
dist | ||
build | ||
*.egg-info | ||
|
||
# The "standard" virtualenv directory. | ||
ENV | ||
|
||
#profiling/outputs | ||
mcedit.ini | ||
*.log | ||
mcedit.profile | ||
|
||
# Version file generated by the build process. | ||
RELEASE-VERSION | ||
|
||
.DS_Store | ||
.idea | ||
# Python object code. | ||
*.pyc | ||
*.pyo | ||
*~ | ||
|
||
# Vim temporary files. | ||
*.sw* | ||
|
||
# Folders created by setup.py. | ||
dist | ||
build | ||
*.egg-info | ||
|
||
# The "standard" virtualenv directory. | ||
ENV | ||
|
||
#profiling/outputs | ||
mcedit.ini | ||
*.log | ||
mcedit.profile | ||
|
||
# Version file generated by the build process. | ||
RELEASE-VERSION | ||
|
||
.DS_Store | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
def bresenham(p1, p2): | ||
"""Bresenham line algorithm | ||
adapted for 3d. slooooow.""" | ||
steep = 0 | ||
coords = [] | ||
x, y, z = p1 | ||
x2, y2, z2 = p2 | ||
|
||
dx = abs(x2 - x) | ||
if (x2 - x) > 0: | ||
sx = 1 | ||
else: | ||
sx = -1 | ||
dy = abs(y2 - y) | ||
if (y2 - y) > 0: | ||
sy = 1 | ||
else: | ||
sy = -1 | ||
dz = abs(z2 - z) | ||
if (z2 - z) > 0: | ||
sz = 1 | ||
else: | ||
sz = -1 | ||
|
||
dl = [dx, dy, dz] | ||
longestAxis = dl.index(max(dl)) | ||
d = [2 * a - dl[longestAxis] for a in dl] | ||
|
||
#if dy > dx: | ||
# steep = 1 | ||
|
||
#d = (2 * dy) + (2 * dz) - dx | ||
otherAxes = [0, 1, 2] | ||
otherAxes.remove(longestAxis) | ||
p = [x, y, z] | ||
sp = [sx, sy, sz] | ||
for i in range(0, int(dl[longestAxis])): | ||
coords.append(tuple(p)) | ||
for j in otherAxes: | ||
|
||
while d[j] >= 0: | ||
p[j] = p[j] + sp[j] | ||
d[j] = d[j] - (2 * dl[longestAxis]) | ||
|
||
p[longestAxis] = p[longestAxis] + sp[longestAxis] | ||
d = map(lambda a, b: a + 2 * b, d, dl) | ||
|
||
return coords # added by me | ||
def bresenham(p1, p2): | ||
"""Bresenham line algorithm | ||
adapted for 3d. slooooow.""" | ||
steep = 0 | ||
coords = [] | ||
x, y, z = p1 | ||
x2, y2, z2 = p2 | ||
|
||
dx = abs(x2 - x) | ||
if (x2 - x) > 0: | ||
sx = 1 | ||
else: | ||
sx = -1 | ||
dy = abs(y2 - y) | ||
if (y2 - y) > 0: | ||
sy = 1 | ||
else: | ||
sy = -1 | ||
dz = abs(z2 - z) | ||
if (z2 - z) > 0: | ||
sz = 1 | ||
else: | ||
sz = -1 | ||
|
||
dl = [dx, dy, dz] | ||
longestAxis = dl.index(max(dl)) | ||
d = [2 * a - dl[longestAxis] for a in dl] | ||
|
||
#if dy > dx: | ||
# steep = 1 | ||
|
||
#d = (2 * dy) + (2 * dz) - dx | ||
otherAxes = [0, 1, 2] | ||
otherAxes.remove(longestAxis) | ||
p = [x, y, z] | ||
sp = [sx, sy, sz] | ||
for i in range(0, int(dl[longestAxis])): | ||
coords.append(tuple(p)) | ||
for j in otherAxes: | ||
|
||
while d[j] >= 0: | ||
p[j] = p[j] + sp[j] | ||
d[j] = d[j] - (2 * dl[longestAxis]) | ||
|
||
p[longestAxis] = p[longestAxis] + sp[longestAxis] | ||
d = map(lambda a, b: a + 2 * b, d, dl) | ||
|
||
return coords # added by me |
Oops, something went wrong.