SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

ANGRAD

Name:
    ANGRAD (LET)
Type:
    Library Function
Purpose:
    Return the counter clockwise angle, in radians, of the the angle determined by three vertices (i.e., two rays).
Description:
    Given the 3 sets of vertices (X1,Y1), (X2,Y2), and (X3,Y3), an angle is defined by the two line segments:

    1. (X1,Y1) - (X2,Y2)
    2. (X2,Y2) - (X3,Y3)

    There are actually two angles defined by these two line segments. One is defined by the counter clockwise direction and the other is defined by the clockwise direction. For example, given the points (0,1), (0,0) and (1,0), the counter clockwise angle is 3*PI/2 (= 4.712389) and the clockwise angle is PI/2 (= 1.570796).

    This function returns the counter clockwise angle. To return the clockwise angle, you can do something like

      LET A = 2*PI - ANGRAD(X1,Y1,X2,Y2,X3,Y3)
Syntax:
    LET <y> = ANGRAD(<x1>,<y1>,<x2>,<y2>,<x3>,<y3>)
                            <SUBSET/EXCEPT/FOR qualification>
    where <x1> is a variable or a parameter containing the x coordinates of the first vertex;
                <y1> is a variable or a parameter containing the y coordinates of the first vertex;
                <x2> is a variable or a parameter containing the x coordinates of the second vertex;
                <y2> is a variable or a parameter containing the y coordinates of the second vertex;
                <x3> is a variable or a parameter containing the x coordinates of the third vertex;
                <y3> is a variable or a parameter containing the y coordinates of the third vertex;
                <y> is a variable or a parameter (depending on what the input arguments are) where the computed angle values are stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET A = ANGRAD(0,1,0,0,1,0)
    LET A = ANGRAD(X1,Y1,X2,Y2,X3,Y3)
Default:
    None
Synonyms:
    None
Reference:
    This code is adapted from John Burkhardt's geometry.f90 library.
Related Commands:
    DPNTLINE = Compute the perpindicular distance between a point and a line defined by a point and a slope.
    POINTS IN POLYGON = Determine whether points are in the interior of a convex polygon.
    CONVEX HULL = Determine the convex hull of a set of points.
    TRANSFORM POINTS = Perform location, scale, and rotation transformation for a set of points.
    EXTREME POINTS = Determine the extreme points of a set of points.
    LINE INTERSECTIONS = Determine the intersection points for a set of lines.
    PARALLEL LINE = Determine the coordinates for a point that defines a parallel line determined by a point and a line defined by two points.
    PERPINDICULAR LINE = Determine the coordinates for a point that defines a perpindicular line determined by a point and a line defined by two points.
Applications:
    Computational Geometry
Implementation Date:
    2012/10
Program:
     
    LET X1 = DATA  0 -1  0  1
    LET Y1 = DATA  1  0 -1  0
    LET X2 = 0  FOR I = 1 1 4
    LET Y2 = 0  FOR I = 1 1 4
    LET X3 = 1  FOR I = 1 1 4
    LET Y3 = 0  FOR I = 1 1 4
    LET YANG = ANGRAD(X1,Y1,X2,Y2,X3,Y3)
    SET WRITE DECIMALS 4
    PRINT X1 Y1 YANG
        
    The following output is generated.
    ---------------------------------------------
                 X1             Y1           YANG
    ---------------------------------------------
             0.0000         1.0000         4.7123
            -1.0000         0.0000         3.1415
             0.0000        -1.0000         1.5707
             1.0000         0.0000         0.0000
        

Date created: 01/07/2013
Last updated: 01/13/2013
Please email comments on this WWW page to alan.heckert@nist.gov.