Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
Getting pairs of vertices in threejs EdgeGeometry

How can I get the pairs of vertices that form the edges in EdgeGeometry?

I need to get the start point and end point coordinates of each edges. I am currently using EdgeGeometry. However, I can't figure out the order in which the vertices is stored in the attribute.

I want to store the vertices in an array, as pairs which form the edges.

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]);
     }
 }

The get start point and get end point portion is currently incorrect.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda