当前位置: 首页 > news >正文

推导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验证,确实如此

在这里插入图片描述

相关文章:

  • 数据集007:垃圾分类数据集(含数据集下载链接)
  • 宝塔部署纯Vue项目,无后端
  • 文献分享《Microbiome and cancer》
  • 在 Visual Studio Code(VS Code)中调试 .NET Core 程序详细步骤
  • markdown画时序图的时候,如何自动显示每一条时序的序号
  • 服务器端口转发,服务器端口转发的作用、好处与坏处
  • Divisibility Part2(整除理论2)
  • PY32F002A单片机 us 延时,非常惊讶
  • 宿舍管理系统代码详解(操作界面)
  • 代码随想录算法训练营第四十一天|509. 斐波那契数、70. 爬楼梯、746. 使用最小花费爬楼梯
  • 消费增值:国家支持的消费新零售模型
  • linux 查看csv文件,按指定列聚合 排序
  • Unity面试八股文之基础篇
  • 扩散模型的一些公式证明
  • 图论(四)—最短路问题(Dijkstra)
  • JS书写规范
  • TCP/IP协议族
  • 使用python将多个mp3或者wma合并成一个mp3
  • Windows系统使用Docker部署Focalboard团队协作工具详细流程
  • can设备调试 - linux driver
  • 国家统计局:一季度全国规模以上文化及相关产业企业营业收入增长6.2%
  • 网警侦破特大“刷量引流”网络水军案:涉案金额达2亿余元
  • 准85后青海海北州副州长、州公安局局长李贤荣赴山东临沂挂职
  • 暴涨96%!一季度“中国游中国购”持续升温,还有更多利好
  • 利物浦提前四轮英超夺冠,顶级联赛冠军数追平曼联
  • 四川邻水县县长石国平拟任县(市、区)党委书记