¿Cómo puedo obtener los pares de vértices que forman los bordes en EdgeGeometry?
Necesito obtener las coordenadas del punto de inicio y del punto final de cada borde. Actualmente estoy usando EdgeGeometry. Sin embargo, no puedo averiguar el orden en que se almacenan los vértices en el atributo.
Quiero almacenar los vértices en una matriz, como pares que forman los bordes.
addBoxEdgestoCache = () => { const boxEdges = new THREE.EdgesGeometry(this.box.geometry); const lineMaterial = new THREE.LineBasicMaterial( { color: 'black', linewidth: 0.005} ); const line = new THREE.LineSegments(boxEdges, lineMaterial); this.scene.add(line); const arrLength = boxEdges.attributes.position.array.length; for (let i = 0; i < arrLength; i++){ // get start point const startPt = new THREE.Vector3(boxEdges.attributes.position.array[i], boxEdges.attributes.position.array[i+1], boxEdges.attributes.position.array[i+2]); // get end point const endPt = new THREE.Vector3(boxEdges.attributes.position.array[arrLength/2], boxEdges.attributes.position.array[arrLength/2 + 1], boxEdges.attributes.position.array[arrLength/2+2]); // store the edge as pair of vertices this.cache.edges.push([startPt, endPt]); } }La parte de obtener el punto de inicio y obtener el punto final es actualmente incorrecta.