The Algorithm of Obstacle Avoidance Using Piecewise Polynomials