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.
// Simple line defined by two points figure.add({ name:'l', make:'line', p1: [0, 0], p2: [0, 1], width:0.02, });
Example
// 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], });
Example
// 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
Line definition options object that extends OBJ_Generic (without
drawType) and OBJ_FigurePrimitiveA line can either be defined as two points
p1andp2, or a single pointp1, alengthand anangle.The line has some
widththat 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 aroundp1. Similarly the line's'negative'side is the opposite.The line can be solid or dashed using the
dashproperty.The line can have arrows at one or both ends using the
arrowproperty.See
To test examples, append them to the boilerplate
Example
Example
Example