quickjoint.py 文件源码

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

项目:QuickJoint 作者: JarrettR 项目源码 文件源码
def draw_box(self, start, guideLine, xDistance, yDistance, kerf):
        polR, polPhi = cmath.polar(guideLine)

        #Kerf expansion
        if self.flipside:  
            start -= cmath.rect(kerf / 2, polPhi)
            start -= cmath.rect(kerf / 2, polPhi + (cmath.pi / 2))
        else:
            start -= cmath.rect(kerf / 2, polPhi)
            start -= cmath.rect(kerf / 2, polPhi - (cmath.pi / 2))

        lines = []
        lines.append(['M', [start.real, start.imag]])

        #Horizontal
        polR = xDistance
        move = cmath.rect(polR + kerf, polPhi) + start
        lines.append(['L', [move.real, move.imag]])
        start = move

        #Vertical
        polR = yDistance
        if self.flipside:  
            polPhi += (cmath.pi / 2)
        else:
            polPhi -= (cmath.pi / 2)
        move = cmath.rect(polR  + kerf, polPhi) + start
        lines.append(['L', [move.real, move.imag]])
        start = move

        #Horizontal
        polR = xDistance
        if self.flipside:  
            polPhi += (cmath.pi / 2)
        else:
            polPhi -= (cmath.pi / 2)
        move = cmath.rect(polR + kerf, polPhi) + start
        lines.append(['L', [move.real, move.imag]])
        start = move

        lines.append(['Z', []])

        return lines
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号