figureone
    Preparing search index...

    Line definition options object that extends OBJ_Generic (without drawType) and OBJ_FigurePrimitive

    A line can either be defined as two points p1 and p2, or a single point p1, a length and an angle.

    The line has some width that will be filled on both sides of the line points evenly ('mid'), or on one side only. The line's 'positive' side is the side to which it rotates toward when rotating in the positive angle direction around p1. Similarly the line's 'negative' side is the opposite.

    The line can be solid or dashed using the dash property.

    The line can have arrows at one or both ends using the arrow property.

    • p1 TypeParsablePoint — start point of line
    • p2 TypeParsablePoint — end point of line
    • length number — length of line from p1
    • angle number — angle of line from p1
    • width number — (0.01)
    • widthIs number | positive | negative | mid — defines how the width is grown from the polyline's points. Only "mid" is fully compatible with all options in arrow. ("mid")
    • dash TypeDash — leave empty for solid line - use array of numbers for dash line where first number is length of line, second number is length of gap and then the pattern repeats - can use more than one dash length and gap - e.g. [0.1, 0.01, 0.02, 0.01] produces a lines with a long dash, short gap, short dash, short gap and then repeats.
    • arrow OBJ_LineArrows | TypeArrowHead — either an object defining custom arrows or a string representing the name of an arrow head style can be used. If a string is used, then the line will have an arrow at both ends. Arrows are only available for widthIs: 'mid' and linePrimitives: false
    • linePrimitives boolean — Use WebGL line primitives instead of triangle primitives to draw the line (false)
    • lineNum number — Number of line primitives to use when linePrimitivs: true (2)
    • drawBorderBuffer (number | TypeParsableBorder) & TypeParsableBorder — override OBJ_Generic drawBorderBuffer with number to make the drawBorderBuffer the same as the line with additional number thickness on each side and the ends (0)

    To test examples, append them to the boilerplate

    // Simple line defined by two points
    figure.add({
    name: 'l',
    make: 'line',
    p1: [0, 0],
    p2: [0, 1],
    width: 0.02,
    });
    // Dashed line defined by a point, a length and an angle
    figure.add({
    name: 'l',
    make: 'line',
    p1: [0, 0],
    length: 1,
    angle: Math.PI / 2,
    width: 0.03,
    dash: [0.1, 0.02, 0.03, 0.02],
    });
    // Line with two different arrows on ends
    figure.add({
    name: 'l',
    make: 'line',
    p1: [0, 0],
    p2: [0, 1],
    width: 0.03,
    arrow: {
    start: 'rectangle',
    end: 'barb',
    },
    });
    @interface