"transformPoint" method on ARKit

270 Views Asked by At

There is a method from Android ARCore Pose() class.

pose.inverse().transformPoint()

I am looking for alternative of this on IOS platform (swift). Does someone know about this?

Thanks a lot.

2

There are 2 best solutions below

3
On

ARKit has two useful methods:

The first one helps project a point from the 3D world coordinate system of the scene to the 2D pixel coordinate system of the renderer.

func projectPoint(_ point: SCNVector3) -> SCNVector3

The second one helps unproject a point from the 2D pixel coordinate system of the renderer to the 3D world coordinate system of the scene.

func unprojectPoint(_ point: SCNVector3) -> SCNVector3
0
On

I want to do like this way on ARKit - swift

 public static Vector3f TransformPointToPose(Vector3f point, Pose anchorPose) {
    // Recenter to anchor
    float[] position = new float[3];
    position[0] = point.x;
    position[1] = point.y;
    position[2] = point.z;
    

    position = anchorPose.inverse().transformPoint(position);
    return new Vector3f(position[0], position[1], position[2]);
}

and this is "transformPoint()" method in Pose class ARCore

  public float[] transformPoint(float[] var1) {
    float[] var2 = new float[3];
    this.transformPoint(var1, 0, var2, 0);
    return var2;
}

With all sub functions the pipeline like this; just a line - 91. line

These are in the Pose Class

enter image description here

enter image description here

enter image description here

enter image description here