src/Tools/babylon.earcut.js
// check if the middle point of a polygon diagonal is inside the polygon
check if the middle point of a polygon diagonal is inside the polygon
check if the middle point of a polygon diagonal is inside the polygon
function middleInside(a, b) {
        var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;
        do {
            if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))
                inside = !inside;
            p = p.next;
        } while (p !== a);
        return inside;
    }
function middleInside ( a , b ) { var p = a , inside = false , px = ( a . x + b . x ) / 2 , py = ( a . y + b . y ) / 2 ; do { if ( ( ( p . y > py ) !== ( p . next . y > py ) ) && ( px < ( p . next . x - p . x ) * ( py - p . y ) / ( p . next . y - p . y ) + p . x ) ) inside = ! inside ; p = p . next ; } while ( p !== a ) ; return inside ; }
check if the middle point of a polygon diagonal is inside the polygon
check if the middle point of a polygon diagonal is inside the polygon