Esempio n. 1
0
        /// <summary>
        /// Find the intersection of data with fix
        /// </summary>
        /// <param name="data"></param>
        /// <param name="fix"></param>
        /// <returns></returns>
        private static double getIntersection(LineP data, LineP fix)
        {
            Vector intersection = Vector.Interception(data.start, data.end, fix.start, fix.end);

            if (intersection != null)
            {
                return(Vector.Abs(intersection - data.start) / Vector.Abs(data.end - data.start));
            }
            return(-1);
        }
Esempio n. 2
0
        public double Weight()
        {
            if (weight == double.MinValue)
            {
                double[] lenght  = new double[4];
                double   diffSum = 0;
                double   min     = Double.MaxValue;
                double   max     = Double.MinValue;

                double minDistance = Channels[0].getDistanceStraight() / 20;

                double result = 0;
                for (int i = 0; i < 4; i++)
                {
                    lenght[i] = Channels[i].getDistance();
                    min       = Math.Min(min, lenght[i]);
                    max       = Math.Max(max, lenght[i]);
                    diffSum  += Math.Abs(lenght[i] - (Channels[i].getDistanceStraight() / desiredLengthFactor));
                    for (int j = 0; j < Channels[i].LinearCombinations.Count - 1; j++)
                    {
                        if (i == 0)
                        {
                            if (Vector.Abs(Channels[i].LinearCombinations[j] - Channels[i + 1].LinearCombinations[j]) < minDistance)
                            {
                                result += 1000;
                            }
                        }
                        else if (i == Channels.Count - 1)
                        {
                            if (Vector.Abs(Channels[i].LinearCombinations[j] - Channels[i - 1].LinearCombinations[j]) < minDistance)
                            {
                                result += 1000;
                            }
                        }
                        else
                        {
                            if (Vector.Abs(Channels[i].LinearCombinations[j] - Channels[i + 1].LinearCombinations[j]) < minDistance)
                            {
                                result += 1000;
                            }
                            if (Vector.Abs(Channels[i].LinearCombinations[j] - Channels[i - 1].LinearCombinations[j]) < minDistance)
                            {
                                result += 1000;
                            }
                        }
                    }
                }
                result += max - min;
                result += diffSum;

                weight = result;
            }

            return(weight);
        }
Esempio n. 3
0
        public double getDistance()
        {
            double result = 0;
            Vector last   = Start;

            foreach (Vector v in LinearCombinations)
            {
                result += Vector.Abs(last - v);
                last    = v;
            }
            return(result);
        }
Esempio n. 4
0
 internal void Randomize(double factor)
 {
     for (int i = 2; i < 8; i++)
     {
         Vector v = LinearCombinations.ElementAt(i);
         if (!ImmutablePoints.Contains(v))
         {
             int    sign = (i % 2 == 1) ? 1 : -1;
             Vector orth = Vector.Orthogonal(End - Start);
             orth = (orth / Vector.Abs(orth)) * (Utils.getNextDouble() * factor * sign);
             v.X += orth.X;
             v.Y += orth.Y;
         }
     }
 }
        /// <summary>
        ///Graham-Scan (Only 2D !! z = 0)
        ///bestimme Punkt q mit minimaler y-Koordinate;
        ///sortiere die Punkte des Arrays nach ihrem Winkel, und bei gleichem Winkel nach ihrem Abstand zum Nullpunkt (der Punkt q wird zu p0);
        ///Z will be set to 0 for all Vectors!!
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static List <Vector> Sort(List <Vector> input)
        {
            List <Vector> result = new List <Vector>();
            List <Vector> list   = new List <Vector>(input);
            Vector        minY   = input[0];
            int           count  = 0;
            int           pos    = 0;

            foreach (Vector v in list)
            {
                v.Z = 0;
                if (v.Y < minY.Y)
                {
                    minY = v;
                    pos  = count;
                }
                count++;
            }
            result.Add(minY);
            list.Remove(minY);
            Vector reference = minY - new Vector(1, 1, 0);

            while (list.Count > 0)
            {
                Vector minVec   = list[0];
                double minAngle = Vector.AngleClockwise(reference, minY, minVec);
                double minDist  = Vector.Abs(minVec - minY);
                foreach (Vector v in list)
                {
                    double minAngleTmp = Vector.AngleClockwise(reference, minY, v);
                    double minDistTmp  = Vector.Abs(v - minY);
                    if (minAngleTmp < minAngle || (minAngleTmp == minAngle && minDistTmp < minDist))
                    {
                        minVec   = v;
                        minAngle = minAngleTmp;
                        minDist  = minDistTmp;
                    }
                }
                list.Remove(minVec);
                result.Add(minVec);
            }

            return(result);
        }
