Examples

Line segment with an arrow head

The code below demonstrates a custom polyline type. A filled arrow head is drawn at each end of the polyline segment.

Note: If the symbol is to be used as a custom line type accessible from the selection list of available line types then the system fixes following properties:
The name of the symbol must be "linen" where n is an integer index to the linetypes.
The list of arguments is fixed.

Copy
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Type : Line symbol *
* Draws the floating arrow                                      *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
line16( x1, y1, dx, dy, len, ptcount, ptmod, alpha, beta, type, ptlen, color, pen )
{
    /* arrow head at origin */
    dhy = ptlen/1.732;
    dhx = ptlen;    
    
     p2x = dhx*dx +dhy*dy;
    p2y = dhx*dy -dhy*dx;
     
     p3x = dhx*dx -dhy*dy;
    p3y = dhx*dy +dhy*dx;
    
     /* fills */
    dhyf1 = dhy/4;
    dhyf2 = dhy/2;
    dhyf3 = dhy/4*3;
    
     f1x = dhx*dx -dhyf1*dy;
    f1y = dhx*dy +dhyf1*dx;
    k1x = dhx*dx +dhyf1*dy;
    k1y = dhx*dy -dhyf1*dx;
    
     f2x = dhx*dx -dhyf2*dy;
    f2y = dhx*dy +dhyf2*dx;
    k2x = dhx*dx +dhyf2*dy;
    k2y = dhx*dy -dhyf2*dx;
    
     f3x = dhx*dx -dhyf3*dy;
    f3y = dhx*dy +dhyf3*dx;
    k3x = dhx*dx +dhyf3*dy;
    k3y = dhx*dy -dhyf3*dx;
    
     /* end point of arrow */
    x2 = x1 + dx * len;
    y2 = y1 + dy * len;
    
     POLY(    x1,y1, 
                   x2,y2,
                   x2 - p2x, y2 - p2y,
                   x2 - p3x, y2 - p3y,
                   x2, y2 );
     POLY(    x2,y2,
                   x2 - f1x,y2 - f1y,
                   x2 - k1x,y2 - k1y,
                   x2,y2);
     POLY(    x2,y2,
                   x2 - f2x,y2 - f2y,
                   x2 - k2x,y2 - k2y,
                   x2,y2);
     POLY(    x2,y2,
                   x2 - f3x,y2 - f3y,
                   x2 - k3x,y2 - k3y,
                   x2,y2);
}