augmented reality – How should I create an Application to measure 3D box in Unity using AR Core and ARFoundation?

I’m trying to develop an application to measure cube-shaped items using Unity with ARFoundation for ARCore. I have Identified the flow that should be followed up by I don’t have any heads up to develop this application.
My flow would be this.

  1. Identify the plane of the box that has been placed using AR Plane Manager
  2. Identify touches on the screen using the AR Raycast Manager
  3. The First touch should initialize the first point in the world space.
  4. The Second touch should be able to mark in the world space as well, then it should be able to create a line between the first and second point.
  5. After that, the third point of the box should be able to create in the world space which now produces a surface/ quad in the world space matching to the box’s surface area. After that as the final point will determine the height and the box should generate the cube accordingly. I have attached a gif to understand the flow better. Does anyone know how to script this algorithm?
    Any suggestions would be highly appreciated

enter image description here