(triangle, line)
| 20 | * @return {boolean} `true` if the Triangle and the Line intersect, otherwise `false`. |
| 21 | */ |
| 22 | var TriangleToLine = function (triangle, line) |
| 23 | { |
| 24 | // If the Triangle contains either the start or end point of the line, it intersects |
| 25 | if (triangle.contains(line.x1, line.y1) || triangle.contains(line.x2, line.y2)) |
| 26 | { |
| 27 | return true; |
| 28 | } |
| 29 | |
| 30 | // Now check the line against each line of the Triangle |
| 31 | if (LineToLine(triangle.getLineA(), line)) |
| 32 | { |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | if (LineToLine(triangle.getLineB(), line)) |
| 37 | { |
| 38 | return true; |
| 39 | } |
| 40 | |
| 41 | if (LineToLine(triangle.getLineC(), line)) |
| 42 | { |
| 43 | return true; |
| 44 | } |
| 45 | |
| 46 | return false; |
| 47 | }; |
| 48 | |
| 49 | module.exports = TriangleToLine; |
no test coverage detected
searching dependent graphs…