Skip to content

Commit

Permalink
Prevent division by zero in stltool, at the risk of non-normalized no…
Browse files Browse the repository at this point in the history
…rmals.
  • Loading branch information
kliment committed Sep 28, 2011
1 parent e97754e commit d59fc73
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stltool.py
Expand Up @@ -8,6 +8,8 @@ def genfacet(v):
vecb=[v[2][0]-v[1][0],v[2][1]-v[1][1],v[2][2]-v[1][2]]
vecx=cross(veca,vecb)
vlen=math.sqrt(sum(map(lambda x:x*x,vecx)))
if vlen==0:
vlen=1
normal=map(lambda x:x/vlen, vecx)
return [normal,v]

Expand Down

0 comments on commit d59fc73

Please sign in to comment.