Beispiel #1
0
        public GE_Point PerpendPoint(GE_Point pt)
        {
            GE_Point ptRet;

            if (m_Kind == 1)
            {
                GE_Vector v = Geo.GetVector(m_CenterPoint, pt);
                ptRet = m_CenterPoint + v * m_Radiu;
            }
            else
            {
                double          dL       = Length();
                List <GE_Point> ayPoints = new List <GE_Point>();
                ayPoints.Add(m_StartPoint);
                ayPoints.Add(m_EndPoint);
                ayPoints.Add(pt);
                double    dArea = Geo.AreaRange(ayPoints);
                double    dDist = dArea * 2 / dL;
                GE_Vector vp    = Vector();
                if (Geo.AcGePosition(m_StartPoint, m_EndPoint, pt) > 0)
                {
                    vp.RotateBy(Geo.PI2);
                }
                else
                {
                    vp.RotateBy(-Geo.PI2);
                }
                ptRet = pt + vp * dDist;
            }
            return(ptRet);
        }
Beispiel #2
0
        static public GE_Vector GetVector(GE_Point ptFrom, GE_Point ptTo)
        {
            GE_Vector v = new GE_Vector(ptTo.X - ptFrom.X, ptTo.Y - ptFrom.Y);

            v.normalize();
            return(v);
        }
Beispiel #3
0
        static public bool GetArcByPoint(GE_Point pt1, GE_Point pt2, GE_Point pt3, out GE_Point ptCenter)
        {
            bool bRet = false;

            ptCenter = new GE_Point();

            GE_Line   lin1 = new GE_Line();
            GE_Line   lin2 = new GE_Line();
            GE_Point  ptM1 = Geo.AcGeMidPoint(pt1, pt2);
            GE_Point  ptM2 = Geo.AcGeMidPoint(pt2, pt3);
            GE_Vector vp   = Geo.GetVector(pt1, pt2);

            vp.RotateBy(PI2);
            lin1.set(ptM1, ptM1 + vp * 100.0);
            vp = Geo.GetVector(pt2, pt3);
            vp.RotateBy(PI2);
            lin2.set(ptM2, ptM2 + vp * 100.0);
            GE_Point ptCen1, ptCen2;
            int      nRet = lin1.intersectWith(lin2, out ptCen1, out ptCen2);

            if (nRet > 0)
            {
                ptCenter = ptCen1;
                bRet     = true;
            }
            return(bRet);
        }
Beispiel #4
0
 public GE_Vector(GE_Vector v)
 {
     m_X = v.X;
     m_Y = v.Y;
 }
Beispiel #5
0
        static public double GetAngleByPoint(GE_Point ptFrom, GE_Point ptTo)
        {
            GE_Vector v = GetVector(ptFrom, ptTo);

            return(v.GetAngle());
        }