本文整理汇总了Python中line.Line.segmentsIntersect方法的典型用法代码示例。如果您正苦于以下问题:Python Line.segmentsIntersect方法的具体用法?Python Line.segmentsIntersect怎么用?Python Line.segmentsIntersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类line.Line
的用法示例。
在下文中一共展示了Line.segmentsIntersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: trimJoin_Coro
# 需要导入模块: from line import Line [as 别名]
# 或者: from line.Line import segmentsIntersect [as 别名]
def trimJoin_Coro(self):
""" Yields a list of lines that have their ends properly trimmed/joined
after an offset.
When the lines are offset their endpoints are just moved away the offset
distance. If you offset a circle to the inside this would mean that
all of the lines would overlap. If the circle was offset to the outside
none of the lines would be touching. This function trims the overlapping
ends and extends/joins the non touching ends.
Yields
------
in - Lines
out - one big List of lines at the end.
"""
offsetLines = []
moveEnd = yield
moveStart = yield
while not(moveStart is None):
_, point = moveEnd.segmentsIntersect(moveStart, c.ALLOW_PROJECTION)
moveEnd = Line(moveEnd.start, point, moveEnd)
moveStart = Line(point, moveStart.end, moveStart)
offsetLines.append(moveEnd)
moveEnd = moveStart
moveStart = yield
_, point = moveEnd.segmentsIntersect(offsetLines[0], c.ALLOW_PROJECTION)
moveEnd = Line(moveEnd.start, point, moveEnd)
offsetLines.append(moveEnd)
offsetLines[0] = Line(point, offsetLines[0].end, offsetLines[0])
yield offsetLines