Skip to main content
. 2024 Aug 10;24(16):5168. doi: 10.3390/s24165168
Algorithm 1 QR code mapping to VR canvas.
  • Input: 

    InputQR[x,y] coordinates of a QR code tracked by Vuforia.

  • Output: 

    Position[x,y]                ▹ Pointer position on canvas

  • let n be a top left corner position[x,y] of a QR image

  • let m be a bottom right corner position[x,y] of a QR image

  • if QR code IS tracked by Vuforia then

  •      let minX, minY, maxX, maxY be the 4 boundaries of the pointer canvas

  •      newPos = Unity.ScreenPointToLocalPointInRectangle(n,m,InputQR,canvas);

  •             ▹ Mapping from QR coords to a point in the VR canvas

  •      if (minXnewPos.XmaxX) and (minYnewPos.YmaxXthen

  •          position[x,y] = [newPos.X,newPos.Y] ▹ Updates pointer position on the canvas

  •      end if

  • else if QR code IS NOT tracked by Vuforia then

  •      position[x,y] = [(maxX+minX)/2,(maxY+minY)/2] ▹ Pointer is set to canvas center

  • end if