roomba.py 文件源码

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

项目:Roomba980-Python 作者: NickWaterton 项目源码 文件源码
def draw_vacuum_lines(self, image, old_x_y, x_y, theta, colour="lawngreen"):
        '''
        draw lines on image from old_x_y to x_y reepresenting vacuum coverage,
        taking into account angle theta (roomba angle).
        '''
        lines = ImageDraw.Draw(image)
        if x_y != old_x_y:
            self.log.info("MAP: drawing line: %s, %s" % (old_x_y, x_y))
            lines.line([old_x_y, x_y], fill=colour,
                       width=self.roomba_icon.size[0] // 2)
        #draw circle over roomba vacuum area to give smooth edges.
        arcbox = [x_y[0]-self.roomba_icon.size[0] // 4,
                  x_y[1]-self.roomba_icon.size[0] // 4,
                  x_y[0]+self.roomba_icon.size[0] // 4,
                  x_y[1]+self.roomba_icon.size[0] // 4]
        lines.ellipse(arcbox, fill=colour)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号