title: VTK Plane through 3D points
body: <p>I have a set of 3D points and need to fit the best fitting plane which I am doing with the following code (found on stackoverflow):</p>
  
  <pre><code>points = np.reshape(points, (np.shape(points)[0], -1))
  assert points.shape[0] &lt;= points.shape[1], "There are only {} points in {} dimensions.".format(points.shape[1], points.shape[0])
  
  ctr = points.mean(axis=1)
  x = points - ctr[:, np.newaxis]
  M = np.dot(x, x.T)
  return ctr, svd(M)[0][:,-1] # return point and normal vector
  </code></pre>
  
  <p>Afterwards I want to display the plane in VTK. The problem is I have to scale the plane, but when I do so the plane is translated as well. How can I prevent that from happening ? </p>
  
  <pre><code>def create_vtk_plane_actor(point, normal_vector):
   print("\n Display plane with point: %s and vector: %s" % (point, normal_vector))
  
   plane_source = vtk.vtkPlaneSource()
   plane_source.SetOrigin(point[0], point[1], point[2])
   plane_source.SetNormal(normal_vector[0], normal_vector[1], normal_vector[2])
   plane_source.Update()
  
   transform = vtk.vtkTransform()
   transform.Scale(1.5, 1.5, 1.0)
  
   transform_filter = vtk.vtkTransformFilter()
   transform_filter.SetInputConnection(plane_source.GetOutputPort())
   transform_filter.SetTransform(transform)
  
   actor = vtk.vtkActor()
  
   mapper = vtk.vtkPolyDataMapper()
   mapper.SetInputConnection(transform_filter.GetOutputPort())
  </code></pre>