Turns a segment, the pair [start, end], into a line object.
Example: [[0,0,0], [10,5,0]] -> { start: [0,0,0], end: [10,5,0] }
The segment
The line
Turns each segment, a pair [start, end], into a line object.
Example: three segments -> three lines, in the same order
The segments
One line per segment
Builds a line object from a start and an end point.
Example: start [0,0,0], end [10,5,0] -> { start: [0,0,0], end: [10,5,0] }
The start and end points
The line object
Builds a segment, the pair-of-points form of a line, from a start and an end point.
Example: start [0,0,0], end [10,5,0] -> [[0,0,0], [10,5,0]]
The start and end points
The segment as [start, end]
Joins each point to the next with a line, so a list of points becomes a chain of lines.
Example: [[0,0,0], [5,0,0], [5,5,0]] -> two lines, [0,0,0] to [5,0,0] and [5,0,0] to [5,5,0]
The points, in order
One line per pair of neighboring points
Pairs each start point with the end point at the same position and joins them with a line.
A pair whose two points coincide makes no line and is left out. Example: starts [[0,0,0], [5,0,0]] and ends [[0,5,0], [5,5,0]] -> two lines
The start points and the end points, in matching order
One line per pair, skipping pairs of length 0
Finds the point a fraction of the way along a line: 0 gives the start, 1 the end, 0.5 the middle.
A fraction outside 0 to 1 continues past the ends. Example: { start: [0,0,0], end: [10,0,0] } at 0.5 -> [5,0,0]
The line and the fraction along it
The point on the line
Finds the point where two lines cross.
With checkSegmentsOnly on, the crossing must lie within both segments; off, the lines
extend without end. Parallel lines, lines that pass each other without meeting, and segments
that do not reach each other give undefined. The tolerance says how close counts as meeting.
Example: [0,0,0] to [10,0,0] and [5,-5,0] to [5,5,0] -> [5,0,0]
The two lines, whether to stay within the segments, and the tolerance
The crossing point, or undefined when there is none
Applies a transformation matrix, or a list of them in order, to both ends of a line.
Example: { start: [0,0,0], end: [10,0,0] } moved by [5,5,0] -> { start: [5,5,0], end: [15,5,0] }
The line and the transformation
A new line with the transformed ends
Applies a different transformation to each line: the first transformation to the first line, and so on.
Example: three lines with three translations -> each line moved by its own translation
The lines and one transformation per line
The transformed lines, in the same order
Straight lines between two points, held as plain objects of the form
{ start, end }, and the segment form[start, end]of the same thing. The methods here build lines, measure and transform them, convert between the two forms, place points along them and find where two lines cross. Lengths are in model units.