The issue: I am currently in need of updating the vertex positions on a mesh after scaling it. This update is necessary for me to accurately calculate the volume of the mesh. To maintain scale as an active parameter in the original mesh, I have created a cloned mesh.
Initially, I followed the guidance provided at How to update vertices geometry after rotate or move object
This method worked flawlessly with three.js release .70, however, it seems to be broken on release .72.
My implementation:
var volumeClone = new THREE.Mesh(this.mesh.geometry.clone(), new THREE.MeshBasicMaterial({ color: 0xff0000 }));
volumeClone.scale.z = heightScale;
volumeClone.updateMatrix();
volumeClone.geometry.applyMatrix(volumeClone.matrix);
volumeClone.matrix.identity();
volumeClone.geometry.verticesNeedUpdate = true;
volumeClone.scale.set(1, 1, 1);
console(calculateVolume(volumeClone));
Outcome:
When executed in Chrome, the error message indicates:
Uncaught TypeError: Cannot read property 'setFromPoints' of undefined THREE.Geometry.computeBoundingBox @lib.min.js:3THREE.Geometry.applyMatrix
Steps taken so far: I have made attempts to debug and pinpoint the root cause within Geometry.js and Box3.js. Furthermore, I have been analyzing the programmatic flow to identify why "this.boundBox" remains undefined, but thus far, I have yet to determine the underlying issue.
Inquiry: Is the syntax correct? Could there possibly be an update in the specific area of three.js that led to this malfunction?