Commit 8f3615ad authored by sumpfralle's avatar sumpfralle

simplify polygon models based on rendered characters by allowing reversed line directions


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@995 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent d603e917
......@@ -126,7 +126,7 @@ class Charset(object):
new_model = ContourModel()
for line in charset_letter.get_positioned_lines(base,
skew=skew):
new_model.append(line)
new_model.append(line, allow_reverse=True)
for polygon in new_model.get_polygons():
# add polygons instead of lines -> more efficient
current_line.append(polygon)
......
......@@ -353,13 +353,21 @@ class ContourModel(BaseModel):
log.debug("merge_polygon_if_possible: ambiguous combinations " \
+ "(%s - %s)" % (other_polygon, connectables))
def append(self, item, unify_overlaps=False):
def append(self, item, unify_overlaps=False, allow_reverse=False):
super(ContourModel, self).append(item)
if isinstance(item, Line):
item_list = [item]
if allow_reverse:
item_list.append(Line(item.p2, item.p1))
found = False
for line_group in self._line_groups:
if line_group.is_connectable(item):
line_group.append(item)
for candidate in item_list:
if line_group.is_connectable(candidate):
line_group.append(candidate)
self._merge_polygon_if_possible(line_group)
found = True
break
if found:
break
else:
# add a single line as part of a new group
......
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