Example #1
0
        public static void DrawArrow(Graphics g, int x0, int y0, int x1, int y1, double h, double w)
        {
            Segment3D seg = new Segment3D(x0, y0, 0.0D, x1, y1, 0.0D);
            double    len = seg.SegLength();
            double    x   = seg.p1.x - seg.p0.x;
            double    y   = seg.p1.y - seg.p0.y;
            double    angle;
            Vector3D  p2;

            if (len > 0.0D)
            {
                angle = -System.Math.Atan2(x, y);
                p2    = seg.LinearIntarp((len - h) / len);
            }
            else
            {
                angle = 0.0D;
                p2    = new Vector3D(seg.p0);
                p2.y += h;
            }
            // g.DrawLine((int)(seg.p0.x + 0.5D), (int)(seg.p0.y + 0.5D), (int)(p2.x + 0.5D), (int)(p2.y + 0.5D));
            smat.SetSMat(w, h, 0.0D);
            rmat.SetRzMat(angle);
            tmat.SetTMat(p2.x, p2.y, p2.z);
            Matrix44  mat = smat.MultMat(rmat).MultMat(tmat);
            Polygon3D arw = triangle.Transform(mat);
            // g.DrawPolygon(arw.IxArray(), arw.IyArray(), 3);
        }