Esempio n. 6
0
        /// <summary>
        /// Find the intersection of data with fix. Insersection point ip is output parameter
        /// </summary>
        /// <param name="data"></param>
        /// <param name="fix"></param>
        /// <param name="ip"></param>
        /// <returns></returns>
        private static bool getIntersection(LineP data, LineP fix, out IntersectionPoint ip)
        {
            ip = new IntersectionPoint();
            bool   res           = false;
            Vector intersectionV = Vector.Interception(data.start, data.end, fix.start, fix.end);

            if (intersectionV != null)
            {
                double intersection = Vector.Abs(intersectionV - data.start) / Vector.Abs(data.end - data.start);
                long   timestmp     = data.TimestamStart + (long)Math.Truncate((data.TimestamEnd - data.TimestamStart) * intersection);
                double x            = data.start.X + (data.end.X - data.start.X) * intersection;
                double y            = data.start.Y + (data.end.Y - data.start.Y) * intersection;
                double z            = data.start.Z + (data.end.Z - data.start.Z) * intersection;
                ip.longitude = x;
                ip.latitude  = y;
                ip.altitude  = z;
                ip.Timestamp = timestmp;
                res          = true;
                return(res);
            }
            return(res);
        }
Esempio n. 7
0
        public void addPolygons()
        {
            Vector ChannelRadius = Channels[3].Start - Channels[0].Start;

            Point Ende = new Point();

            Ende.longitude = c.XtoLongitude(Channels[3].Start.X);
            Ende.latitude  = c.YtoLatitude(Channels[3].Start.Y);
            Point Start = new Point();

            Start.longitude = c.XtoLongitude(Channels[0].Start.X);
            Start.latitude  = c.YtoLatitude(Channels[0].Start.Y);
            double origDist = Converter.Distance(Ende, Start);

            ChannelRadius = (ChannelRadius / origDist) * (channel * (-1.0 / 2.0));
            Vector ortho             = Vector.Orthogonal(ChannelRadius) / 10.0;
            double factorLengthSides = 10.0;
            double distChannelRadius = -Vector.Abs(ChannelRadius);
            double orthoLengthFactor = 1.0;

            for (int i = 1; i < 8; i += 1)
            {
                Vector localChannelRadius;
                localChannelRadius = Vector.Orthogonal(Channels[0].LinearCombinations[i + 1] - Channels[0].LinearCombinations[i]);
                localChannelRadius = (localChannelRadius / Vector.Abs(localChannelRadius)) * distChannelRadius;
                ortho = Vector.Orthogonal(localChannelRadius) / orthoLengthFactor;

                Vector a1 = Channels[0].LinearCombinations[i] + localChannelRadius + ortho;
                Vector a2 = Channels[0].LinearCombinations[i + 1] + localChannelRadius - ortho;
                Vector a3 = a1 + ChannelRadius * factorLengthSides + ortho;
                Vector a4 = a2 + ChannelRadius * factorLengthSides - ortho;
                Polygons.Add(new ParcourPolygon(a1, a2, a4, a3));

                Vector b1 = Channels[0].LinearCombinations[i] - localChannelRadius + ortho;
                Vector b2 = Channels[0].LinearCombinations[i + 1] - localChannelRadius - ortho;

                localChannelRadius = Vector.Orthogonal(Channels[1].LinearCombinations[i + 1] - Channels[1].LinearCombinations[i]);
                localChannelRadius = (localChannelRadius / Vector.Abs(localChannelRadius)) * distChannelRadius;
                ortho = Vector.Orthogonal(localChannelRadius) / orthoLengthFactor;

                Vector b3 = Channels[1].LinearCombinations[i] + localChannelRadius + ortho;
                Vector b4 = Channels[1].LinearCombinations[i + 1] + localChannelRadius - ortho;
                Polygons.Add(new ParcourPolygon(b1, b2, b4, b3));

                Vector c1 = Channels[1].LinearCombinations[i] - localChannelRadius + ortho;
                Vector c2 = Channels[1].LinearCombinations[i + 1] - localChannelRadius - ortho;

                localChannelRadius = Vector.Orthogonal(Channels[2].LinearCombinations[i + 1] - Channels[2].LinearCombinations[i]);
                localChannelRadius = (localChannelRadius / Vector.Abs(localChannelRadius)) * distChannelRadius;
                ortho = Vector.Orthogonal(localChannelRadius) / orthoLengthFactor;

                Vector c3 = Channels[2].LinearCombinations[i] + localChannelRadius + ortho;
                Vector c4 = Channels[2].LinearCombinations[i + 1] + localChannelRadius - ortho;
                Polygons.Add(new ParcourPolygon(c1, c2, c4, c3));

                Vector d1 = Channels[2].LinearCombinations[i] - localChannelRadius + ortho;
                Vector d2 = Channels[2].LinearCombinations[i + 1] - localChannelRadius - ortho;


                localChannelRadius = Vector.Orthogonal(Channels[3].LinearCombinations[i + 1] - Channels[3].LinearCombinations[i]);
                localChannelRadius = (localChannelRadius / Vector.Abs(localChannelRadius)) * distChannelRadius;
                ortho = Vector.Orthogonal(localChannelRadius) / orthoLengthFactor;

                Vector d3 = Channels[3].LinearCombinations[i] + localChannelRadius + ortho;
                Vector d4 = Channels[3].LinearCombinations[i + 1] + localChannelRadius - ortho;
                Polygons.Add(new ParcourPolygon(d1, d2, d4, d3));


                Vector e1 = Channels[3].LinearCombinations[i] - localChannelRadius + ortho;
                Vector e2 = Channels[3].LinearCombinations[i + 1] - localChannelRadius - ortho;
                Vector e3 = e1 - ChannelRadius * factorLengthSides + ortho;
                Vector e4 = e2 - ChannelRadius * factorLengthSides - ortho;
                Polygons.Add(new ParcourPolygon(e1, e2, e4, e3));
            }
        }
