* @param {PointElement[]} points * @param {PointElement} sourcePoint * @param {LineElement[]} linesBelow
(points, sourcePoint, linesBelow)
| 56 | * @param {LineElement[]} linesBelow |
| 57 | */ |
| 58 | function addPointsBelow(points, sourcePoint, linesBelow) { |
| 59 | const postponed = []; |
| 60 | for (let j = 0; j < linesBelow.length; j++) { |
| 61 | const line = linesBelow[j]; |
| 62 | const {first, last, point} = findPoint(line, sourcePoint, 'x'); |
| 63 | |
| 64 | if (!point || (first && last)) { |
| 65 | continue; |
| 66 | } |
| 67 | if (first) { |
| 68 | // First point of a segment -> need to add another point before this, |
| 69 | postponed.unshift(point); |
| 70 | } else { |
| 71 | points.push(point); |
| 72 | if (!last) { |
| 73 | // In the middle of a segment, no need to add more points. |
| 74 | break; |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | points.push(...postponed); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * @param {LineElement} line |
no test coverage detected