Skip to content
Snippets Groups Projects
Commit c9f19abf authored by Vojtech Moravec's avatar Vojtech Moravec
Browse files

Fix more index calculation bugs.

Those bugs were caused by passing height to the method instead of width.
parent 6f95533c
No related branches found
No related tags found
No related merge requests found
...@@ -32,13 +32,9 @@ public abstract class BasicLoader { ...@@ -32,13 +32,9 @@ public abstract class BasicLoader {
} }
protected int[][] loadRowVectorsImplByLoadPlaneData(final int vectorSize, final Range<Integer> planeRange) throws IOException { protected int[][] loadRowVectorsImplByLoadPlaneData(final int vectorSize, final Range<Integer> planeRange) throws IOException {
System.out.println("we are here and maybe it is wrong.");
final int rowVectorCount = (int) Math.ceil((double) dims.getX() / (double) vectorSize); final int rowVectorCount = (int) Math.ceil((double) dims.getX() / (double) vectorSize);
final int planeCount = planeRange.getTo() - planeRange.getFrom(); final int planeCount = planeRange.getTo() - planeRange.getFrom();
System.out.println("vectorSize="+vectorSize);
System.out.println("planeCount="+planeCount);
final int vectorCount = planeCount * dims.getY() * rowVectorCount; final int vectorCount = planeCount * dims.getY() * rowVectorCount;
System.out.println("vectorCount="+vectorCount);
int[][] rowVectors = new int[vectorCount][vectorSize]; int[][] rowVectors = new int[vectorCount][vectorSize];
int vectorIndex = 0; int vectorIndex = 0;
...@@ -137,7 +133,7 @@ public abstract class BasicLoader { ...@@ -137,7 +133,7 @@ public abstract class BasicLoader {
srcX = blockXOffset + x; srcX = blockXOffset + x;
if (srcX >= dims.getX()) if (srcX >= dims.getX())
break; break;
block[Block.index(x, y, blockDim.getY())] = valueAt(planeIndex, Block.index(srcX, srcY, dims.getY())); block[Block.index(x, y, blockDim.getX())] = valueAt(planeIndex, Block.index(srcX, srcY, dims.getX()));
} }
} }
} }
...@@ -153,7 +149,7 @@ public abstract class BasicLoader { ...@@ -153,7 +149,7 @@ public abstract class BasicLoader {
if (srcX >= dims.getX()) if (srcX >= dims.getX())
break; break;
block[Block.index(x, y, blockDim.getY())] = planeData[Block.index(srcX, srcY, dims.getY())]; block[Block.index(x, y, blockDim.getX())] = planeData[Block.index(srcX, srcY, dims.getX())];
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment