What is the "Uncaught RangeError: Maximum call stack size exceeded"

1.2k views Asked by At

I am try to implement a threecsg library, but when trying to use the functions implemented I get an error saying: "Uncaught RangeError: Maximum call stack size exceeded at Plane.splitPolygon (code.html:229)"

the code is:

    /******Code ommitted above******/
    // Split `polygon` by this plane if needed, then put the polygon or polygon
    // fragments in the appropriate lists. Coplanar polygons go into either
    // `coplanarFront` or `coplanarBack` depending on their orientation with
    // respect to this plane. Polygons in front or in back of this plane go into
    // either `front` or `back`.
    splitPolygon(polygon, coplanarFront, coplanarBack, front, back) {   //this is the line with issues
        var COPLANAR = 0;
        var FRONT = 1;
        var BACK = 2;
        var SPANNING = 3;

        // Classify each point as well as the entire polygon into one of the above
        // four classes.
        var polygonType = 0;
        var types = [];
        for (var i = 0; i < polygon.vertices.length; i++) {
            var t = this.normal.dot(polygon.vertices[i].pos) - this.w;
            var type = (t < -Plane.EPSILON) ? BACK : (t > Plane.EPSILON) ? FRONT : COPLANAR;
            polygonType |= type;
            types.push(type);
        }
    /******code omitted below******/
0

There are 0 answers