Example #1
0
        //public double GetAngleTo(GE_Vector vector)
        //{
        //    double dAng1, dAng2;

        //    if (Geo.fequ(m_X, 0)) { dAng1 = 0; }
        //    else { dAng1 = Math.Atan(m_Y / m_X); }
        //    if (Geo.fequ(vector.X, 0)) { dAng2 = 0; }
        //    else { dAng2 = Math.Atan(vector.Y / vector.X); }

        //    return Geo.Mid_angle(dAng1, dAng2);
        //}
        public double GetAngle()
        {
            double dAngle = 0;

            if (Geo.fequ(m_Y, 0))
            {
                if (m_X >= 0)
                {
                    dAngle = 0;
                }
                else
                {
                    dAngle = Math.PI;
                }
            }
            else
            {
                if (Geo.fequ(m_X, 0))
                {
                    if (m_Y > 0)
                    {
                        dAngle = Math.PI / 2;
                    }
                    else
                    {
                        dAngle = Math.PI * 1.5;
                    }
                }
                else
                {
                    dAngle = Math.Atan(Math.Abs(m_Y) / Math.Abs(m_X));
                    if (m_X > 0 && m_Y > 0)
                    {
                        //第一象限
                    }
                    else if (m_X > 0 && m_Y < 0)
                    {
                        //第四象限
                        dAngle = Math.PI * 2 - dAngle;
                    }
                    else if (m_X < 0 && m_Y > 0)
                    {
                        //第二象限
                        dAngle = Math.PI - dAngle;
                    }
                    else
                    {
                        //第三象限
                        dAngle = Math.PI + dAngle;
                    }
                }
            }
            return(dAngle);
        }
Example #2
0
        public double Length()
        {
            double dRet = 0;

            if (m_Kind == 0)
            {
                dRet = m_StartPoint.distanceTo(m_EndPoint);
            }
            else
            {
                dRet = Geo.GetArcLengthByPoint(m_CenterPoint, m_StartPoint, m_EndPoint);
            }
            return(dRet);
        }
Example #3
0
 public void reverse()
 {
     Geo.Exchange_point(ref m_StartPoint, ref m_EndPoint);
 }
Example #4
0
 public GE_Vector Vector()
 {
     return(Geo.GetVector(m_StartPoint, m_EndPoint));
 }