Settings

Choose language

line(point1,point2)

line
.p1
.p2
.a1
.a2
.l
.x1
.x2
.y1
.y2
.dx
.dy
Draws a line between two points.

It is important to remember that the line will have a direction from first point to second point. For example, in case you later decide to split the line in two smaller lines, the first being 30% long, the software will start measuring 30% of length from the first point.

When you hover over a line in visual pattern window, the starting point will be highlighted in bright orange, and the ending point will be highlighted in bright blue. You will also see a popup with information about the line, including its length for this very size of pattern.

Function parameters


  • name of the first point
  • name of the second point

    If the name of a line is not set in code, the default name is formed as L_firstpoint_secondpoint. E.g. an unnamed line between points P1 and P2 will get name L_P1_P2.
    Names of points can be substituted with function point(x,y). In this case, it is mandatory to specify the name of the future line, as there are no point names to create it automatically.

    Object properties


    After a line is created, you can get its properties by using the following syntax:
  • a1 or .a2 - the angle at the first/second point with the horizontal
  • .l - the length of the line
  • .p1 - the first point
  • .p2 - the second point
  • .x1 - x coordinate for the first point
  • .y1 - y coordinate for the first point
  • .x2 - x coordinate for the second point
  • .y2 - y coordinate for the second point
  • .dx - difference of x coordinate values between the first and the second points
  • .dy - difference of y coordinate values between the first and the second point

    Imaginary line


    The above properties can also be got for an imaginary line between two points. The syntax of imaginary line is [point1:point2]. E.g. [p1:p2].a1[p1:p2].l etc.

    Usage


    See the above code played in the visual pattern window line by line (P1 is at 10,10 and P2 is at 50,70):
    line(p1,p2);
    line1=line((point(10,10),point(20,20));
    line2=line(point(P1.x,P2.y+5),L_P1_P2.p2);

      
  • Previous article

    adjacent (point1,point2,length,side)

    Next article

    arc(point1,point2,angle1,angle2)