Computed radius is NaN

I’m looking for some insight into the type of issues that would cause the following error so that I can resolve the problem. I’m using R107.

three.js:11903 THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values. BufferGeometry {uuid: "1F4641CE-9004-452A-838E-1DC69F07A323", name: "CrodGeometry", type: "BufferGeometry", index: null, attributes: {…}, …}attributes: {position: Float32BufferAttribute, color: Float32BufferAttribute}boundingBox: nullboundingSphere: Spherecenter: Vector3 {x: 722.9655294418335, y: 0, z: 278.7619934082031}radius: NaN__proto__: ObjectdrawRange: {start: 0, count: Infinity}groups: []index: nullmorphAttributes: {}name: "CrodGeometry"type: "BufferGeometry"userData: {}uuid: "1F4641CE-9004-452A-838E-1DC69F07A323"drawcalls: (...)id: 11offsets: (...)__proto__: EventDispatcher
computeBoundingSphere @ three.js:11903
drawCRods @ app.js:873
init @ app.js:1197
(anonymous) @ app.js:317
processModel @ model-loader.js:47
(anonymous) @ model-loader.js:35
(anonymous) @ three.js:34525
load (async)
load @ three.js:34505
(anonymous) @ model-loader.js:33
Promise.then (async)
load @ model-loader.js:28
mounted @ app.js:312
callHook @ vuejs-2.0.js:2878
mountComponent @ vuejs-2.0.js:2762
Vue$3.$mount @ vuejs-2.0.js:8349
Vue$3.$mount @ vuejs-2.0.js:10689
Vue._init @ vuejs-2.0.js:4524
Vue$3 @ vuejs-2.0.js:4609
renderDrawing @ app.js:306
BDF @ (index):410
onchange @ (index):446

Please add more detail to your post

Your post has been flagged since it is lacking detail, has already been asked or is easily answered using a search engine.

Please add more detail, for example:

Your post will be reviewed in 24 hours and if it has not improved it will be deleted.

You will, of course, be free to make a new post in that case.

I’ve included a code example. The code works with 12 vertices (used to test algorithm correctness) but I have over 600k vertices representing line segments. The problem occurs when computeBoundingSphere is invoked. A single geometry is used for performance reasons. The full source code is part of a propriety application.

for (var i = 0; i < tauGeometry.vertices.length; i += 2) {
p1 = new THREE.Vector3(tauGeometry.vertices[i].x,
tauGeometry.vertices[i].y,
tauGeometry.vertices[i].z)
positions.push(p1)
colors.push(255)
colors.push(255)
colors.push(255)
p2 = new THREE.Vector3(tauGeometry.vertices[i + 1].x,
tauGeometry.vertices[i + 1].y,
tauGeometry.vertices[i + 1].z)
positions.push(p2)
colors.push(255)
colors.push(255)
colors.push(255)
}

lineSegGeo = new THREE.BufferGeometry().setFromPoints(positions)
lineSegGeo.addAttribute(‘color’, new THREE.Float32BufferAttribute(colors, 3))
lineSegGeo.computeBoundingBox()
lineSegGeo.computeBoundingSphere()
lineSegtau = new THREE.LineSegments(lineSegGeo, tauMaterial)
lineSegtau.name = ‘tau’
lineSegtau.etype = ’ ’
scene.add(lineSegtau)