angle_tol.py 文件源码

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

项目:imagepy 作者: Image-Py 项目源码 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        linefont = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                           wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(linefont)
        dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)
        for line in self.body:
            dc.DrawLines([f(*i) for i in line])
            for i in line:dc.DrawCircle(f(*i),2)
            pts = np.array(line)
            v1 = pts[:-2]-pts[1:-1]
            v2 = pts[2:]-pts[1:-1]
            a = np.sum(v1*v2, axis=1)*1.0
            a/=norm(v1,axis=1)*norm(v2,axis=1)
            ang = np.arccos(a)/np.pi*180
            for i,j in zip(ang,line[1:-1]):
                dc.DrawText('%.0f'%i, f(*j))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号