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

LINE INTERSECTIONS

Name:
    LINE INTERSECTIONS
Type:
    LET Subcommand
Purpose:
    Find the point of intersection for two sets of lines.
Description:
    Given two sets of lines where each line is defined by two points, return the point of intersection. That is, we have the variables

      X1 Y1 X2 Y2 X3 Y3 X4 Y4

    where each row of X1, Y1 X2, and Y2 defines line one and the corresponding row of X3, Y3, X4, and Y4 defines line two. If there are N rows, then this command will return the x and y coordinates for each of the N rows.

    The variables can in fact be parameters (i.e., a single value), but all arguments that are variables must contain the same number of rows.

    If the lines are parallel, the x and y coordinates for that row will be set to the minimum real value on the machine. You can enter the commands

      PROBE CPUMIN
      LET CPUMIN = PROBEVAL

    if you need to check for this value.

Syntax:
    LET <yout> <xout>= LINE INTERSECTIONS <x1> <y1> <x2> <y2> <x3> <y3>
                                        <x4> <y4>
                                        <SUBSET/EXPCEPT/FOR qualification>
    where <x1> is a variable or parameter containing the x-coordinates for the first point of line one;
                <y1> is a variable or parameter containing the y-coordinates for the first point of line one;
                <x2> is a variable or parameter containing the x-coordinates for the second point of line one;
                <y2> is a variable or parameter containing the y-coordinates for the second point of line one;
                <x3> is a variable or parameter containing the x-coordinates for the first point of line two;
                <y3> is a variable or parameter containing the y-coordinates for the first point of line two;
                <x4> is a variable or parameter containing the x-coordinates for the second point of line two;
                <y4> is a variable or parameter containing the y-coordinates for the second point of line two;
                <yout> is a variable containing the y-coordinates of the intersection points;
                <xout> is a variable containing the x-coordinates of the intersection points;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET YOUT XOUT = LINE INTERSECTIONS X1 Y1 X2 Y2 X3 Y3 X4 Y4
Default:
    None
Synonyms:
    None
Related Commands:
    ANGRAD = Return the counter clockwise angle, in radians, of the angle determined by three points.
    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.
    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:
     
    read  x y
      0.5333000E+02  0.2357000E+02
      0.5037000E+02  0.1668000E+02
      0.1686000E+02 -0.6469000E+02
      0.5521000E+02  0.2713000E+02
      0.1395000E+02 -0.6794000E+02
      0.5414000E+02  0.2781000E+02
      0.2704000E+02 -0.4195000E+02
      0.1830000E+02 -0.6416000E+02
     -0.8881000E+02 -0.2991900E+03
      0.6442000E+02  0.5613000E+02
     -0.1728800E+03 -0.5288300E+03
      0.4743000E+02  0.1766000E+02
      0.3282400E+03  0.4791700E+03
      0.2137600E+03  0.1424400E+03
      0.2067600E+03  0.1877700E+03
      0.3593000E+02 -0.2923600E+03
      0.3637600E+03  0.3094700E+03
      0.2974600E+03  0.6332000E+02
      0.1759800E+03 -0.1644000E+03
      0.4257500E+03  0.3561300E+03
      0.6733000E+02  0.9115000E+02
      0.5081000E+02  0.2532000E+02
     -0.2029900E+03 -0.5509600E+03
      0.7737000E+02  0.6375000E+02
      0.3363100E+03  0.3074700E+03
      0.1296400E+03 -0.1771600E+03
      0.2421000E+02 -0.5091200E+03
      0.1670100E+03 -0.1446500E+03
      0.2401100E+03 -0.3796800E+03
      0.5067400E+03  0.4129400E+03
      0.5173100E+03  0.4183700E+03
      0.8339000E+02 -0.6446200E+03
      0.1908800E+03  0.3463800E+03
      0.1629900E+03  0.3044400E+03
     -0.1138500E+03 -0.4050300E+03
      0.2787200E+03  0.4979900E+03
     -0.7125000E+02 -0.4863700E+03
      0.2147300E+03  0.1820300E+03
     -0.1757900E+03 -0.5140500E+03
     -0.1993500E+03 -0.5823900E+03
      0.1438700E+03  0.2333900E+03
      0.2134000E+02 -0.6915000E+02
     -0.4354000E+02 -0.4289700E+03
      0.3219800E+03  0.4268300E+03
      0.2507000E+02 -0.2689300E+03
     -0.8324000E+02 -0.5685300E+03
      0.8540000E+02 -0.4379000E+03
      0.7870000E+02 -0.3830800E+03
     -0.1064000E+02 -0.6613600E+03
      0.2023700E+03 -0.3954000E+02
      0.2877000E+02 -0.3549000E+02
      0.1908000E+02 -0.5440000E+02
      0.3766000E+02 -0.1542000E+02
      0.5360000E+02  0.1845000E+02
     -0.1782900E+03 -0.5311500E+03
     -0.9508000E+02 -0.5267900E+03
      0.1183700E+03 -0.6679000E+02
      0.4384000E+02 -0.4773700E+03
      0.1847200E+03 -0.5284000E+02
      0.1714300E+03  0.3265600E+03
      0.1928600E+03  0.3423200E+03
     -0.1705300E+03 -0.4889800E+03
      0.4415000E+02  0.8400000E+01
     -0.1434000E+03 -0.4216400E+03
      0.6579000E+02  0.2837000E+02
    end of data
    .
    let x1 = x(44)
    let y1 = y(44)
    let x2 = x(46)
    let y2 = y(46)
    let x3 = x(21)
    let y3 = y(21
    let x4 = x(29)
    let y4 = y(29)
    .
    let xout yout = line intersection x1 y1 x2 y2 x3 y3 x4 y4
    set write decimals 3
    print xout yout
    .
    let x5 = xout(1)
    let y5 = yout(1)
    let zx = combine x1 x2 x3 x4 x5
    let zy = combine y1 y2 y3 y4 y5
    let ztag = data 1 1 2 2 3
    char 1 2 circle
    char hw 1.0 0.75 all
    char fill on all
    .
    plot zy zx ztag
        
    The following output is generated
    ------------------------------
               XOUT           YOUT
    ------------------------------
            109.859        -94.211
        

    plot generated by sample program

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