Esempio n. 8
0
 public double getDistanceStraight()
 {
     return(Vector.Abs(Start - End));
 }
Esempio n. 9
0
 private bool samePos(Point a, Point b)
 {
     return(Vector.Abs(new Vector(a.longitude, a.latitude, a.altitude) - new Vector(b.longitude, b.latitude, b.altitude)) < 0.00001);
 }
Esempio n. 10
0
        public void addPolygons()
        {
            Point Start = new Point();

            Start.longitude = c.XtoLongitude(Channel.Start.X);
            Start.latitude  = c.YtoLatitude(Channel.Start.Y);
            //TODO

            double latitude  = Start.latitude;
            double longitude = Start.longitude;

            double channelMeterKm = channelWidth;
            double latitudePlus1  = latitude + 1;
            double longitudePlus1 = longitude + 1;

            double distLat1  = Converter.Distance(longitude, latitude, longitude, latitudePlus1);
            double distLong1 = Converter.Distance(longitude, latitude, longitudePlus1, latitude);

            double corridorDiffInLat  = channelMeterKm / distLat1;
            double corridorDiffInLong = channelMeterKm / distLong1;

            double channelLatitude  = corridorDiffInLat / 2;
            double channelLongitude = corridorDiffInLong / 2;

            double longitudePlusChannel = longitude + channelLongitude;
            double latitudePlusChannel  = latitude + channelLatitude;

            double channelx = c.LongitudeToX(longitudePlusChannel) - Channel.Start.X;
            double channely = c.LatitudeToY(latitudePlusChannel) - Channel.Start.Y;

            Vector channel = new Vector(channelx, channely, 0);

            Vector startEnd                = new Vector(Channel.End.X, Channel.End.Y, 0) - new Vector(Channel.Start.X, Channel.Start.Y, 0);
            Vector startEndOrtho           = Vector.Orthogonal(startEnd) * (-1);
            Vector startEndOrthoNormalized = (startEndOrtho / Vector.Abs(startEndOrtho)) * Vector.Abs(channel);
            Vector startEndNormalized      = (startEnd / Vector.Abs(startEnd)) * Vector.Abs(channel);

            for (int i = 1; i < 8; i++)
            {
                Vector localChannel                = Channel.LinearCombinations[i + 1] - Channel.LinearCombinations[i];
                Vector localChannelOrtho           = Vector.Orthogonal(localChannel);
                Vector localChannelOrthoNormalized = (localChannelOrtho / Vector.Abs(localChannelOrtho)) * -Vector.Abs(channel);

                Vector a1_intersection = Vector.InterceptionLine(Channel.LinearCombinations[i], startEndOrtho, Channel.LinearCombinations[i] + localChannelOrthoNormalized - localChannel * 10, Channel.LinearCombinations[i + 1] + localChannelOrthoNormalized + localChannel * 10);

                {
                    Vector localChannel2                = Channel.LinearCombinations[i] - Channel.LinearCombinations[i - 1];
                    Vector localChannelOrtho2           = Vector.Orthogonal(localChannel2);
                    Vector localChannelOrthoNormalized2 = (localChannelOrtho2 / Vector.Abs(localChannelOrtho2)) * -Vector.Abs(channel);
                    Vector a1_intersection2             = Vector.InterceptionLine(Channel.LinearCombinations[i], startEndOrtho, Channel.LinearCombinations[i] + localChannelOrthoNormalized2 - localChannel2 * 10, Channel.LinearCombinations[i] + localChannelOrthoNormalized2 + localChannel2 * 10);
                    a1_intersection = new Vector(a1_intersection.X, Math.Min(a1_intersection.Y, a1_intersection2.Y), 0);
                }

                Vector a2_intersection = Vector.InterceptionLine(Channel.LinearCombinations[i + 1], startEndOrtho, Channel.LinearCombinations[i] + localChannelOrthoNormalized - localChannel * 10, Channel.LinearCombinations[i + 1] + localChannelOrthoNormalized + localChannel * 10);

                {
                    Vector localChannel2                = Channel.LinearCombinations[i + 2] - Channel.LinearCombinations[i + 1];
                    Vector localChannelOrtho2           = Vector.Orthogonal(localChannel2);
                    Vector localChannelOrthoNormalized2 = (localChannelOrtho2 / Vector.Abs(localChannelOrtho2)) * -Vector.Abs(channel);
                    Vector a2_intersection2             = Vector.InterceptionLine(Channel.LinearCombinations[i + 1], startEndOrtho, Channel.LinearCombinations[i + 1] + localChannelOrthoNormalized2 - localChannel2 * 10, Channel.LinearCombinations[i + 1] + localChannelOrthoNormalized2 + localChannel2 * 10);
                    a2_intersection = new Vector(a2_intersection.X, Math.Min(a2_intersection.Y, a2_intersection2.Y), 0);
                }

                Vector a1 = a1_intersection;
                Vector a2 = a2_intersection;
                Vector a3 = a1 + startEndOrtho / 3;
                Vector a4 = a2 + startEndOrtho / 3;
                Polygons.Add(new ParcourPolygon(a1, a2, a4, a3));



                Vector b1_intersection = Vector.InterceptionLine(Channel.LinearCombinations[i], startEndOrtho, Channel.LinearCombinations[i] - localChannelOrthoNormalized - localChannel * 10, Channel.LinearCombinations[i + 1] - localChannelOrthoNormalized + localChannel * 10);
                {
                    Vector localChannel2                = Channel.LinearCombinations[i] - Channel.LinearCombinations[i - 1];
                    Vector localChannelOrtho2           = Vector.Orthogonal(localChannel2);
                    Vector localChannelOrthoNormalized2 = (localChannelOrtho2 / Vector.Abs(localChannelOrtho2)) * -Vector.Abs(channel);
                    Vector b1_intersection2             = Vector.InterceptionLine(Channel.LinearCombinations[i], startEndOrtho, Channel.LinearCombinations[i] - localChannelOrthoNormalized2 - localChannel2 * 10, Channel.LinearCombinations[i] - localChannelOrthoNormalized2 + localChannel2 * 10);
                    b1_intersection = new Vector(b1_intersection.X, Math.Max(b1_intersection.Y, b1_intersection2.Y), 0);
                }

                Vector b2_intersection = Vector.InterceptionLine(Channel.LinearCombinations[i + 1], startEndOrtho, Channel.LinearCombinations[i] - localChannelOrthoNormalized - localChannel * 10, Channel.LinearCombinations[i + 1] - localChannelOrthoNormalized + localChannel * 10);

                {
                    Vector localChannel2                = Channel.LinearCombinations[i + 2] - Channel.LinearCombinations[i + 1];
                    Vector localChannelOrtho2           = Vector.Orthogonal(localChannel2);
                    Vector localChannelOrthoNormalized2 = (localChannelOrtho2 / Vector.Abs(localChannelOrtho2)) * -Vector.Abs(channel);
                    Vector b2_intersection2             = Vector.InterceptionLine(Channel.LinearCombinations[i + 1], startEndOrtho, Channel.LinearCombinations[i + 1] - localChannelOrthoNormalized2 - localChannel2 * 10, Channel.LinearCombinations[i + 1] - localChannelOrthoNormalized2 + localChannel2 * 10);
                    b2_intersection = new Vector(b2_intersection.X, Math.Max(b2_intersection.Y, b2_intersection2.Y), 0);
                }

                Vector b1 = b1_intersection;
                Vector b2 = b2_intersection;
                Vector b3 = b1 - startEndOrtho / 3;
                Vector b4 = b2 - startEndOrtho / 3;
                Polygons.Add(new ParcourPolygon(b1, b2, b4, b3));
            }
        }
        public void GenerateParcour(ParcourSet parcour, Converter c, double lenght, double channel, int count)
        {
            this.parcour = parcour;
            this.c       = c;
            this.count   = count;
            Line Start = parcour.Line.Single(p => p.Type == (int)LineType.START) as Line;

            if (Start == null)
            {
                return;
            }
            #region StartVektoren
            Vector StartAV             = new Vector(c.LongitudeToX(Start.A.longitude), c.LatitudeToY(Start.A.latitude), 0);
            Vector StartBV             = new Vector(c.LongitudeToX(Start.B.longitude), c.LatitudeToY(Start.B.latitude), 0);
            Vector StartOV             = new Vector(c.LongitudeToX(Start.O.longitude), c.LatitudeToY(Start.O.latitude), 0);
            Vector StartAB             = Vector.Direction(StartAV, StartBV);
            Vector StartMV             = Vector.Middle(StartAV, StartBV);
            Vector StartLotOrientation = Vector.MinDistance(StartAV, StartBV, StartOV);

            double GateRadiusKm      = Converter.NMtoM(0.3);
            Vector StartABNormalized = StartAB / Vector.Abs(StartAB);
            double StartABLength     = Converter.Distance(c.XtoLongitude(StartAV.X), c.YtoLatitude(StartAV.Y), c.XtoLongitude((StartAV + StartABNormalized).X), c.YtoLatitude((StartAV + StartABNormalized).Y));
            Vector StartAB1KM        = StartABNormalized / StartABLength;

            StartLotOrientation = StartLotOrientation * (Vector.Abs(StartAB1KM * GateRadiusKm) / Vector.Abs(StartLotOrientation));
            StartOV             = StartMV + (StartLotOrientation * 2);

            Vector Start_A_M = StartAV + (StartAB1KM * GateRadiusKm);
            Vector Start_A_A = StartAV;
            Vector Start_A_B = Start_A_M + (StartAB1KM * GateRadiusKm);
            Vector Start_A_O = Start_A_M + StartLotOrientation;

            Line Start_A;
            if (parcour.Line.Any(p => p.Type == (int)LineType.START_A))
            {
                Start_A = parcour.Line.Single(p => p.Type == (int)LineType.START_A);
            }
            else
            {
                Start_A      = new Line();
                Start_A.Type = (int)LineType.START_A;
                parcour.Line.Add(Start_A);
            }
            Start_A.A = Factory.newGPSPoint(c.XtoLongitude(Start_A_A.X), c.YtoLatitude(Start_A_A.Y), 0);
            Start_A.B = Factory.newGPSPoint(c.XtoLongitude(Start_A_B.X), c.YtoLatitude(Start_A_B.Y), 0);
            Start_A.O = Factory.newGPSPoint(c.XtoLongitude(Start_A_O.X), c.YtoLatitude(Start_A_O.Y), 0);

            Vector Start_D_M = StartBV - (StartAB1KM * GateRadiusKm);
            Vector Start_D_B = StartBV;
            Vector Start_D_A = Start_D_M - (StartAB1KM * GateRadiusKm);
            Vector Start_D_O = Start_D_M + StartLotOrientation;
            Line   Start_D;
            if (parcour.Line.Any(p => p.Type == (int)LineType.START_D))
            {
                Start_D = parcour.Line.Single(p => p.Type == (int)LineType.START_D);
            }
            else
            {
                Start_D      = new Line();
                Start_D.Type = (int)LineType.START_D;
                parcour.Line.Add(Start_D);
            }
            Start_D.A = Factory.newGPSPoint(c.XtoLongitude(Start_D_A.X), c.YtoLatitude(Start_D_A.Y), 0);
            Start_D.B = Factory.newGPSPoint(c.XtoLongitude(Start_D_B.X), c.YtoLatitude(Start_D_B.Y), 0);
            Start_D.O = Factory.newGPSPoint(c.XtoLongitude(Start_D_O.X), c.YtoLatitude(Start_D_O.Y), 0);


            Vector Start_B_M = Start_A_M + (Vector.Direction(Start_A_M, Start_D_M) / 3.0);
            Vector Start_B_A = Start_B_M - (StartAB1KM * GateRadiusKm);
            Vector Start_B_B = Start_B_M + (StartAB1KM * GateRadiusKm);
            Vector Start_B_O = Start_B_M + StartLotOrientation;

            Line Start_B;
            if (parcour.Line.Any(p => p.Type == (int)LineType.START_B))
            {
                Start_B = parcour.Line.Single(p => p.Type == (int)LineType.START_B);
            }
            else
            {
                Start_B      = new Line();
                Start_B.Type = (int)LineType.START_B;
                parcour.Line.Add(Start_B);
            }
            Start_B.A = Factory.newGPSPoint(c.XtoLongitude(Start_B_A.X), c.YtoLatitude(Start_B_A.Y), 0);
            Start_B.B = Factory.newGPSPoint(c.XtoLongitude(Start_B_B.X), c.YtoLatitude(Start_B_B.Y), 0);
            Start_B.O = Factory.newGPSPoint(c.XtoLongitude(Start_B_O.X), c.YtoLatitude(Start_B_O.Y), 0);

            Vector Start_C_M = Start_A_M + ((Vector.Direction(Start_A_M, Start_D_M) * 2) / 3.0);
            Vector Start_C_B = Start_C_M - (StartAB1KM * GateRadiusKm);
            Vector Start_C_A = Start_C_M + (StartAB1KM * GateRadiusKm);
            Vector Start_C_O = Start_C_M + StartLotOrientation;
            Line   Start_C;
            if (parcour.Line.Any(p => p.Type == (int)LineType.START_C))
            {
                Start_C = parcour.Line.Single(p => p.Type == (int)LineType.START_C);
            }
            else
            {
                Start_C      = new Line();
                Start_C.Type = (int)LineType.START_C;
                parcour.Line.Add(Start_C);
            }
            Start_C.A = Factory.newGPSPoint(c.XtoLongitude(Start_C_A.X), c.YtoLatitude(Start_C_A.Y), 0);
            Start_C.B = Factory.newGPSPoint(c.XtoLongitude(Start_C_B.X), c.YtoLatitude(Start_C_B.Y), 0);
            Start_C.O = Factory.newGPSPoint(c.XtoLongitude(Start_C_O.X), c.YtoLatitude(Start_C_O.Y), 0);
            #endregion

            #region EndeVektoren
            double lengthKm  = Converter.NMtoM(lenght);
            Vector lotPoint  = StartMV + StartLotOrientation;
            double lotLenght = Converter.Distance(c.XtoLongitude(StartMV.X), c.YtoLatitude(StartMV.Y), c.XtoLongitude(lotPoint.X), c.YtoLatitude(lotPoint.Y));
            Vector StartEnd  = (StartLotOrientation / lotLenght) * lengthKm * EndLineDist; //Shorten to make linearcombinations of vectors ... factor to be definded

            Vector EndeAV = StartAV + StartEnd;
            Vector EndeBV = StartBV + StartEnd;
            Vector EndeMV = Vector.Middle(EndeAV, EndeBV);
            Vector EndeOV = EndeMV + StartLotOrientation;
            Vector EndeAB = Vector.Direction(EndeAV, EndeBV);

            Vector Ende_A_A = Start_A_A + StartEnd;
            Vector Ende_A_B = Start_A_B + StartEnd;
            Vector Ende_A_M = Start_A_M + StartEnd;
            Vector Ende_A_O = Start_A_O + StartEnd;

            Line END_A;
            if (parcour.Line.Any(p => p.Type == (int)LineType.END_A))
            {
                END_A = parcour.Line.Single(p => p.Type == (int)LineType.END_A);
            }
            else
            {
                END_A      = new Line();
                END_A.Type = (int)LineType.END_A;
                parcour.Line.Add(END_A);
            }
            END_A.A = Factory.newGPSPoint(c.XtoLongitude(Ende_A_A.X), c.YtoLatitude(Ende_A_A.Y), 0);
            END_A.B = Factory.newGPSPoint(c.XtoLongitude(Ende_A_B.X), c.YtoLatitude(Ende_A_B.Y), 0);
            END_A.O = Factory.newGPSPoint(c.XtoLongitude(Ende_A_O.X), c.YtoLatitude(Ende_A_O.Y), 0);

            Vector Ende_B_A = Start_B_A + StartEnd;
            Vector Ende_B_B = Start_B_B + StartEnd;
            Vector Ende_B_M = Start_B_M + StartEnd;
            Vector Ende_B_O = Start_B_O + StartEnd;

            Line END_B;
            if (parcour.Line.Any(p => p.Type == (int)LineType.END_B))
            {
                END_B = parcour.Line.Single(p => p.Type == (int)LineType.END_B);
            }
            else
            {
                END_B      = new Line();
                END_B.Type = (int)LineType.END_B;
                parcour.Line.Add(END_B);
            }
            END_B.A = Factory.newGPSPoint(c.XtoLongitude(Ende_B_A.X), c.YtoLatitude(Ende_B_A.Y), 0);
            END_B.B = Factory.newGPSPoint(c.XtoLongitude(Ende_B_B.X), c.YtoLatitude(Ende_B_B.Y), 0);
            END_B.O = Factory.newGPSPoint(c.XtoLongitude(Ende_B_O.X), c.YtoLatitude(Ende_B_O.Y), 0);

            Vector Ende_C_A = Start_C_A + StartEnd;
            Vector Ende_C_B = Start_C_B + StartEnd;
            Vector Ende_C_M = Start_C_M + StartEnd;
            Vector Ende_C_O = Start_C_O + StartEnd;
            Line   END_C;
            if (parcour.Line.Any(p => p.Type == (int)LineType.END_C))
            {
                END_C = parcour.Line.Single(p => p.Type == (int)LineType.END_C);
            }
            else
            {
                END_C      = new Line();
                END_C.Type = (int)LineType.END_C;
                parcour.Line.Add(END_C);
            }
            END_C.A = Factory.newGPSPoint(c.XtoLongitude(Ende_C_A.X), c.YtoLatitude(Ende_C_A.Y), 0);
            END_C.B = Factory.newGPSPoint(c.XtoLongitude(Ende_C_B.X), c.YtoLatitude(Ende_C_B.Y), 0);
            END_C.O = Factory.newGPSPoint(c.XtoLongitude(Ende_C_O.X), c.YtoLatitude(Ende_C_O.Y), 0);

            Vector Ende_D_A = Start_D_A + StartEnd;
            Vector Ende_D_B = Start_D_B + StartEnd;
            Vector Ende_D_M = Start_D_M + StartEnd;
            Vector Ende_D_O = Start_D_O + StartEnd;
            Line   END_D;
            if (parcour.Line.Any(p => p.Type == (int)LineType.END_D))
            {
                END_D = parcour.Line.Single(p => p.Type == (int)LineType.END_D);
            }
            else
            {
                END_D      = new Line();
                END_D.Type = (int)LineType.END_D;
                parcour.Line.Add(END_D);
            }
            END_D.A = Factory.newGPSPoint(c.XtoLongitude(Ende_D_A.X), c.YtoLatitude(Ende_D_A.Y), 0);
            END_D.B = Factory.newGPSPoint(c.XtoLongitude(Ende_D_B.X), c.YtoLatitude(Ende_D_B.Y), 0);
            END_D.O = Factory.newGPSPoint(c.XtoLongitude(Ende_D_O.X), c.YtoLatitude(Ende_D_O.Y), 0);
            #endregion

            #region LineOfNoReturn
            double lengthLONRKm = Converter.NMtoM(LineOfNoReturnDist);
            Vector StartToLONR  = (StartLotOrientation / lotLenght) * ((lengthKm * EndLineDist) - lengthLONRKm);

            Vector LONR_A = StartAV + StartToLONR;
            Vector LONR_B = StartBV + StartToLONR;
            Vector LONR_O = StartOV + StartToLONR;
            Line   LONR;
            if (parcour.Line.Any(p => p.Type == (int)LineType.NOBACKTRACKLINE))
            {
                LONR = parcour.Line.Single(p => p.Type == (int)LineType.NOBACKTRACKLINE);
            }
            else
            {
                LONR      = new Line();
                LONR.Type = (int)LineType.NOBACKTRACKLINE;
                parcour.Line.Add(LONR);
            }
            LONR.A = Factory.newGPSPoint(c.XtoLongitude(LONR_A.X), c.YtoLatitude(LONR_A.Y), 0);
            LONR.B = Factory.newGPSPoint(c.XtoLongitude(LONR_B.X), c.YtoLatitude(LONR_B.Y), 0);
            LONR.O = Factory.newGPSPoint(c.XtoLongitude(LONR_O.X), c.YtoLatitude(LONR_O.Y), 0);
            #endregion
            CalculateParcour(parcour, c, channel);
        }