title: Plane fitting in a 3d point cloud
body: <p>I am trying to find planes in a 3d point cloud, using the regression formula <a href="https://en.wikipedia.org/wiki/Plane_(geometry)" rel="noreferrer">Z= a<em>X + b</em>Y +C</a> </p>
  
  <p>I implemented least squares and ransac solutions,
   but the 3 parameters equation limits the plane fitting to 2.5D- the formula can not be applied on planes parallel to the Z-axis.</p>
  
  <p>My question is <strong>how can I generalize the plane fitting to full 3d</strong>?
  I want to add the fourth parameter in order to get the full equation
   a<em>X +b</em>Y +c*Z + d 
  how can I avoid the trivial (0,0,0,0) solution?</p>
  
  <p>Thanks!</p>
  
  <p>The Code I'm using:</p>
  
  <pre><code>from sklearn import linear_model
  
  def local_regression_plane_ransac(neighborhood):
      """
      Computes parameters for a local regression plane using RANSAC
      """
  
      XY = neighborhood[:,:2]
      Z  = neighborhood[:,2]
      ransac = linear_model.RANSACRegressor(
                                            linear_model.LinearRegression(),
                                            residual_threshold=0.1
                                           )
      ransac.fit(XY, Z)
  
      inlier_mask = ransac.inlier_mask_
      coeff = model_ransac.estimator_.coef_
      intercept = model_ransac.estimator_.intercept_
  </code></pre>