Commit c3685f3e authored by lode_leroy's avatar lode_leroy

guard against float division

git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@22 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 4b8afbdc
......@@ -16,6 +16,7 @@ def intersect_lines(xl,zl,nxl,nzl,xm,zm,nxm,nzm):
X = None
Z = None
# print "xl=",xl,", zl=",zl,"nxl=",nxl,", nzl=",nzl,", X=", X, ", Z=",Z,", xm=",xm,",zm=",zm, ", nxm=",nxm,",nzm=",nzm
try:
if isZero(nzl) and isZero(nzm):
pass
elif isZero(nzl) or isZero(nxl):
......@@ -27,14 +28,12 @@ def intersect_lines(xl,zl,nxl,nzl,xm,zm,nxm,nzm):
Z = zl - (xm-xl)*nxl/nzl
return (X,Z)
else:
try:
X = (zl-zm+(xm*nxm/nzm-xl*nxl/nzl))/(nxm/nzm-nxl/nzl)
except:
pass
if X and xl < X and X < xm:
Z = zl + (X-xl)*nxl/nzl
return (X,Z)
except:
pass
return (None,None)
def intersect_plane_point(plane, direction, point):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment