title: Re-render geometry in three.js after a user changes the parameters with dat.gui
body: <p>I'm trying to get a 3D spiral geometry to update in the canvas as the user uses a slider to change the number of coils. I've been using the dat.gui plugin as the interface. I can get it to work if I'm changing a parameter external to the geometry, like the x-scale, but if I'm trying to change a parameter that's internal to the geometry, it won't update. With console.log I can see that the updates occur in the information stored in the geometry, but the canvas doesn't update. Here's what I have for the dat.gui interface:</p>
  <pre><code>  const gui = new GUI()
    
    let guiControls = new function() {
      this.coils = 10
    }
  
    gui.add(guiControls, 'coils', 1, 15).onChange(regenerateGeometry)
    
    function regenerateGeometry() {
      let newGeometry = new THREE.Geometry()
   
      spiralSetup(newGeometry)
  
      mesh.geometry.dispose()
      mesh.geometry = newGeometry
  
      render()
    }
  </code></pre>
  <p>And here's what I have for the spiral geometry:</p>
  <pre><code>function spiralSetup(geometry) {
      for (let i = theta; i &lt; t; i++) {
        let r = Math.exp((i / segments) * (1 / Math.tan(alpha)))
        let x = r * aa * Math.cos(i / segments) * Math.sin(beta)
        let y = r * aa * Math.sin(i / segments) * Math.sin(beta)
        let z = -r * aa * Math.cos(beta)
        
        geometry.vertices.push(new THREE.Vector3(x, y, z))
      }
    }
    
    spiralSetup(startGeometry)
  
    let material = new THREE.LineBasicMaterial({color: 0xBA42A5})
    let mesh = new THREE.Line(startGeometry, material)
  
    scene.add(mesh)
  </code></pre>
  <p>This jsfiddle includes all of the code: <a href="https://jsfiddle.net/yjsnhf72/" rel="nofollow noreferrer">https://jsfiddle.net/yjsnhf72/</a></p>