/// <summary>
        /// the Quadrangle should be convex
        /// </summary>
        /// <param name="firstCEdge"></param>
        /// <param name="intIndex"></param>
        public static CEdge TriangulateQuadrangle_Delaunay(CEdge firstCEdge)
        {
            //the four edges constitutes a counter clockwise loop
            var secondCEdge = firstCEdge.cedgeNext;
            var thirdCEdge  = secondCEdge.cedgeNext;
            var fourthCEdge = thirdCEdge.cedgeNext;

            firstCEdge.JudgeAndSetAxisAngle();
            secondCEdge.JudgeAndSetAxisAngle();
            thirdCEdge.JudgeAndSetAxisAngle();
            fourthCEdge.JudgeAndSetAxisAngle();

            CEdge newCEdge1 = new CEdge(firstCEdge.FrCpt, thirdCEdge.FrCpt);
            CEdge newCEdge2 = new CEdge(firstCEdge.ToCpt, thirdCEdge.ToCpt);

            newCEdge1.SetAxisAngle();
            newCEdge2.SetAxisAngle();

            var dblMinAngle1 = GetDividedMinAngle(newCEdge1, firstCEdge, secondCEdge, thirdCEdge, fourthCEdge);
            var dblMinAngle2 = GetDividedMinAngle(newCEdge2, secondCEdge, thirdCEdge, fourthCEdge, firstCEdge);

            if (dblMinAngle1 <= dblMinAngle2)
            {
                return(newCEdge1);
            }
            else
            {
                return(newCEdge2);
            }
        }
Пример #2
0
        public CEdge SetBaseLine(bool isSetLength = false, bool isSetAxisAngle = false)
        {
            var pbaseline = new CEdge(this.FrCpt, this.ToCpt);

            if (isSetLength == true)
            {
                pbaseline.SetLength();
            }

            if (isSetAxisAngle == true)
            {
                pbaseline.SetAxisAngle();
            }
            _pBaseLine = pbaseline;

            return(pbaseline);
        }