Constructor
new Line(begin, end)
Create a new line
Parameters:
Name | Type | Description |
---|---|---|
begin |
Point | |
end |
Point |
Methods
divide(segments) → {Array.<Point>}
Divide the line into segments, returning a list of points.
Parameters:
Name | Type | Description |
---|---|---|
segments |
number | Number of segments. |
Returns:
List of points.
- Type
- Array.<Point>
handDrawn(divisions, variation) → {Array.<Point>}
Convert a line into an array of Points with slight variations.
Parameters:
Name | Type | Description |
---|---|---|
divisions |
number | The number of lines to divide the Line into. |
variation |
number | The number of pixels of variation in X and Y to allow. |
Returns:
- Type
- Array.<Point>
intersection(l) → {Point|undefined}
Find the point at which two lines intersect. The intersection point may not be on either line segment.
Parameters:
Name | Type | Description |
---|---|---|
l |
Line | The line to intersect with |
Returns:
- Type
- Point | undefined
length() → {number}
Return the length of the line
Returns:
- Type
- number