Skip to main content
. 2019 Jun 19;19(12):2746. doi: 10.3390/s19122746
Algorithm 1 Distance calculation for the moving capsule.
Input: Absolute position Pi=(xi,yi,zi)
Output: Moving distance L
  • 1:

    set flag=0

  • 2:

    set L=0

  • 3:

    repeat

  • 4:

     Get absolute position Pi

  • 5:

    if PiPi14 mm then

  • 6:

      Estimate adjacent moving angle θ

  • 7:

      if θ150,210 then

  • 8:

       flag=flag1

  • 9:

      end if

  • 10:

      Quadratic Bézier curve-fitting

  • 11:

      distance=P0P2Btdt

  • 12:

      L=L+distance×(1)flag

  • 13:

    else

  • 14:

      Pi = Pi1

  • 15:

    end if

  • 16:

    until Tracking End

  • 17:

    returnL