33
I'm adding this answer not because it's likely to be helpful but just because it's true.
我加这个答案不是因为它可能有用,而是因为它是真的。
In addition to using the existing answers explaining how to make more than one translation by chaining them, you can also construct the 4x4 matrix yourself
除了使用现有的答案来解释如何通过链接实现多个翻译,您还可以自己构建4x4矩阵。
I grabbed the following image from some random site I found while googling which shows rotational matrices:
我从我在谷歌搜索中发现的一些随机的网站上抓取了如下图片:
Rotation around x axis:
Rotation around y axis:
Rotation around z axis:
绕x轴旋转:绕y轴旋转:绕z轴旋转:
I couldn't find a good example of translation, so assuming I remember/understand it right, translation:
我找不到一个翻译的好例子,所以假设我记得/理解它,翻译:
[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[x y z 1]
See more at the Wikipedia article on transformation as well as the Pragamatic CSS3 tutorial which explains it rather well. Another guide I found which explains arbitrary rotation matrices is Egon Rath's notes on matrices
请参阅维基百科关于转换的文章以及实用的CSS3教程,它解释得很好。我发现的另一个解释任意旋转矩阵的指南是Egon Rath关于矩阵的笔记。
Matrix multiplication works between these 4x4 matrices of course, so to perform a rotation followed by a translation, you make the appropriate rotation matrix and multiply it by the translation matrix.
矩阵乘法在这些4 * 4矩阵之间是可以的,所以要做一个旋转,然后是一个平移,你要做一个合适的旋转矩阵并乘以平移矩阵。
This can give you a bit more freedom to get it just right, and will also make it pretty much completely impossible for anyone to understand what it's doing, including you in five minutes.
这可以给你更多的自由来获得它的权利,也会使任何人都不可能理解它在做什么,包括你在五分钟内。
But, you know, it works.
但是,你知道,它是有效的。
Edit: I just realized that I missed mentioning probably the most important and practical use of this, which is to incrementally create complex 3D transformations via Javascript, where things will make a bit more sense.
编辑:我刚刚意识到,我漏掉了可能最重要和最实际的使用方法,即通过Javascript增量地创建复杂的3D转换,这样做会更有意义。