| Algorithm 2. The Detailed Design of the Trajectory on a Border | |
| 1. | Input di, di+1, cur_dir; //cur_dir is the current traveling direction of mobile sink |
| 2. | Calculate the length of the trajectory on border lborder_trajectory according to Equation (12); |
| 3. | if (di! = di+1) //when curve order di ≠ di+1 |
| 4. | if (di < di+1) //curve order is increased |
| 5. | if (cur_dir = left or cur_dir = right) |
| 6. | //current traversing direction of mobile sink is horizontal |
| 7. | direction_on_border←right; |
| 8. | else |
| 9. | direction_on_border←left; |
| 10. | end if |
| 11. | Mobile sink traverses along the direction of direction_on_border with the length lborder_trajectory; |
| 12. | else //curve order is decreased |
| 13. | if (cur_dir = up or cur_dir = down) |
| 14. | //current traversing direction of mobile sink is vertical |
| 15. | direction_on_border←left; |
| 16. | else |
| 17. | direction_on_border←right; |
| 18. | end if |
| 19. | Mobile sink traverses along the direction of direction_on_border with the length lborder_trajectory; |
| 20. | end if |
| 21. | end if |