Three.js删除线段中的孔/内线

Three.js删除线段中的孔/内线,three.js,buffer-geometry,line-segment,Three.js,Buffer Geometry,Line Segment,我使用数据创建缓冲几何体,并提取线段以仅显示外线: const geometry = new THREE.BufferGeometry(); geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3)); const edges = new THREE.EdgesGeometry(geometry); const line = new THREE.LineSegments(edges, new THREE.Li

我使用数据创建缓冲几何体,并提取线段以仅显示外线:

const geometry = new THREE.BufferGeometry();
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
const edges = new THREE.EdgesGeometry(geometry);
const line = new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0xc4eaff }));
因为数据中有一个“漏洞”,我得到的结果如下:

有没有一种简单的方法可以删除我的线段中的内线以获得如下结果:

我正在写答案,这时我意识到你正在使用
EdgesGeometry
。我不确定这个对象是如何组织数据的,我现在没有时间去探索它。但是,我的想法是,你需要找到一个位于外边缘的顶点,然后遍历构成外边缘线段链的顶点。当您返回到原始顶点时,任何未访问的顶点都可以被丢弃。谢谢您的提示。我来看看。你会用什么来代替
EdgesGeometry
EdgesGeometry
是个好帮手。但因为您需要特定的行为,我会手动创建自己的形状。您可以查看
EdgesGeometry
以了解它是如何发现边的,并对其进行修改以仅捕获所需的边。