From 46577b07630ec8148ddfa6f04c3d6687ac97b88a Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Tue, 21 Feb 2017 12:31:20 +0000 Subject: [PATCH] Remove -1 from when setting limits for building objects and setting solid array. --- gprMax/geometry_primitives.pyx | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/gprMax/geometry_primitives.pyx b/gprMax/geometry_primitives.pyx index b6928f9c..ac2a5659 100644 --- a/gprMax/geometry_primitives.pyx +++ b/gprMax/geometry_primitives.pyx @@ -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):