/// <summary>
        /// Changes G00 movement to G02/G03 to make the knife arrive, facing the correct destination
        /// </summary>
        /// <param name="whereAmINow">array holding points around the current location</param>
        /// <param name="i"></param>
        void InsertKnifeTurning(double[][] whereAmINow, int i)
        {
            // if we dont know where we are coming from, we fix the knife direction when it arrives at insertion point.
            // Or if the distance is too great for G02/G03 directional fixing to make sense
            if (whereAmINow[2] == null ||
                file.CheckDistance(whereAmINow[1], whereAmINow[2]) > double.Parse(ConfigurationManager.AppSettings["minDistForRapidMove"]))
            {
                InsertNewPoint(whereAmINow[1], whereAmINow[0], i);
                return;
            }

            double newAngle;

            if (whereAmINow[0][4] >= 0) // detects starting direction of a knife if its inserted into an arc
            {
                newAngle = DetectDirectioninArc(whereAmINow);
            }
            else // detects starting direction if knife is inserted on a straight line
            {
                newAngle = SharedMethods.CheckDirection(whereAmINow[1], whereAmINow[0]);
            }

            double oldAngle; string turnDirection;

            if (!(whereAmINow[3] == null))
            {
                oldAngle = SharedMethods.CheckDirection(whereAmINow[3], whereAmINow[2]);
                double degreesTurned = oldAngle - newAngle;

                if (degreesTurned < 0)
                {
                    degreesTurned = degreesTurned + 360;
                }
                if (degreesTurned < 180)
                {
                    turnDirection = "G02";
                }
                else
                {
                    turnDirection = "G03";
                }
            }
            else
            {
                turnDirection = "G02";
            }

            newAngle = Math.Round(newAngle, 3);
            NumberFormatInfo nfi = new NumberFormatInfo();

            nfi.NumberDecimalSeparator = ".";
            string line = "N" + file.GetLineBlock(i) + " " + turnDirection.ToString(nfi) + " X" + file.DoubleToString(whereAmINow[1][0]);

            line = line + " Y" + file.DoubleToString(whereAmINow[1][1]) + " F" +
                   ConfigurationManager.AppSettings["aboveMaterialRadiusSpeed"] + " A" + file.DoubleToString(newAngle) + " R" + ConfigurationManager.AppSettings["radiusAboveMaterial"];
            line = line + "\r\nN" + (file.GetLineBlock(i) + 1) + " F2000.";
            file.UpdateLine(i, line);
        }