Commit cae26191 authored by sumpfralle's avatar sumpfralle

fixed remaining bugs after the recent code unification of Cutters


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@674 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent c4d2b06f
...@@ -23,7 +23,9 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>. ...@@ -23,7 +23,9 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
from pycam.Geometry.Point import Point from pycam.Geometry.Point import Point
from pycam.Geometry.utils import number, epsilon from pycam.Geometry.utils import number, INFINITE, epsilon
from pycam.Geometry.intersection import intersect_circle_point, \
intersect_cylinder_point, intersect_cylinder_line
class BaseCutter(object): class BaseCutter(object):
...@@ -116,7 +118,7 @@ class BaseCutter(object): ...@@ -116,7 +118,7 @@ class BaseCutter(object):
* triangle.radius + triangle.radiussq) + epsilon: * triangle.radius + triangle.radiussq) + epsilon:
return None return None
(cl, d)= self.intersect(BaseCutter.vertical, triangle) (cl, d, cp) = self.intersect(BaseCutter.vertical, triangle)
return cl return cl
def intersect_circle_triangle(self, direction, triangle): def intersect_circle_triangle(self, direction, triangle):
......
...@@ -24,8 +24,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>. ...@@ -24,8 +24,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
from pycam.Geometry.utils import INFINITE, sqrt, epsilon from pycam.Geometry.utils import INFINITE, sqrt, epsilon
from pycam.Geometry.Point import Point, Vector from pycam.Geometry.Point import Point, Vector
from pycam.Geometry.intersection import intersect_circle_plane, \ from pycam.Geometry.intersection import intersect_circle_plane, \
intersect_circle_point, intersect_circle_line, \ intersect_circle_point, intersect_circle_line
intersect_cylinder_point, intersect_cylinder_line
from pycam.Cutters.BaseCutter import BaseCutter from pycam.Cutters.BaseCutter import BaseCutter
...@@ -142,6 +141,14 @@ class CylindricalCutter(BaseCutter): ...@@ -142,6 +141,14 @@ class CylindricalCutter(BaseCutter):
return (cl, ccp, cp, d) return (cl, ccp, cp, d)
return (None, None, None, INFINITE) return (None, None, None, INFINITE)
def intersect_circle_point(self, direction, point):
(ccp, cp, l) = intersect_circle_point(self.center, self.axis,
self.distance_radius, self.distance_radiussq, direction, point)
if ccp:
cl = cp.add(self.location.sub(ccp))
return (cl, ccp, cp, l)
return (None, None, None, INFINITE)
def intersect_circle_line(self, direction, edge): def intersect_circle_line(self, direction, edge):
(ccp, cp, l) = intersect_circle_line(self.center, self.axis, (ccp, cp, l) = intersect_circle_line(self.center, self.axis,
self.distance_radius, self.distance_radiussq, direction, edge) self.distance_radius, self.distance_radiussq, direction, edge)
......
...@@ -25,8 +25,7 @@ from pycam.Geometry import Matrix ...@@ -25,8 +25,7 @@ from pycam.Geometry import Matrix
from pycam.Geometry.Point import Point, Vector from pycam.Geometry.Point import Point, Vector
from pycam.Geometry.utils import INFINITE, epsilon, sqrt from pycam.Geometry.utils import INFINITE, epsilon, sqrt
from pycam.Geometry.intersection import intersect_sphere_plane, \ from pycam.Geometry.intersection import intersect_sphere_plane, \
intersect_sphere_point, intersect_sphere_line, \ intersect_sphere_point, intersect_sphere_line
intersect_cylinder_point, intersect_cylinder_line
from pycam.Cutters.BaseCutter import BaseCutter from pycam.Cutters.BaseCutter import BaseCutter
...@@ -197,6 +196,7 @@ class SphericalCutter(BaseCutter): ...@@ -197,6 +196,7 @@ class SphericalCutter(BaseCutter):
(cl_t, d_t) = self.intersect_sphere_triangle(direction, triangle) (cl_t, d_t) = self.intersect_sphere_triangle(direction, triangle)
d = INFINITE d = INFINITE
cl = None cl = None
cp = None
if d_t < d: if d_t < d:
d = d_t d = d_t
cl = cl_t cl = cl_t
......
...@@ -240,6 +240,7 @@ class ToroidalCutter(BaseCutter): ...@@ -240,6 +240,7 @@ class ToroidalCutter(BaseCutter):
(cl_t, d_t) = self.intersect_torus_triangle(direction, triangle) (cl_t, d_t) = self.intersect_torus_triangle(direction, triangle)
d = INFINITE d = INFINITE
cl = None cl = None
cp = None
if d_t < d: if d_t < d:
d = d_t d = d_t
cl = cl_t cl = cl_t
......
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