geometry.py 文件源码

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

项目:PassportEye 作者: konstantint 项目源码 文件源码
def rotated(self, rotation_center, angle):
        """Returns a RotatedBox that is obtained by rotating this box around a given center by a given angle.

        >>> assert RotatedBox([2, 2], 2, 1, 0.1).rotated([1, 1], np.pi/2).approx_equal([0, 2], 2, 1, np.pi/2+0.1)
        """
        rot = np.array([[np.cos(angle), np.sin(angle)], [-np.sin(angle), np.cos(angle)]])
        t = np.asfarray(rotation_center)
        new_c = np.dot(rot.T, (self.center - t)) + t
        return RotatedBox(new_c, self.width, self.height, (self.angle+angle) % (np.pi*2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号