(triangle, line, out)
| 24 | * @return {Phaser.Math.Vector2[]} An array with the points of intersection if objects intersect, otherwise an empty array. |
| 25 | */ |
| 26 | var GetTriangleToLine = function (triangle, line, out) |
| 27 | { |
| 28 | if (out === undefined) { out = []; } |
| 29 | |
| 30 | if (TriangleToLine(triangle, line)) |
| 31 | { |
| 32 | var lineA = triangle.getLineA(); |
| 33 | var lineB = triangle.getLineB(); |
| 34 | var lineC = triangle.getLineC(); |
| 35 | |
| 36 | var output = [ new Vector2(), new Vector2(), new Vector2() ]; |
| 37 | |
| 38 | var result = [ |
| 39 | LineToLine(lineA, line, output[0]), |
| 40 | LineToLine(lineB, line, output[1]), |
| 41 | LineToLine(lineC, line, output[2]) |
| 42 | ]; |
| 43 | |
| 44 | for (var i = 0; i < 3; i++) |
| 45 | { |
| 46 | if (result[i]) |
| 47 | { |
| 48 | out.push(output[i]); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | return out; |
| 54 | }; |
| 55 | |
| 56 | module.exports = GetTriangleToLine; |
no test coverage detected
searching dependent graphs…