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

Function TriangleToLine

src/geom/intersects/TriangleToLine.js:22–47  ·  view source on GitHub ↗
(triangle, line)

Source from the content-addressed store, hash-verified

20 * @return {boolean} `true` if the Triangle and the Line intersect, otherwise `false`.
21 */
22var 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
49module.exports = TriangleToLine;

Callers 2

GetTriangleToLineFunction · 0.85

Calls 1

LineToLineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…