# 三维变换矩阵的理解

3D空间中的一个点的坐标，可以用(x,y,z)来表示。

## 1.缩放矩阵

Sx

0

0

0

0

Sy

0

0

0

0

Sz

0

0

0

0

1

`(x,y,z,1) * S = (Sx*x,Sy*y,Sz*z,1)`

## 2.旋转矩阵

cos(Rx)*cos(Rz)

cos(x)*sin(z)

-sin(y)

0

sin(x)sin(y)cos(z)-cos(x)*sin(z)

sin(x)sin(y)sin(z)+cos(x)*cos(z)

sin(x)*cos(y)

0

cos(x)sin(y)cos(z)+sin(x)*sin(z)

cos(x)sin(y)sin(z)-sin(x)*cos(z)

cos(x)*cos(y)

0

0

0

0

1

## 3.平移矩阵

1

0

0

0

0

1

0

0

0

0

1

0

Tx

Ty

Tz

1

`(x,y,z,1) * T = (Tx+x,Ty+y,Tz+z,1)`

## 4.综合变换矩阵

Sxcos(Rx)cos(Rz)

Sxcos(Rx)sin(Rz)

-Sx*sin(Ry)

0

Sy(sin(Rx)sin(Ry)cos(Rz)-cos(Rx)sin(Rz))

Sy(sin(Rx)sin(Ry)sin(z)+cos(Rx)cos(Rz))

Sysin(Rx)cos(Ry)

0

Sz(cos(Rx)sin(Ry)cos(Rz)+sin(Rx)sin(Rz))

Sz(cos(Rx)sin(Ry)sin(Rz)-sin(Rx)cos(Rz))

Szcos(Rx)cos(Ry)

0

Tx

Ty

Tz

1

m00

m01

m02

0

m10

m11

m12

0

m20

m21

m22

0

Tx

Ty

Tz

1

m00

m10

m20

Tx

m01

m11

m21

Ty

m02

m12

m22

Tz

0

0

0

1

### 4.1左右手系转换

`m02 = -m02; m12 = - m12; m20 = -m20; m21 = -m21; Tz = -Tz`

m00

m10

-m20

Tx

m01

m11

-m21

Ty

-m02

-m12

m22

-Tz

0

0

0

1

1

0

0

0

0

1

0

0

0

0

-1

0

0

0

0

1

M*S 得到新的矩阵，转换为列优先的写法：

m00

m10

-m20

Tx

m01

m11

-m21

Ty

m02

m12

-m22

Tz

0

0

0

1

4 篇文章10 人订阅

0 条评论

## 相关文章

1362

43015

1762

1302

4477

1744

3245

3524

3605

### 转--Golang图像处理工具库，图像相似度计算，图像二值化

imgo golang图像处理工具库，图像相似度计算，图像二值化(golang image process lib) 目前只支持jpg,png 安装 go ge...

65914