Hi, I posted an issue some time ago BufferGeometry.calculateBoundingSphere fails due to NaN values · Issue #25069 · mrdoob/three.js · GitHub
but it was closed, perhaps I wasn’t too clear.
I had an example there:
// vertices - is the plain float32 array of 321544 values in total
const vbVertices = new Float32BufferAttribute(vertices, 3)
geometry.setAttribute('position', vbVertices)
Inside BufferAttribute there is code:
this.count = array !== undefined ? array.length / itemSize : 0;
In my case, due to floating point errors, this.count is set to 107181.333. This will affect all for loops that iterate over elements in the attribute, e.g.
for (i = 0; i< this.count; ++i) {… }
If this.count is not integer as in my case, it will give unwanted extra iteration. BufferGeometry.computeBoundingSphere is an example, it will think there’s NaN values, but I don’t have NaN values in my buffer.