diff --git a/pyransac3d/plane.py b/pyransac3d/plane.py index 0381231..9365a33 100644 --- a/pyransac3d/plane.py +++ b/pyransac3d/plane.py @@ -53,6 +53,10 @@ def fit(self, pts, thresh=0.05, minPoints=100, maxIteration=1000): # Now we compute the cross product of vecA and vecB to get vecC which is normal to the plane vecC = np.cross(vecA, vecB) + + # if vectors A and B are parallel vector C will be a zero vector resulting in a divide by zero error in the next step + if np.any(vecC) == False: + continue # The plane equation will be vecC[0]*x + vecC[1]*y + vecC[0]*z = -k # We have to use a point to find k