我正在尝试实现一个threecsg库,但是当尝试使用实现的函数时,我收到一条错误消息:“Uncaught RangeError: Maximum call stack size exceeded at Plane.splitPolygon (code.html:229)”
代码是:
/******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******/