Remove -1 from when setting limits for building objects and setting solid array.

这个提交包含在:
Craig Warren
2017-02-21 12:31:20 +00:00
父节点 03f7bae43e
当前提交 46577b0763

查看文件

@@ -558,16 +558,16 @@ cpdef void build_cylinder(float x1, float y1, float z1, float x2, float y2, floa
# Set bounds to domain if they outside
if xs < 0:
xs = 0
if xf >= solid.shape[0]:
xf = solid.shape[0] - 1
if xf > solid.shape[0]:
xf = solid.shape[0]
if ys < 0:
ys = 0
if yf >= solid.shape[1]:
yf = solid.shape[1] - 1
if yf > solid.shape[1]:
yf = solid.shape[1]
if zs < 0:
zs = 0
if zf >= solid.shape[2]:
zf = solid.shape[2] - 1
if zf > solid.shape[2]:
zf = solid.shape[2]
# Vectors between centres of cylinder faces
f1f2 = np.array([x2 - x1, y2 - y1, z2 - z1], dtype=np.float32)
@@ -642,16 +642,16 @@ cpdef void build_sphere(int xc, int yc, int zc, float r, float dx, float dy, flo
# Set bounds to domain if they outside
if xs < 0:
xs = 0
if xf >= solid.shape[0]:
xf = solid.shape[0] - 1
if xf > solid.shape[0]:
xf = solid.shape[0]
if ys < 0:
ys = 0
if yf >= solid.shape[1]:
yf = solid.shape[1] - 1
if yf > solid.shape[1]:
yf = solid.shape[1]
if zs < 0:
zs = 0
if zf >= solid.shape[2]:
zf = solid.shape[2] - 1
if zf > solid.shape[2]:
zf = solid.shape[2]
for i in range(xs, xf):
for j in range(ys, yf):
@@ -677,22 +677,22 @@ cpdef void build_voxels_from_array(int xs, int ys, int zs, int numexistmaterials
# Set bounds to domain if they outside
if xs < 0:
xs = 0
if xs + data.shape[0] >= solid.shape[0]:
xf = solid.shape[0] - 1
if xs + data.shape[0] > solid.shape[0]:
xf = solid.shape[0]
else:
xf = xs + data.shape[0]
if ys < 0:
ys = 0
if ys + data.shape[1] >= solid.shape[1]:
yf = solid.shape[1] - 1
if ys + data.shape[1] > solid.shape[1]:
yf = solid.shape[1]
else:
yf = ys + data.shape[1]
if zs < 0:
zs = 0
if zs + data.shape[2] >= solid.shape[2]:
zf = solid.shape[2] - 1
if zs + data.shape[2] > solid.shape[2]:
zf = solid.shape[2]
else:
zf = zs + data.shape[2]
@@ -721,9 +721,9 @@ cpdef void build_voxels_from_array_mask(int xs, int ys, int zs, int waternumID,
cdef int xf, yf, zf, numID, numIDx, numIDy, numIDz
# Set upper bounds
xf = xs + data.shape[0] - 1
yf = ys + data.shape[1] - 1
zf = zs + data.shape[2] - 1
xf = xs + data.shape[0]
yf = ys + data.shape[1]
zf = zs + data.shape[2]
for i in range(xs, xf):
for j in range(ys, yf):