Search code examples
javascriptarraysdata-structuresthree.jsedges

Three.js (r75) - Why THREE.Geometry does not have an array for storing edges?


I know there are ways to draw edges, but what's the reason why THREE.Geometry only has an array for vertices and one for faces?

I was looking at this example and I found it useful to have an array of edges, in this way accessing them is a lot easier.


Solution

  • The geometry data structure does not contain edges because edges are not, in general, needed for rendering.

    three.js has utilities that can help you, however.

    If you look at the source code for EdgesGeometry you can see how to create and access the edges.

    The same can be said for WireframeGeometry.

    three.js r.84