推导2维镜像变换(Reflection Transform)的公式

我们知道2维的旋转变换公式为
Q = ( cos ⁡ ( θ ) sin ⁡ ( θ ) − sin ⁡ ( θ ) cos ⁡ ( θ ) ) Q=\left( \begin{matrix} \cos \left( \theta \right)& \sin \left( \theta \right)\\ -\sin \left( \theta \right)& \cos \left( \theta \right)\\ \end{matrix} \right) Q=(cos(θ)sin(θ)sin(θ)cos(θ))
如果 y = Q T x y=Q^{T}x y=QTx,那么逆时针旋转x就得到了y。旋转矩阵可以看我的其他博客3维旋转的3种表示方法之间的关系,还有从几何与代数的角度推算坐标旋转变换矩阵(以2维为例)

而镜像变换,是点x以某个向量为轴,得到其镜像y。
Q = ( cos ⁡ ( θ ) sin ⁡ ( θ ) sin ⁡ ( θ ) − cos ⁡ ( θ ) ) Q=\left( \begin{matrix} \cos \left( \theta \right)& \sin \left( \theta \right)\\ \sin \left( \theta \right)& -\cos \left( \theta \right)\\ \end{matrix} \right) Q=(cos(θ)sin(θ)sin(θ)cos(θ))
该镜像变换以向量 ( c o s ( θ / 2 ) , s i n ( θ / 2 ) ) (cos(\theta/2),sin(\theta/2)) (cos(θ/2),sin(θ/2))为轴

镜像变换是对称矩阵,因此 y = Q T x = Q x y=Q^{T}x=Qx y=QTx=Qx

该镜像变换矩阵是怎么来的呢,下面进行推导。假设需要镜像的点为A ( x 0 , y 0 ) (x_0,y_0) (x0,y0),镜像后得到的点为B ( x 1 , y 1 ) (x_1,y_1) (x1,y1)
那么就有下面两个约数(1) A B → \overrightarrow{AB} AB 垂直与向量,(2)A到向量的距离与B到向量的距离相等,并且方向相反。
根据条件(1)
( x 0 − x 1 ) cos ⁡ θ 2 + ( y 0 − y 1 ) sin ⁡ θ 2 = 0 \left( x_0-x_1 \right) \cos \frac{\theta}{2}+\left( y_0-y_1 \right) \sin \frac{\theta}{2}=0 (x0x1)cos2θ+(y0y1)sin2θ=0

向量 ( c o s ( θ / 2 ) , s i n ( θ / 2 ) ) (cos(\theta/2),sin(\theta/2)) (cos(θ/2),sin(θ/2))可以看做一条直线,该直线为
− sin ⁡ θ 2 x + cos ⁡ θ 2 y = 0 -\sin \frac{\theta}{2}x+\cos \frac{\theta}{2}y=0 sin2θx+cos2θy=0
A到该直线距离为
f 1 = − sin ⁡ θ 2 x 0 + cos ⁡ θ 2 y 0 f1=-\sin \frac{\theta}{2}x_0+\cos \frac{\theta}{2}y_0 f1=sin2θx0+cos2θy0
B到该直线距离为
f 2 = − sin ⁡ θ 2 x 1 + cos ⁡ θ 2 y 1 f2=-\sin \frac{\theta}{2}x_1+\cos \frac{\theta}{2}y_1 f2=sin2θx1+cos2θy1
条件(2)为
f 1 = − f 2 f1=-f2 f1=f2
根据解这两个方程,就可以得到上面的镜像变换矩阵Q,我用mathematica验证,确实如此

在这里插入图片描述

  • 14
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值