4 元素向量(3D 数学)
为什么很多3D API的Vector类中都有一个W术语(即Vector4(x, y, z, w))?是否存在绝对需要 W 项的数学运算?
Why is there a W term in a lot of 3D API's Vector class (i.e. Vector4(x, y, z, w) ) ? Are there math operations that absolutely require the W term?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 3D 空间中点的特殊表示,称为齐次坐标。
它们只是描述 3D 空间中的点的另一种方式。它们在 3D 图形中被大量使用,因为它们有一些优点:它们使一些公式更简单,并且允许您表示“无穷远点”(或“无穷远线”等,具体取决于尺寸)。
请参阅例如这篇文章的解释:
http:// andrewharvey4.wordpress.com/2008/09/29/xyzw-in-opengldirect3d- Uniformous-coordinates/
维基百科也给出了一个很好的概述(警告,其中有一些有趣但严肃的数学):
http://en.wikipedia.org/wiki/Homogeneous_coordinates
http://en.wikipedia.org/wiki/Projective_geometry
(射影几何是齐次坐标的基础理论)
:
额外事实 使用齐次坐标从我们熟悉的 3D 空间进行对象变换实际上更容易,因为与直觉相反,射影几何避免了欧几里得几何中需要的一些特殊情况。有关详细信息,请参阅上面的文章或任何有关射影几何的体面数学书:-)。
This is a special representation of a point in 3D space, called homogeneous coordinates.
They are just another way to describe a point in 3D space. They are used a lot in 3D graphics because they have a few advantages: they make some formulas simpler, and they allow you to represent a "point at infinity" (or "line at infinity" etc. depending on dimension).
See e.g. this article for an explanation:
http://andrewharvey4.wordpress.com/2008/09/29/xyzw-in-opengldirect3d-homogeneous-coordinates/
Wikipedia also gives a nice overview (warning, some fun but serious math in there):
http://en.wikipedia.org/wiki/Homogeneous_coordinates
http://en.wikipedia.org/wiki/Projective_geometry
(projective geometry is the underlying theory for homogeneous coordinates)
Bonus fact:
The reason that transformations of objects from our familiar 3D space are actually easier using homogeneous coordinates is because, contrary to intuition, projective geometry avoids some of the special cases that you need in Euclidean geometry. For details, see articles above, or any decent math book on projective geometry :-).