build/phaser-spine.js
function (polygon, x1, y1, x2, y2) {
		var nn = polygon.length;
		var width12 = x1 - x2, height12 = y1 - y2;
		var det1 = x1 * y2 - y1 * x2;
		var x3 = polygon[nn - 2], y3 = polygon[nn - 1];
		for (var ii = 0; ii < nn; ii += 2) {
			var x4 = polygon[ii], y4 = polygon[ii + 1];
			var det2 = x3 * y4 - y3 * x4;
			var width34 = x3 - x4, height34 = y3 - y4;
			var det3 = width12 * height34 - height12 * width34;
			var x = (det1 * width34 - width12 * det2) / det3;
			if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) {
				var y = (det1 * height34 - height12 * det2) / det3;
				if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) return true;
			}
			x3 = x4;
			y3 = y4;
		}
		return false;
	}
function (polygon, x1, y1, x2, y2) {
		var nn = polygon.length;
		var width12 = x1 - x2, height12 = y1 - y2;
		var det1 = x1 * y2 - y1 * x2;
		var x3 = polygon[nn - 2], y3 = polygon[nn - 1];
		for (var ii = 0; ii < nn; ii += 2) {
			var x4 = polygon[ii], y4 = polygon[ii + 1];
			var det2 = x3 * y4 - y3 * x4;
			var width34 = x3 - x4, height34 = y3 - y4;
			var det3 = width12 * height34 - height12 * width34;
			var x = (det1 * width34 - width12 * det2) / det3;
			if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) {
				var y = (det1 * height34 - height12 * det2) / det3;
				if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) return true;
			}
			x3 = x4;
			y3 = y4;
		}
		return false;
	}
function ( polygon , x1 , y1 , x2 , y2 ) { var nn = polygon . length ; var width12 = x1 - x2 , height12 = y1 - y2 ; var det1 = x1 * y2 - y1 * x2 ; var x3 = polygon [ nn - 2 ] , y3 = polygon [ nn - 1 ] ; for ( var ii = 0 ; ii < nn ; ii += 2 ) { var x4 = polygon [ ii ] , y4 = polygon [ ii + 1 ] ; var det2 = x3 * y4 - y3 * x4 ; var width34 = x3 - x4 , height34 = y3 - y4 ; var det3 = width12 * height34 - height12 * width34 ; var x = ( det1 * width34 - width12 * det2 ) / det3 ; if ( ( ( x >= x3 && x <= x4 ) || ( x >= x4 && x <= x3 ) ) && ( ( x >= x1 && x <= x2 ) || ( x >= x2 && x <= x1 ) ) ) { var y = ( det1 * height34 - height12 * det2 ) / det3 ; if ( ( ( y >= y3 && y <= y4 ) || ( y >= y4 && y <= y3 ) ) && ( ( y >= y1 && y <= y2 ) || ( y >= y2 && y <= y1 ) ) ) return true ; } x3 = x4 ; y3 = y4 ; } return false ; }
Returns true if the polygon contains the line segment.
Returns true if the polygon contains the line segment .