MCPcopy Create free account
hub / github.com/phaserjs/phaser / GetTriangleToLine

Function GetTriangleToLine

src/geom/intersects/GetTriangleToLine.js:26–54  ·  view source on GitHub ↗
(triangle, line, out)

Source from the content-addressed store, hash-verified

24 * @return {Phaser.Math.Vector2[]} An array with the points of intersection if objects intersect, otherwise an empty array.
25 */
26var 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
56module.exports = GetTriangleToLine;

Callers 2

GetTriangleToTriangleFunction · 0.85

Calls 2

TriangleToLineFunction · 0.85
LineToLineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…