コード例 #1
0
        bool GetArrowHead(On2dVector dir, On2dPoint tip, double scale, ref On3dPointArray triangle)
        {
            double arrow_size = m_default_arrow_size * scale;

            On2dPointArray corners = new On2dPointArray();

            corners.Reserve(3);
            corners.SetCount(3);

            On2dVector up = new On2dVector(-dir.y, dir.x);

            corners[0].Set(tip.x, tip.y);
            corners[1].x = tip.x + arrow_size * (0.25 * up.x - dir.x);
            corners[1].y = tip.y + arrow_size * (0.25 * up.y - dir.y);
            corners[2].x = corners[1].x - 0.5 * arrow_size * up.x;
            corners[2].y = corners[1].y - 0.5 * arrow_size * up.y;

            triangle.Reserve(corners.Count());
            triangle.SetCount(corners.Count());

            for (int i = 0; i < corners.Count(); i++)
            {
                triangle[i] = m_plane.PointAt(corners[i].x, corners[i].y);
            }

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Public constructor
        /// </summary>
        public SampleCsDrawArrowheadConduit(OnPlane plane, OnLine line, double scale)
            : base(new MSupportChannels(MSupportChannels.SC_CALCBOUNDINGBOX | MSupportChannels.SC_DRAWOVERLAY), false)
        {
            m_bDraw     = false;
            m_plane     = plane;
            m_line      = line;
            m_arrowhead = new On3dPointArray();

            double x = 0, y = 0;

            m_plane.ClosestPointTo(line.from, ref x, ref y);
            On2dPoint from = new On2dPoint(x, y);

            m_plane.ClosestPointTo(line.to, ref x, ref y);
            On2dPoint to = new On2dPoint(x, y);

            On2dVector dir = new On2dVector(from - to);

            dir.Unitize();

            m_bDraw = GetArrowHead(dir, from, scale, ref m_arrowhead);
        }
コード例 #3
0
        bool GetArrowHead(On2dVector dir, On2dPoint tip, double scale, ref On3dPointArray triangle)
        {
            double arrow_size = m_default_arrow_size * scale;

              On2dPointArray corners = new On2dPointArray();
              corners.Reserve(3);
              corners.SetCount(3);

              On2dVector up = new On2dVector(-dir.y, dir.x);
              corners[0].Set(tip.x, tip.y);
              corners[1].x = tip.x + arrow_size * (0.25 * up.x - dir.x);
              corners[1].y = tip.y + arrow_size * (0.25 * up.y - dir.y);
              corners[2].x = corners[1].x - 0.5 * arrow_size * up.x;
              corners[2].y = corners[1].y - 0.5 * arrow_size * up.y;

              triangle.Reserve(corners.Count());
              triangle.SetCount(corners.Count());

              for (int i = 0; i < corners.Count(); i++)
            triangle[i] = m_plane.PointAt(corners[i].x, corners[i].y);

              return true;
        }
コード例 #4
0
        /// <summary>
        /// Public constructor
        /// </summary>
        public SampleCsDrawArrowheadConduit(OnPlane plane, OnLine line, double scale)
            : base(new MSupportChannels(MSupportChannels.SC_CALCBOUNDINGBOX | MSupportChannels.SC_DRAWOVERLAY), false)
        {
            m_bDraw = false;
              m_plane = plane;
              m_line = line;
              m_arrowhead = new On3dPointArray();

              double x = 0, y = 0;

              m_plane.ClosestPointTo(line.from, ref x, ref y);
              On2dPoint from = new On2dPoint(x, y);

              m_plane.ClosestPointTo(line.to, ref x, ref y);
              On2dPoint to = new On2dPoint(x, y);

              On2dVector dir = new On2dVector(from - to);
              dir.Unitize();

              m_bDraw = GetArrowHead(dir, from, scale, ref m_arrowhead);
        }