euclid.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:zellij 作者: nedbat 项目源码 文件源码
def offset(self, distance):
        """Create another Line `distance` from this one."""
        (x1, y1), (x2, y2) = self
        dx = x2 - x1
        dy = y2 - y1
        hyp = math.hypot(dx, dy)
        offx = dy / hyp * distance
        offy = -dx / hyp * distance
        return Line(Point(x1 + offx, y1 + offy), Point(x2 + offx, y2 + offy))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号