Created
February 24, 2018 21:18
-
-
Save mmatiaschek/a26d7badf6b2feadf3924d7fe1fbe5b3 to your computer and use it in GitHub Desktop.
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
/** | |
* Calculates the min and max x, y and z (depth) from a point cloud buffer. | |
*/ | |
private float calculateMinMaxPointCloudXYZ(FloatBuffer pointCloudBuffer, int numPoints) { | |
float current = 0; | |
if (numPoints != 0) { | |
int numFloats = 4 * numPoints; | |
int num = 0; | |
for (int i = 0; i<numFloats; i++) { | |
current = pointCloudBuffer.get(i); | |
if (num == 0) { | |
if (current > maxX){ | |
maxX = current; | |
} | |
if (current < minX) { | |
minX = current; | |
} | |
} | |
if (num == 1) { | |
if (current > maxY){ | |
maxY = current; | |
} | |
if (current < minY) { | |
minY = current; | |
} | |
} | |
if (num == 2) { | |
if (current > maxZ){ | |
maxZ = current; | |
} | |
if (current < minZ) { | |
minZ = current; | |
} | |
} | |
if (num == 3) { | |
num = -1; | |
} | |
num++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
minX: -3.44
maxX: -3.61
minY: -2.51
maxY: 2.77
minZ: 0.0
maxZ: 7.23