转换刚性变换,使旋转中心不是原点

给定一个旋转矩阵R,使某个点c(新的旋转中心)在变换 下不变y = R * c,即改变R使旋转中心位于c而不是原点的等效变换是什么。一个限制是我不能对要使用的实际矢量进行操作,只能编辑原始转换(这是因为那部分埋在外部库中,我无法更改它)。


我有一些有用的东西,但它违反了上述限制:


import numpy as np


# R is a given rotation matrix, v is an arbitrary vector and cen is the desired center


theta = np.pi / 2

cen = np.array([0.5, 0.5])

v = np.array([0, 0])

R = Rot(theta) # ordinary rotation matrix


y = R @ (v - center ) + cen 


# y = [0, 1] which is the expected result since we have a right angle triangle 

# with vertices at (0, 0) (0.5, 0.5) and (0, 1)

我也尝试实现类似于此处的计算,但我得到的结果不正确


我怎样才能获得相同的结果但保持形式y = R*v(或使用刚性 transform y = R*v + t)但v不像我那样改变?


qq_花开花谢_0
浏览 64回答 1
1回答

凤凰求蛊

在写这个问题时,我想到了(显而易见的)解决方案,它只是扩展我之前写的解决方案并重新排列。如果有人也需要这个,新的转换应该是:y = R_new*v + t_new其中R_new = R,t_new = (I - R)*cen和I是恒等式。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python