Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pyMKcam
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
pyMKcam
Commits
d45b6dcb
Commit
d45b6dcb
authored
Mar 17, 2012
by
Whitham D. Reeve II
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a floating point issue that caused a zero length line in a polygon simplification algorithm.
parent
ce372171
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
Polygon.py
pycam/Geometry/Polygon.py
+4
-6
No files found.
pycam/Geometry/Polygon.py
View file @
d45b6dcb
...
@@ -25,7 +25,8 @@ from pycam.Geometry.PointUtils import *
...
@@ -25,7 +25,8 @@ from pycam.Geometry.PointUtils import *
from
pycam.Geometry.Plane
import
Plane
from
pycam.Geometry.Plane
import
Plane
from
pycam.Geometry
import
TransformableContainer
,
IDGenerator
,
get_bisector
from
pycam.Geometry
import
TransformableContainer
,
IDGenerator
,
get_bisector
from
pycam.Geometry.utils
import
number
,
epsilon
from
pycam.Geometry.utils
import
number
,
epsilon
import
pycam.Utils.log
from
pycam.Utils
import
log
log
=
log
.
get_logger
()
# import later to avoid circular imports
# import later to avoid circular imports
#from pycam.Geometry.Model import ContourModel
#from pycam.Geometry.Model import ContourModel
...
@@ -39,9 +40,6 @@ except ImportError:
...
@@ -39,9 +40,6 @@ except ImportError:
LINE_WIDTH_INNER
=
0.7
LINE_WIDTH_INNER
=
0.7
LINE_WIDTH_OUTER
=
1.3
LINE_WIDTH_OUTER
=
1.3
log
=
pycam
.
Utils
.
log
.
get_logger
()
class
PolygonInTree
(
IDGenerator
):
class
PolygonInTree
(
IDGenerator
):
""" This class is a wrapper around Polygon objects that is used for sorting.
""" This class is a wrapper around Polygon objects that is used for sorting.
"""
"""
...
@@ -909,8 +907,7 @@ class Polygon(TransformableContainer):
...
@@ -909,8 +907,7 @@ class Polygon(TransformableContainer):
line1
=
new_group
[
index1
]
line1
=
new_group
[
index1
]
line2
=
new_group
[
index2
]
line2
=
new_group
[
index2
]
intersection
,
factor
=
line1
.
get_intersection
(
line2
)
intersection
,
factor
=
line1
.
get_intersection
(
line2
)
if
intersection
and
(
intersection
!=
line1
.
p1
)
\
if
intersection
and
(
pnorm
(
psub
(
intersection
,
line1
.
p1
))
>
epsilon
)
and
(
pnorm
(
psub
(
intersection
,
line1
.
p2
))
>
epsilon
):
and
(
intersection
!=
line1
.
p2
):
del
new_group
[
index1
]
del
new_group
[
index1
]
new_group
.
insert
(
index1
,
new_group
.
insert
(
index1
,
Line
(
line1
.
p1
,
intersection
))
Line
(
line1
.
p1
,
intersection
))
...
@@ -942,6 +939,7 @@ class Polygon(TransformableContainer):
...
@@ -942,6 +939,7 @@ class Polygon(TransformableContainer):
for
group_start
in
group_starts
:
for
group_start
in
group_starts
:
groups
.
append
(
new_group
[
last_start
:
group_start
])
groups
.
append
(
new_group
[
last_start
:
group_start
])
last_start
=
group_start
last_start
=
group_start
# Add the remaining lines to the first group or as a new
# Add the remaining lines to the first group or as a new
# group.
# group.
if
groups
[
0
][
0
]
.
p1
==
new_group
[
-
1
]
.
p2
:
if
groups
[
0
][
0
]
.
p1
==
new_group
[
-
1
]
.
p2
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment