4 元素向量(3D 数学) [英] 4 Element Vector (3D Math)

查看:51
本文介绍了4 元素向量(3D 数学)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么很多 3D API 的 Vector 类(即 Vector4(x, y, z, w) )中有 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?

推荐答案

这是 3D 空间中点的特殊表示,称为 齐次坐标.

This is a special representation of a point in 3D space, called homogeneous coordinates.

它们只是在 3D 空间中描述点的另一种方式.它们在 3D 图形中被大量使用,因为它们有一些优点:它们使一些公式更简单,并且它们允许您表示无穷远点"(或无穷远线"等,具体取决于维度).

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)

额外的事实:

使用齐次坐标从我们熟悉的 3D 空间转换对象实际上更容易的原因是,与直觉相反,射影几何避免了欧几里得几何中需要的一些特殊情况.有关详细信息,请参阅上面的文章,或任何有关射影几何的不错的数学书籍:-).

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 :-).

这篇关于4 元素向量(3D 数学)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