Commit 9c306007 authored by lode_leroy's avatar lode_leroy

minor bugfixes

git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@69 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent d38c7c85
......@@ -44,9 +44,9 @@ class BaseCutter:
if self.maxy < triangle.miny():
return None
# check bounding sphere collision
# check bounding circle collision
c = triangle.center()
if sqr(c.x-self.location.x)+sqr(c.y-self.location.y)>self.radiussq+self.radius*triangle.radius()+triangle.radiussq():
if sqr(c.x-self.location.x)+sqr(c.y-self.location.y)>(self.radiussq+2*self.radius*triangle.radius()+triangle.radiussq()):
return None
(cl,d)= self.intersect(BaseCutter.vertical, triangle)
......
......@@ -57,6 +57,8 @@ class SphericalCutter(BaseCutter):
def intersect_sphere_point(self, direction, point):
(ccp,cp,l) = intersect_sphere_point(self.center, self.radius, self.radiussq, direction, point)
# offset intersection
cl = None
if cp:
cl = self.location.add(direction.mul(l))
return (cl,ccp,cp,l)
......
......@@ -146,7 +146,7 @@ class Triangle:
v = dot00 * dot12 - dot01 * dot02
# Check if point is in triangle
return ((u * denom) > 0) and ((v * denom) > 0) and (u + v < denom)
return ((u * denom) >= 0) and ((v * denom) >= 0) and (u + v <= denom)
def minx(self):
if not hasattr(self, "_minx"):
......
......@@ -23,12 +23,12 @@ class DropCutter:
x = minx
pa.new_scanline()
t_last = None
cl_last = None
while x<=maxx:
p = Point(x,y,z1)
z_max = -INFINITE
cl_max = None
t_max = None
cl_last = None
self.cutter.moveto(p)
triangles = self.model.triangles(p.x-self.cutter.radius,p.y-self.cutter.radius,z0,p.x+self.cutter.radius,p.y+self.cutter.radius,+INFINITE)
for t in triangles:
......@@ -79,12 +79,12 @@ class DropCutter:
y = miny
pa.new_scanline()
t_last = None
cl_last = None
while y<=maxy:
p = Point(x,y,z1)
z_max = -INFINITE
cl_max = None
t_max = None
cl_last = None
self.cutter.moveto(p)
triangles = self.model.triangles(p.x-self.cutter.radius,p.y-self.cutter.radius,z0,p.x+self.cutter.radius,p.y+self.cutter.radius,+INFINITE)
for t in triangles:
......
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