Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Divide by Zero Error in plane.py as a result of Parallel Vectors A and B #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pyransac3d/plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down