Search code examples
javaarcoresceneform

What does Pose mean in ARCore?


From the Documentation https://developers.google.com/ar/reference/java/arcore/reference/com/google/ar/core/Pose I see that Pose means that there is an immutable anchor. But I am not very sure how it works in the following code where a line is drawn between two points:

Pose point1;
                    // draw first cube
                    Pose point0 = getPose(anchors.get(0));
                    drawObj(point0, cube, viewmtx, projmtx, lightIntensity);
                    checkIfHit(cube, 0);
                    // draw the rest cube
                    for(int i = 1; i < anchors.size(); i++){
                        point1 = getPose(anchors.get(i));
                        log("onDrawFrame()", "before drawObj()");
                        drawObj(point1, cube, viewmtx, projmtx, lightIntensity);
                        checkIfHit(cube, i);
                        log("onDrawFrame()", "before drawLine()");
                        float distanceCm = ((int)(getDistance(point0, point1) * 1000))/10.0f;
                        drawLine(point0, point1, viewmtx, projmtx);

Can anyone explain more about Pose as the documentation left me more confused?


Solution

  • One way to think of a Pose is that it is roughly similar to the English meaning of the word - it tells you where an object is in the world and what direction it is facing.

    If you imagine creating an object in a blank 3D place, and that the Object is made up of set of points, then each of those points will have a location in your blank 3D place - i.e. each point will have a x,y,z co-ordinate.

    When you want to display that object in a scene you need to say where in the scene you want to place it and you need to specify the location in terms of the scene's coordinates.

    The Pose is how you say this, but mathematically - it is the transformation you do to each point in your object to make that point appear in the correct place in the scene.

    You can see this reflected in the documentation you linked when they say

    The transformation is defined using a quaternion rotation about the origin followed by a translation.

    The quaternion rotation takes care of making sure your object is facing the correct way in the scene and the translation places the result in the right spot in the scene.