Example #1
0
        private static void DrawTeeArrow(Graphics g, Brush brush, ref P2 start, ref P2 end, int lineWidth)
        {
            double lw = lineWidth == -1 ? 1 : lineWidth;

            using (Pen p = new Pen(brush, (float)lw)) {
                g.DrawLine(p, P2ToPointF(start), P2ToPointF(end));
                P2 dir = end - start;
                P2 h   = dir;
                dir /= dir.Length;

                P2 s = new P2(-dir.Y, dir.X);

                s *= 2 * h.Length * ((float)Math.Tan(arrowAngle * 0.5f * (Math.PI / 180.0)));
                s += (1 + lw) * s.Normalize();

                g.DrawLine(p, P2ToPointF(start + s), P2ToPointF(start - s));
            }
        }