}
private float[] getSubset(float[] fullData, Region3i fullRegion, Region3i subRegion) {
if (subRegion.size().x != fullRegion.size().x || subRegion.size().y != fullRegion.size().y || subRegion.size().z != fullRegion.size().z) {
float[] result = new float[subRegion.size().x * subRegion.size().y * subRegion.size().z];
Vector3i offset = new Vector3i(subRegion.minX() - fullRegion.minX(), subRegion.minY() - fullRegion.minY(), subRegion.minZ() - fullRegion.minZ());
for (int z = 0; z < subRegion.size().z; ++z) {
for (int y = 0; y < subRegion.size().y; ++y) {
System.arraycopy(fullData, offset.x + fullRegion.sizeX() * (y + offset.y + fullRegion.sizeY() * (z + offset.z)),
result, subRegion.sizeX() * (y + subRegion.sizeY() * z), subRegion.size().x);
}