我生成10个随机点。我希望将每个点彼此连接起来,并为每个平坦区域获得面孔。因此,它将是一个很好的3D物体,里面有隐形的平面。
如何从10个随机点的几何体中制作面?
var objects3 = [];
var geometrySpline = new THREE.Geometry();
for ( var i = 0; i < 10; i ++ ) {
x = Math.floor(Math.random() * (max - min + 1)) + min;
y = Math.floor(Math.random() * (max - min + 1)) + min;
z = Math.floor(Math.random() * (max - min + 1)) + min;
n = new THREE.Vector3( x, y, z );
objects3.push( n );
}
for ( var x = 0; x < (objects3.length); x ++ ) {
for ( var x2 = 0; x2 < (objects3.length); x2 ++ ) {
geometrySpline.vertices.push(objects3[ x ]);
geometrySpline.vertices.push(objects3[ x2 ]);
}
}
答案 0 :(得分:0)
THREE.ConvexGeometry appears to work as WestLangley suggested
这是一个jsfiddle