Commit d59fc731 authored by Kliment Yanev's avatar Kliment Yanev

Prevent division by zero in stltool, at the risk of non-normalized normals.

parent e97754e3
......@@ -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]
......
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