Example #1
0
        /// <summary>
        /// Konstruktor czteroparametrowy.
        /// Wazna jest kolejnosc.
        /// </summary>
        /// <param name="point1">Pierwszy wierzcholek.</param>
        /// <param name="point2">Drugi wierzcholek.</param>
        /// <param name="point3">Trzeci wierzcholek.</param>
        /// <param name="point4">Czwarty wierzcholek.</param>
        /// <autor>Michal Ziober</autor>
        public Quadrangle(PointD point1, PointD point2, PointD point3, PointD point4)
        {
            PeakManager peakManager = new PeakManager(point1, point2, point3, point4);

            if (peakManager.Peaks.Count == 4)
            {
                peaks = peakManager.Peaks;
            }
            else
            {
                peaks = new List <PointD>();
            }
            angle         = 0;
            climbingAngle = 0;
            width         = Mathematics.MaxCoordinate(true, point1, point2, point3, point4).X -
                            Mathematics.MinCordinate(true, point1, point2, point3, point4).X;
            height = Mathematics.MaxCoordinate(false, point1, point2, point3, point4).Y -
                     Mathematics.MinCordinate(false, point1, point2, point3, point4).Y;
        }
Example #2
0
        /// <summary>
        /// Konstruktor czteroparametrowy.
        /// </summary>
        /// <param name="point1">Wierzcholek Nr:1.</param>
        /// <param name="point2">Wierzcholek Nr:2.</param>
        /// <param name="point3">Wierzcholek Nr:3.</param>
        /// <param name="point4">Wierzcholek Nr:4.</param>
        public PeakManager(PointD point1, PointD point2, PointD point3, PointD point4)
        {
            peaks = new List <PointD>();

            List <PointD> tmpList = new List <PointD>();

            tmpList.Add(point1);
            tmpList.Add(point2);
            tmpList.Add(point3);
            tmpList.Add(point4);

            PointD minXPointD = Mathematics.MinCordinate(true, point1, point2, point3, point4);
            PointD minYPointD = Mathematics.MinCordinate(false, point1, point2, point3, point4);
            PointD maxXPointD = Mathematics.MaxCoordinate(true, point1, point2, point3, point4);
            PointD maxYPointD = Mathematics.MaxCoordinate(false, point1, point2, point3, point4);

            AddFirstPeak(minXPointD, tmpList);
            AddSecondPoint(maxYPointD, tmpList);
            AddThirdPeak(maxXPointD, tmpList);
            AddFourthPoint(minYPointD, tmpList);
        }