JCWilson
JCWilson

Reputation: 25

Which part of the xyzij data is the point cloud?

I want to graphically show the point cloud data to the user, and I'm wondering what part of the xyzIj data is the actual coordinates of the point cloud data. I assume it's XyzIj.xyz, but on the developers website, this call is described as "packed coordinate triplet".
When I print it out it's just separate point numbers; does that mean it prints out an x point, y point, z point, x point, y point, etc... or am I understanding it wrong?

    mPointCount = xyzIj.xyzCount;
    //Is this the coordinate points of the point cloud?
    FloatBuffer newPointCloudPoints = xyzIj.xyz;
    int i = 0;
    //Printing out all the points
    while(newPointCloudPoints.get(i) != 0) {
         Log.i(TAG, "point cloud " + i + " " + newPointCloudPoints.get(i));
         i++;
    }

Upvotes: 1

Views: 480

Answers (1)

Aaron Roller
Aaron Roller

Reputation: 1074

Each "point" has three entries in the buffer.

The first index of the float buffer is x, second is y, third is z. The sequence repeats for every point.

for (int i = 0; i < xyzIjData.xyzCount; i += 3) {
            float x = xyz.get(i);
            float y = xyz.get(i + 1);
            float z = xyz.get(i + 2);
        }

Upvotes: 1

Related Questions