on TypeError: Cannot read property x of undefined thrown when converting BufferGeometry to Geometry
I have a non-indexed BufferGeometry that I am trying to convert to Geometry so I may compute line distances but I am running into a exception within the three.js code:
The BufferGeometry contains a position attribute with a array of 6 values (2 vertices). Seeing that the error is thrown in computeFaceNormals, the problem seems to begin beforehand when the faces I are being added here:
Notice that since positions has the length of 6 then this loop will be iterated once, hence adding a face with 3 sides (0,1,2); however since there is only 2 vertices then the third vertex is undefined when being used here:
With vC being undefined, it later throws the error in subVectors function where it tries to grab the x value of the first parameter.