Commit 60bb820e authored by sumpfralle's avatar sumpfralle

fixed some minor mistakes


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@570 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent e5f2f7f1
...@@ -23,7 +23,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>. ...@@ -23,7 +23,7 @@ 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 from pycam.Geometry.utils import number, epsilon
class BaseCutter(object): class BaseCutter(object):
......
...@@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License ...@@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
from pycam.Geometry.utils import INFINITE, sqrt from pycam.Geometry.utils import INFINITE, sqrt, epsilon
from pycam.Geometry.Point import Point from pycam.Geometry.Point import Point
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, \
......
...@@ -22,7 +22,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>. ...@@ -22,7 +22,7 @@ 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 INFINITE, number from pycam.Geometry.utils import INFINITE, number, epsilon
from pycam.Geometry.intersection import intersect_torus_plane, \ from pycam.Geometry.intersection import intersect_torus_plane, \
intersect_torus_point, intersect_circle_plane, intersect_circle_point, \ intersect_torus_point, intersect_circle_plane, intersect_circle_point, \
intersect_cylinder_point, intersect_cylinder_line, intersect_circle_line intersect_cylinder_point, intersect_cylinder_line, intersect_circle_line
...@@ -156,7 +156,7 @@ class ToroidalCutter(BaseCutter): ...@@ -156,7 +156,7 @@ class ToroidalCutter(BaseCutter):
scale = max(3, scale) scale = max(3, scale)
for i in range(scale + 1): for i in range(scale + 1):
m = float(i) / scale m = float(i) / scale
p = edge.point(m) p = edge.point_with_length_multiply(m)
(cl, ccp, cp, l) = self.intersect_torus_point(direction, p) (cl, ccp, cp, l) = self.intersect_torus_point(direction, p)
if not cl: if not cl:
continue continue
...@@ -169,9 +169,9 @@ class ToroidalCutter(BaseCutter): ...@@ -169,9 +169,9 @@ class ToroidalCutter(BaseCutter):
scale2 = 10 scale2 = 10
for i in range(1, scale2 + 1): for i in range(1, scale2 + 1):
m = min_m + ((float(i) / (scale2)) * 2 - 1)/scale m = min_m + ((float(i) / (scale2)) * 2 - 1)/scale
if (m < 0) or (m > 1): if (m < -epsilon) or (m > 1 + epsilon):
continue continue
p = edge.point(m) p = edge.point_with_length_multiply(m)
(cl, ccp, cp, l) = self.intersect_torus_point(direction, p) (cl, ccp, cp, l) = self.intersect_torus_point(direction, p)
if not cl: if not cl:
continue continue
......
...@@ -83,6 +83,9 @@ class Line(TransformableContainer): ...@@ -83,6 +83,9 @@ class Line(TransformableContainer):
self.maxy = max(self.p1.y, self.p2.y) self.maxy = max(self.p1.y, self.p2.y)
self.maxz = max(self.p1.z, self.p2.z) self.maxz = max(self.p1.z, self.p2.z)
def point_with_length_multiply(self, l):
return self.p1.add(self.dir.mul(l*self.len))
def get_length_line(self, length): def get_length_line(self, length):
""" return a line with the same direction and the specified length """ return a line with the same direction and the specified length
""" """
......
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