我正在尝试创建一个简单的参数化形状(矩形),在中间有一个洞来创建一个框架。可悲的是,没有创建一个洞。控制台说THREE.ShapeUtils: Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!
但是在调试会话后我发现它错了。这是我的代码,其中的注释包含.currentpoint
var frameblock = new THREE.Shape();
frameblock.moveTo(topleft.x - 2*99/Math.SQRT2,topleft.y + 2*99/Math.SQRT2); // move to topleft x: -570 y: 410
frameblock.lineTo(topright.x + 99/Math.SQRT2,topright.y + 2*99/Math.SQRT2); // draw to topright x: 1092 y: 410
frameblock.lineTo(bottomright.x + 2* 99/Math.SQRT2 ,bottomright.y - 99/Math.SQRT2 ); //draw to bottomright x: 1092 y: -570
frameblock.lineTo(topleft.x - 2*99/Math.SQRT2,bottomleft.y - 99/Math.SQRT2); //draw to bottomleft x: -570 y:-570
frameblock.lineTo(topleft.x - 2*99/Math.SQRT2,topleft.y + 2*99/Math.SQRT2); // draw to topleft x: -570 y: 410
var framehole = new THREE.Path();
framehole.moveTo(topleft.x - 99/Math.SQRT2,topleft.y + 99/Math.SQRT2); // move to topleft x: -500 y: 340
framehole.lineTo(topright.x,topright.y + 99/Math.SQRT2); // draw to topright x:1022 y:340
framehole.lineTo(bottomright.x + 99/Math.SQRT2 ,bottomright.y); //draw to bottomright x:1022 y:-500
framehole.lineTo(topleft.x - 99/Math.SQRT2,bottomleft.y); //draw to bottomleft x: -500 y: -500
framehole.lineTo(topleft.x - 99/Math.SQRT2,topleft.y + 99/Math.SQRT2); // draw to topleft x: -500 y: 340
frameblock.holes.push(framehole);
var framegeometry = new THREE.ShapeGeometry(frameblock);
答案 0 :(得分:1)
问题是它没有逆时针绘制。所以正确的顺序是:
print()