コード例 #1
0
        //get the radius line perpendicular to the tangent at ptTo
        public void get_RTo(StraightLine rTo)
        {
            StraightLine TangTo = new StraightLine();

            GetTangTo(TangTo);
            //zhang revised
            if (TangTo.bVerticalLine == false)
            {
                if (TangTo.k == 0)
                {
                    rTo.xIntercept    = ptTo.X;
                    rTo.bVerticalLine = true;
                }
                else
                {
                    rTo.k             = -1 / TangTo.k;
                    rTo.b             = ptTo.Y + ptTo.X / TangTo.k;
                    rTo.bVerticalLine = false;
                }
            }
            else//true
            {
                rTo.k             = 0;
                rTo.b             = ptTo.Y;
                rTo.bVerticalLine = false;
            }
        }
コード例 #2
0
 public static String GetPointIntersection(StraightLine line1, StraightLine line2, IPoint PI)
 {
     if (line1.bVerticalLine == false && line2.bVerticalLine == false)
     {
         PI.X = (line2.b - line1.b) / (line1.k - line2.k);
         PI.Y = line1.k * PI.X + line1.b;
         return(null);
     }
     else if (line1.bVerticalLine == false && line2.bVerticalLine == true)
     {
         PI.X = line2.b;
         PI.Y = line1.k * line2.b + line1.b;
         return(null);
     }
     else if (line1.bVerticalLine == true && line2.bVerticalLine == false)
     {
         PI.X = line1.b;
         PI.Y = line2.k * line1.b + line2.b;
         return(null);
     }
     else if (line1.bVerticalLine == true && line2.bVerticalLine == true)
     {
         //int i = 0;
         return("Bad Roadway Network!");
         //MessageBox.Show("Bad Roadway Network!");
     }
     else
     {
         return(null);
     }
 }
コード例 #3
0
        //Internal methods
        //get the radius line perpendicular to the tangent at ptFrom
        public void get_RFrom(StraightLine rFrom)
        {
            StraightLine TangFrom = new StraightLine();

            GetTangFrom(TangFrom);
            if (TangFrom.bVerticalLine == false)
            {
                if (TangFrom.k == 0)
                {
                    rFrom.bVerticalLine = true;
                    rFrom.xIntercept    = ptFrom.X;
                }
                else
                {
                    rFrom.bVerticalLine = false;
                    rFrom.k             = -1 / TangFrom.k;
                    rFrom.b             = ptFrom.Y + ptFrom.X / TangFrom.k;
                }
            }
            else
            {
                rFrom.k             = 0;
                rFrom.b             = ptFrom.Y;
                rFrom.bVerticalLine = false;
            }
        }
コード例 #4
0
        //point of intersection
        public void GetPI(IPoint PI)
        {
            StraightLine TangFrom = new StraightLine();

            GetTangFrom(TangFrom);
            StraightLine TangTo = new StraightLine();

            GetTangTo(TangTo);

            StraightLine.GetPointIntersection(TangFrom, TangTo, PI);
        }
コード例 #5
0
        //the tangent line at ptTo
        public void GetTangTo(StraightLine tangTo)
        {
            StraightLine slTemp = new StraightLine(ptAfterTo, ptTo);

            if (slTemp.bVerticalLine == false)
            {
                tangTo.k = slTemp.k;
                tangTo.b = slTemp.b;
            }
            else
            {
                tangTo.xIntercept = slTemp.xIntercept;
            }
        }
コード例 #6
0
        //Center Point
        public void GetCenterPT(IPoint ptCenter)
        {
            //debug zli
            if (lCurveID == 27)
            {
                //int i = 0;
            }
            StraightLine rFrom = new StraightLine();
            StraightLine rTo   = new StraightLine();

            get_RFrom(rFrom);
            get_RTo(rTo);

            StraightLine.GetPointIntersection(rFrom, rTo, ptCenter);
        }
コード例 #7
0
        //Public Methods
        //the tangent line at ptFrom
        public void GetTangFrom(StraightLine tangFrom)
        {
            StraightLine slTemp = new StraightLine(ptBeforeFrom, ptFrom);

            //zhang revised
            if (slTemp.bVerticalLine == false)
            {
                tangFrom.k = slTemp.k;
                tangFrom.b = slTemp.b;
            }
            else
            {
                tangFrom.xIntercept = slTemp.xIntercept;
            }
        }